diff --git a/README.md b/README.md index 0f7d9230..78539909 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,17 @@ -# smooch-java +# sunshine-conversations-java -The Java package for the Smooch API +The Java package for the Sunshine Conversations API -The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). +This SDK is automatically generated by the [OpenAPI Generator Codegen](https://github.com/OpenAPITools/openapi-generator) project using the [Sunshine Conversations API spec](https://github.com/zendesk/sunshine-conversations-api-spec). -This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project using the [Smooch api spec](https://github.com/smooch/api-spec). +## Sunshine Conversations API Version -## Smooch API Version +The Sunshine Conversations API offers multiple [versions](https://docs.smooch.io/guide/versioning/). Each release of this project targets one and only one Sunshine Conversations API version. If you depend on an older version of the API, you may need to use an older release of this library. Use the table below as your guide: -The Smooch API offers multiple [versions](https://docs.smooch.io/guide/versioning/). Each release of this project targets one and only one Smooch API version. If you depend on an older version of the Smooch API, you may need to use an older release of this library. Use the table below as your guide: - -| Smooch API version | `smooch-java` version to use | +| Sunshine Conversations API version | `zendesk/sunshine-conversations-java` version to use | |--------------------|------------------------------| -| `v1.1` [Upgrade guide](https://docs.smooch.io/guide/versioning/#upgrading-to-v11-from-v1) | `4.0.0` or newer | +| `v2` [Implementation guide](https://docs.smooch.io/guide/multi-party-conversations/#implementation-guide/) | `6.*` or newer | +| `v1.1` [Upgrade guide](https://docs.smooch.io/guide/versioning/#upgrading-to-v11-from-v1) | `4.*` or `5.*` | | `v1` | `3.*` or older | ## Installation @@ -25,7 +24,7 @@ Add the following remote repo to your project's POM: - smooch.io + zendesk-sunshine-conversations https://smoochorg.bintray.com/maven/ @@ -36,9 +35,9 @@ Add this dependency to your project's POM: ```xml - io.smooch - api - 5.29.0 + com.zendesk + sunshine-conversations-client + 9.0.0 compile ``` @@ -48,12 +47,12 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "io.smooch:api:5.29.0" +compile "com.zendesk:sunshine-conversations-client:9.0.0" ``` ## Getting Started -Familiarity with [Smooch API authentication](https://docs.smooch.io/guide/authentication-overview) is recommended. +Familiarity with [Sunshine Conversations API authentication](https://docs.smooch.io/guide/authentication-overview) is recommended. ### Basic Authentication (recommended) @@ -91,16 +90,16 @@ String jwt = Jwts.builder() ```java -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppApi; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.api.ActivitiesApi; import java.io.File; import java.util.*; -public class AppApiExample { +public class ActivitiesApiExample { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); @@ -110,21 +109,20 @@ public class AppApiExample { basicAuth.setUsername("API_KEY_ID"); basicAuth.setPassword("API_KEY_SECRET"); + // Configure HTTP basic authorization (recommended): bearerAuth + HttpBasicAuth bearerAuth = (HttpBasicAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setUsername("API_KEY_ID"); + bearerAuth.setPassword("API_KEY_SECRET"); - // OR - - // Configure JWT authorization (alternative method): jwt - ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); - jwt.setApiKey("YOUR JWT"); - jwt.setApiKeyPrefix("Bearer"); - - AppApi apiInstance = new AppApi(); - AppCreate appCreateBody = new AppCreate(); // AppCreate | Body for a createApp request. + ActivitiesApi apiInstance = new ActivitiesApi(); + ActivityPost activityPost = {"author":{"type":"user","userId":"5963c0d619a30a2e00de36b8"},"type":"conversation:read"}; // ActivityPost | + String appId = 5d8cff3cd55b040010928b5b; // String | Identifies the app. + String conversationId = 029c31f25a21b47effd7be90; // String | Identifies the conversation. try { - AppResponse result = apiInstance.createApp(appCreateBody); + Object result = apiInstance.postActivity(activityPost, appId, conversationId); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling AppApi#createApp"); + System.err.println("Exception when calling ActivitiesApi#postActivity"); e.printStackTrace(); } } @@ -146,177 +144,311 @@ All URIs are relative to *https://api.smooch.io* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AppApi* | [**createApp**](docs/AppApi.md#createApp) | **POST** /v1.1/apps | -*AppApi* | [**createSecretKey**](docs/AppApi.md#createSecretKey) | **POST** /v1.1/apps/{appId}/keys | -*AppApi* | [**deleteApp**](docs/AppApi.md#deleteApp) | **DELETE** /v1.1/apps/{appId} | -*AppApi* | [**deleteSecretKey**](docs/AppApi.md#deleteSecretKey) | **DELETE** /v1.1/apps/{appId}/keys/{keyId} | -*AppApi* | [**getApp**](docs/AppApi.md#getApp) | **GET** /v1.1/apps/{appId} | -*AppApi* | [**getAppJwt**](docs/AppApi.md#getAppJwt) | **GET** /v1.1/apps/{appId}/keys/{keyId}/jwt | -*AppApi* | [**getSdkIds**](docs/AppApi.md#getSdkIds) | **GET** /v1.1/apps/{appId}/sdks | -*AppApi* | [**getSecretKey**](docs/AppApi.md#getSecretKey) | **GET** /v1.1/apps/{appId}/keys/{keyId} | -*AppApi* | [**listApps**](docs/AppApi.md#listApps) | **GET** /v1.1/apps | -*AppApi* | [**listSecretKeys**](docs/AppApi.md#listSecretKeys) | **GET** /v1.1/apps/{appId}/keys | -*AppApi* | [**updateApp**](docs/AppApi.md#updateApp) | **PUT** /v1.1/apps/{appId} | -*AppUserApi* | [**deleteAppUser**](docs/AppUserApi.md#deleteAppUser) | **DELETE** /v1.1/apps/{appId}/appusers/{userId} | -*AppUserApi* | [**deleteAppUserProfile**](docs/AppUserApi.md#deleteAppUserProfile) | **DELETE** /v1.1/apps/{appId}/appusers/{userId}/profile | -*AppUserApi* | [**getAppUser**](docs/AppUserApi.md#getAppUser) | **GET** /v1.1/apps/{appId}/appusers/{userId} | -*AppUserApi* | [**getAppUserAuthCode**](docs/AppUserApi.md#getAppUserAuthCode) | **GET** /v1.1/apps/{appId}/appusers/{userId}/authcode | -*AppUserApi* | [**getAppUserBusinessSystemIds**](docs/AppUserApi.md#getAppUserBusinessSystemIds) | **GET** /v1.1/apps/{appId}/appusers/{userId}/businesssystems | -*AppUserApi* | [**getAppUserEntityIds**](docs/AppUserApi.md#getAppUserEntityIds) | **GET** /v1.1/apps/{appId}/appusers/{userId}/channels | -*AppUserApi* | [**getLinkRequests**](docs/AppUserApi.md#getLinkRequests) | **GET** /v1.1/apps/{appId}/appusers/{userId}/linkrequest | -*AppUserApi* | [**linkAppUser**](docs/AppUserApi.md#linkAppUser) | **POST** /v1.1/apps/{appId}/appusers/{userId}/channels | -*AppUserApi* | [**mergeUsers**](docs/AppUserApi.md#mergeUsers) | **POST** /v1.1/apps/{appId}/appusers/merge | -*AppUserApi* | [**postImageMessage**](docs/AppUserApi.md#postImageMessage) | **POST** /v1.1/apps/{appId}/appusers/{userId}/images | -*AppUserApi* | [**preCreateAppUser**](docs/AppUserApi.md#preCreateAppUser) | **POST** /v1.1/apps/{appId}/appusers | -*AppUserApi* | [**unlinkAppUser**](docs/AppUserApi.md#unlinkAppUser) | **DELETE** /v1.1/apps/{appId}/appusers/{userId}/channels/{channel} | -*AppUserApi* | [**updateAppUser**](docs/AppUserApi.md#updateAppUser) | **PUT** /v1.1/apps/{appId}/appusers/{userId} | -*AttachmentsApi* | [**removeAttachment**](docs/AttachmentsApi.md#removeAttachment) | **POST** /v1.1/apps/{appId}/attachments/remove | -*AttachmentsApi* | [**uploadAttachment**](docs/AttachmentsApi.md#uploadAttachment) | **POST** /v1.1/apps/{appId}/attachments | -*ConversationApi* | [**conversationActivity**](docs/ConversationApi.md#conversationActivity) | **POST** /v1.1/apps/{appId}/appusers/{userId}/conversation/activity | -*ConversationApi* | [**deleteMessage**](docs/ConversationApi.md#deleteMessage) | **DELETE** /v1.1/apps/{appId}/appusers/{userId}/messages/{messageId} | -*ConversationApi* | [**deleteMessages**](docs/ConversationApi.md#deleteMessages) | **DELETE** /v1.1/apps/{appId}/appusers/{userId}/messages | -*ConversationApi* | [**getMessages**](docs/ConversationApi.md#getMessages) | **GET** /v1.1/apps/{appId}/appusers/{userId}/messages | -*ConversationApi* | [**postMessage**](docs/ConversationApi.md#postMessage) | **POST** /v1.1/apps/{appId}/appusers/{userId}/messages | -*ConversationApi* | [**resetUnreadCount**](docs/ConversationApi.md#resetUnreadCount) | **POST** /v1.1/apps/{appId}/appusers/{userId}/conversation/read | -*DeploymentApi* | [**activatePhoneNumber**](docs/DeploymentApi.md#activatePhoneNumber) | **POST** /v1.1/whatsapp/deployments/{deploymentId}/activate | -*DeploymentApi* | [**confirmCode**](docs/DeploymentApi.md#confirmCode) | **POST** /v1.1/whatsapp/deployments/{deploymentId}/code/confirm | -*DeploymentApi* | [**createDeployment**](docs/DeploymentApi.md#createDeployment) | **POST** /v1.1/whatsapp/deployments | -*DeploymentApi* | [**deleteDeployment**](docs/DeploymentApi.md#deleteDeployment) | **DELETE** /v1.1/whatsapp/deployments/{deploymentId} | -*DeploymentApi* | [**getDeployment**](docs/DeploymentApi.md#getDeployment) | **GET** /v1.1/whatsapp/deployments/{deploymentId} | -*DeploymentApi* | [**listDeployments**](docs/DeploymentApi.md#listDeployments) | **GET** /v1.1/whatsapp/deployments | -*IntegrationApi* | [**createIntegration**](docs/IntegrationApi.md#createIntegration) | **POST** /v1.1/apps/{appId}/integrations | -*IntegrationApi* | [**createIntegrationMenu**](docs/IntegrationApi.md#createIntegrationMenu) | **POST** /v1.1/apps/{appId}/integrations/{integrationId}/menu | -*IntegrationApi* | [**deleteIntegration**](docs/IntegrationApi.md#deleteIntegration) | **DELETE** /v1.1/apps/{appId}/integrations/{integrationId} | -*IntegrationApi* | [**deleteIntegrationMenu**](docs/IntegrationApi.md#deleteIntegrationMenu) | **DELETE** /v1.1/apps/{appId}/integrations/{integrationId}/menu | -*IntegrationApi* | [**getIntegration**](docs/IntegrationApi.md#getIntegration) | **GET** /v1.1/apps/{appId}/integrations/{integrationId} | -*IntegrationApi* | [**getIntegrationMenu**](docs/IntegrationApi.md#getIntegrationMenu) | **GET** /v1.1/apps/{appId}/integrations/{integrationId}/menu | -*IntegrationApi* | [**getIntegrationProfile**](docs/IntegrationApi.md#getIntegrationProfile) | **GET** /v1.1/apps/{appId}/integrations/{integrationId}/profile | -*IntegrationApi* | [**listIntegrations**](docs/IntegrationApi.md#listIntegrations) | **GET** /v1.1/apps/{appId}/integrations | -*IntegrationApi* | [**updateIntegration**](docs/IntegrationApi.md#updateIntegration) | **PUT** /v1.1/apps/{appId}/integrations/{integrationId} | -*IntegrationApi* | [**updateIntegrationMenu**](docs/IntegrationApi.md#updateIntegrationMenu) | **PUT** /v1.1/apps/{appId}/integrations/{integrationId}/menu | -*IntegrationApi* | [**updateIntegrationProfile**](docs/IntegrationApi.md#updateIntegrationProfile) | **PUT** /v1.1/apps/{appId}/integrations/{integrationId}/profile | -*IntegrationApi* | [**uploadIntegrationProfilePhoto**](docs/IntegrationApi.md#uploadIntegrationProfilePhoto) | **PUT** /v1.1/apps/{appId}/integrations/{integrationId}/profile/photo | -*MenuApi* | [**deleteMenu**](docs/MenuApi.md#deleteMenu) | **DELETE** /v1.1/apps/{appId}/menu | -*MenuApi* | [**getMenu**](docs/MenuApi.md#getMenu) | **GET** /v1.1/apps/{appId}/menu | -*MenuApi* | [**updateMenu**](docs/MenuApi.md#updateMenu) | **PUT** /v1.1/apps/{appId}/menu | -*NotificationApi* | [**postNotification**](docs/NotificationApi.md#postNotification) | **POST** /v1/apps/{appId}/notifications | -*ServiceAccountApi* | [**createSecretKey**](docs/ServiceAccountApi.md#createSecretKey) | **POST** /v1.1/serviceaccounts/{serviceAccountId}/keys | -*ServiceAccountApi* | [**createServiceAccount**](docs/ServiceAccountApi.md#createServiceAccount) | **POST** /v1.1/serviceaccounts | -*ServiceAccountApi* | [**deleteSecretKey**](docs/ServiceAccountApi.md#deleteSecretKey) | **DELETE** /v1.1/serviceaccounts/{serviceAccountId}/keys/{keyId} | -*ServiceAccountApi* | [**deleteServiceAccount**](docs/ServiceAccountApi.md#deleteServiceAccount) | **DELETE** /v1.1/serviceaccounts/{serviceAccountId} | -*ServiceAccountApi* | [**getJwt**](docs/ServiceAccountApi.md#getJwt) | **GET** /v1.1/serviceaccounts/{serviceAccountId}/keys/{keyId}/jwt | -*ServiceAccountApi* | [**getSecretKey**](docs/ServiceAccountApi.md#getSecretKey) | **GET** /v1.1/serviceaccounts/{serviceAccountId}/keys/{keyId} | -*ServiceAccountApi* | [**getServiceAccount**](docs/ServiceAccountApi.md#getServiceAccount) | **GET** /v1.1/serviceaccounts/{serviceAccountId} | -*ServiceAccountApi* | [**listSecretKeys**](docs/ServiceAccountApi.md#listSecretKeys) | **GET** /v1.1/serviceaccounts/{serviceAccountId}/keys | -*ServiceAccountApi* | [**listServiceAccounts**](docs/ServiceAccountApi.md#listServiceAccounts) | **GET** /v1.1/serviceaccounts | -*ServiceAccountApi* | [**updateServiceAccount**](docs/ServiceAccountApi.md#updateServiceAccount) | **PUT** /v1.1/serviceaccounts/{serviceAccountId} | -*TemplateApi* | [**createTemplate**](docs/TemplateApi.md#createTemplate) | **POST** /v1.1/apps/{appId}/templates | -*TemplateApi* | [**deleteTemplate**](docs/TemplateApi.md#deleteTemplate) | **DELETE** /v1.1/apps/{appId}/templates/{templateId} | -*TemplateApi* | [**getTemplate**](docs/TemplateApi.md#getTemplate) | **GET** /v1.1/apps/{appId}/templates/{templateId} | -*TemplateApi* | [**listTemplates**](docs/TemplateApi.md#listTemplates) | **GET** /v1.1/apps/{appId}/templates | -*TemplateApi* | [**updateTemplate**](docs/TemplateApi.md#updateTemplate) | **PUT** /v1.1/apps/{appId}/templates/{templateId} | -*WebhookApi* | [**createWebhook**](docs/WebhookApi.md#createWebhook) | **POST** /v1.1/apps/{appId}/webhooks | -*WebhookApi* | [**deleteWebhook**](docs/WebhookApi.md#deleteWebhook) | **DELETE** /v1.1/apps/{appId}/webhooks/{webhookId} | -*WebhookApi* | [**getWebhook**](docs/WebhookApi.md#getWebhook) | **GET** /v1.1/apps/{appId}/webhooks/{webhookId} | -*WebhookApi* | [**listWebhooks**](docs/WebhookApi.md#listWebhooks) | **GET** /v1.1/apps/{appId}/webhooks | -*WebhookApi* | [**updateWebhook**](docs/WebhookApi.md#updateWebhook) | **PUT** /v1.1/apps/{appId}/webhooks/{webhookId} | +*ActivitiesApi* | [**postActivity**](docs/ActivitiesApi.md#postActivity) | **POST** /v2/apps/{appId}/conversations/{conversationId}/activity | Post Activity +*AppKeysApi* | [**createAppKey**](docs/AppKeysApi.md#createAppKey) | **POST** /v2/apps/{appId}/keys | Create App Key +*AppKeysApi* | [**deleteAppKey**](docs/AppKeysApi.md#deleteAppKey) | **DELETE** /v2/apps/{appId}/keys/{keyId} | Delete App Key +*AppKeysApi* | [**getAppKey**](docs/AppKeysApi.md#getAppKey) | **GET** /v2/apps/{appId}/keys/{keyId} | Get App Key +*AppKeysApi* | [**listAppKeys**](docs/AppKeysApi.md#listAppKeys) | **GET** /v2/apps/{appId}/keys | List App Keys +*AppsApi* | [**createApp**](docs/AppsApi.md#createApp) | **POST** /v2/apps | Create App +*AppsApi* | [**deleteApp**](docs/AppsApi.md#deleteApp) | **DELETE** /v2/apps/{appId} | Delete App +*AppsApi* | [**getApp**](docs/AppsApi.md#getApp) | **GET** /v2/apps/{appId} | Get App +*AppsApi* | [**listApps**](docs/AppsApi.md#listApps) | **GET** /v2/apps | List Apps +*AppsApi* | [**updateApp**](docs/AppsApi.md#updateApp) | **PATCH** /v2/apps/{appId} | Update App +*AttachmentsApi* | [**deleteAttachment**](docs/AttachmentsApi.md#deleteAttachment) | **POST** /v2/apps/{appId}/attachments/remove | Delete Attachment +*AttachmentsApi* | [**generateMediaJsonWebToken**](docs/AttachmentsApi.md#generateMediaJsonWebToken) | **POST** /v2/apps/{appId}/attachments/token | Generate Media Token +*AttachmentsApi* | [**setCookie**](docs/AttachmentsApi.md#setCookie) | **POST** /v2/apps/{appId}/attachments/cookie | Set Cookie +*AttachmentsApi* | [**uploadAttachment**](docs/AttachmentsApi.md#uploadAttachment) | **POST** /v2/apps/{appId}/attachments | Upload Attachment +*ClientsApi* | [**createClient**](docs/ClientsApi.md#createClient) | **POST** /v2/apps/{appId}/users/{userIdOrExternalId}/clients | Create Client +*ClientsApi* | [**listClients**](docs/ClientsApi.md#listClients) | **GET** /v2/apps/{appId}/users/{userIdOrExternalId}/clients | List Clients +*ClientsApi* | [**removeClient**](docs/ClientsApi.md#removeClient) | **DELETE** /v2/apps/{appId}/users/{userIdOrExternalId}/clients/{clientId} | Remove Client +*ConversationsApi* | [**createConversation**](docs/ConversationsApi.md#createConversation) | **POST** /v2/apps/{appId}/conversations | Create Conversation +*ConversationsApi* | [**deleteConversation**](docs/ConversationsApi.md#deleteConversation) | **DELETE** /v2/apps/{appId}/conversations/{conversationId} | Delete Conversation +*ConversationsApi* | [**getConversation**](docs/ConversationsApi.md#getConversation) | **GET** /v2/apps/{appId}/conversations/{conversationId} | Get Conversation +*ConversationsApi* | [**listConversations**](docs/ConversationsApi.md#listConversations) | **GET** /v2/apps/{appId}/conversations | List Conversations +*ConversationsApi* | [**updateConversation**](docs/ConversationsApi.md#updateConversation) | **PATCH** /v2/apps/{appId}/conversations/{conversationId} | Update Conversation +*CustomIntegrationApiKeysApi* | [**createCustomIntegrationKey**](docs/CustomIntegrationApiKeysApi.md#createCustomIntegrationKey) | **POST** /v2/apps/{appId}/integrations/{integrationId}/keys | Create Integration Key +*CustomIntegrationApiKeysApi* | [**deleteCustomIntegrationKey**](docs/CustomIntegrationApiKeysApi.md#deleteCustomIntegrationKey) | **DELETE** /v2/apps/{appId}/integrations/{integrationId}/keys/{keyId} | Delete Integration Key +*CustomIntegrationApiKeysApi* | [**getCustomIntegrationKey**](docs/CustomIntegrationApiKeysApi.md#getCustomIntegrationKey) | **GET** /v2/apps/{appId}/integrations/{integrationId}/keys/{keyId} | Get Integration Key +*CustomIntegrationApiKeysApi* | [**listCustomIntegrationKeys**](docs/CustomIntegrationApiKeysApi.md#listCustomIntegrationKeys) | **GET** /v2/apps/{appId}/integrations/{integrationId}/keys | List Integration Keys +*IntegrationsApi* | [**createIntegration**](docs/IntegrationsApi.md#createIntegration) | **POST** /v2/apps/{appId}/integrations | Create Integration +*IntegrationsApi* | [**deleteIntegration**](docs/IntegrationsApi.md#deleteIntegration) | **DELETE** /v2/apps/{appId}/integrations/{integrationId} | Delete Integration +*IntegrationsApi* | [**getIntegration**](docs/IntegrationsApi.md#getIntegration) | **GET** /v2/apps/{appId}/integrations/{integrationId} | Get Integration +*IntegrationsApi* | [**listIntegrations**](docs/IntegrationsApi.md#listIntegrations) | **GET** /v2/apps/{appId}/integrations | List Integrations +*IntegrationsApi* | [**updateIntegration**](docs/IntegrationsApi.md#updateIntegration) | **PATCH** /v2/apps/{appId}/integrations/{integrationId} | Update Integration +*MessagesApi* | [**deleteAllMessages**](docs/MessagesApi.md#deleteAllMessages) | **DELETE** /v2/apps/{appId}/conversations/{conversationId}/messages | Delete All Messages +*MessagesApi* | [**deleteMessage**](docs/MessagesApi.md#deleteMessage) | **DELETE** /v2/apps/{appId}/conversations/{conversationId}/messages/{messageId} | Delete Message +*MessagesApi* | [**listMessages**](docs/MessagesApi.md#listMessages) | **GET** /v2/apps/{appId}/conversations/{conversationId}/messages | List Messages +*MessagesApi* | [**postMessage**](docs/MessagesApi.md#postMessage) | **POST** /v2/apps/{appId}/conversations/{conversationId}/messages | Post Message +*ParticipantsApi* | [**joinConversation**](docs/ParticipantsApi.md#joinConversation) | **POST** /v2/apps/{appId}/conversations/{conversationId}/join | Join Conversation +*ParticipantsApi* | [**leaveConversation**](docs/ParticipantsApi.md#leaveConversation) | **POST** /v2/apps/{appId}/conversations/{conversationId}/leave | Leave Conversation +*ParticipantsApi* | [**listParticipants**](docs/ParticipantsApi.md#listParticipants) | **GET** /v2/apps/{appId}/conversations/{conversationId}/participants | List Participants +*SwitchboardActionsApi* | [**acceptControl**](docs/SwitchboardActionsApi.md#acceptControl) | **POST** /v2/apps/{appId}/conversations/{conversationId}/acceptControl | Accept Control +*SwitchboardActionsApi* | [**offerControl**](docs/SwitchboardActionsApi.md#offerControl) | **POST** /v2/apps/{appId}/conversations/{conversationId}/offerControl | Offer Control +*SwitchboardActionsApi* | [**passControl**](docs/SwitchboardActionsApi.md#passControl) | **POST** /v2/apps/{appId}/conversations/{conversationId}/passControl | Pass Control +*SwitchboardIntegrationsApi* | [**createSwitchboardIntegration**](docs/SwitchboardIntegrationsApi.md#createSwitchboardIntegration) | **POST** /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations | Create Switchboard Integration +*SwitchboardIntegrationsApi* | [**deleteSwitchboardIntegration**](docs/SwitchboardIntegrationsApi.md#deleteSwitchboardIntegration) | **DELETE** /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations/{switchboardIntegrationId} | Delete Switchboard Integration +*SwitchboardIntegrationsApi* | [**listSwitchboardIntegrations**](docs/SwitchboardIntegrationsApi.md#listSwitchboardIntegrations) | **GET** /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations | List Switchboard Integrations +*SwitchboardIntegrationsApi* | [**updateSwitchboardIntegration**](docs/SwitchboardIntegrationsApi.md#updateSwitchboardIntegration) | **PATCH** /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations/{switchboardIntegrationId} | Update Switchboard Integration +*SwitchboardsApi* | [**createSwitchboard**](docs/SwitchboardsApi.md#createSwitchboard) | **POST** /v2/apps/{appId}/switchboards | Create Switchboard +*SwitchboardsApi* | [**deleteSwitchboard**](docs/SwitchboardsApi.md#deleteSwitchboard) | **DELETE** /v2/apps/{appId}/switchboards/{switchboardId} | Delete Switchboard +*SwitchboardsApi* | [**listSwitchboards**](docs/SwitchboardsApi.md#listSwitchboards) | **GET** /v2/apps/{appId}/switchboards | List Switchboards +*SwitchboardsApi* | [**updateSwitchboard**](docs/SwitchboardsApi.md#updateSwitchboard) | **PATCH** /v2/apps/{appId}/switchboards/{switchboardId} | Update Switchboard +*UsersApi* | [**createUser**](docs/UsersApi.md#createUser) | **POST** /v2/apps/{appId}/users | Create User +*UsersApi* | [**deleteUser**](docs/UsersApi.md#deleteUser) | **DELETE** /v2/apps/{appId}/users/{userIdOrExternalId} | Delete User +*UsersApi* | [**deleteUserPersonalInformation**](docs/UsersApi.md#deleteUserPersonalInformation) | **DELETE** /v2/apps/{appId}/users/{userIdOrExternalId}/personalinformation | Delete User Personal Information +*UsersApi* | [**getUser**](docs/UsersApi.md#getUser) | **GET** /v2/apps/{appId}/users/{userIdOrExternalId} | Get User +*UsersApi* | [**updateUser**](docs/UsersApi.md#updateUser) | **PATCH** /v2/apps/{appId}/users/{userIdOrExternalId} | Update User +*WebhooksApi* | [**createWebhook**](docs/WebhooksApi.md#createWebhook) | **POST** /v2/apps/{appId}/integrations/{integrationId}/webhooks | Create Webhook +*WebhooksApi* | [**deleteWebhook**](docs/WebhooksApi.md#deleteWebhook) | **DELETE** /v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId} | Delete Webhook +*WebhooksApi* | [**getWebhook**](docs/WebhooksApi.md#getWebhook) | **GET** /v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId} | Get Webhook +*WebhooksApi* | [**listWebhooks**](docs/WebhooksApi.md#listWebhooks) | **GET** /v2/apps/{appId}/integrations/{integrationId}/webhooks | List Webhooks +*WebhooksApi* | [**updateWebhook**](docs/WebhooksApi.md#updateWebhook) | **PATCH** /v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId} | Update Webhook ## Documentation for Models + - [AcceptControlBody](docs/AcceptControlBody.md) - [Action](docs/Action.md) - - [ActivityResponse](docs/ActivityResponse.md) + - [ActionSubset](docs/ActionSubset.md) + - [Activity](docs/Activity.md) + - [ActivityAllOf](docs/ActivityAllOf.md) + - [ActivityPost](docs/ActivityPost.md) + - [ActivityPostAllOf](docs/ActivityPostAllOf.md) + - [ActivityTypes](docs/ActivityTypes.md) + - [Android](docs/Android.md) + - [AndroidAllOf](docs/AndroidAllOf.md) + - [AndroidUpdate](docs/AndroidUpdate.md) + - [AndroidUpdateAllOf](docs/AndroidUpdateAllOf.md) + - [ApiKey](docs/ApiKey.md) - [App](docs/App.md) - - [AppCreate](docs/AppCreate.md) + - [AppCreateBody](docs/AppCreateBody.md) + - [AppKey](docs/AppKey.md) + - [AppKeyCreateBody](docs/AppKeyCreateBody.md) + - [AppKeyListResponse](docs/AppKeyListResponse.md) + - [AppKeyResponse](docs/AppKeyResponse.md) + - [AppListFilter](docs/AppListFilter.md) + - [AppListResponse](docs/AppListResponse.md) - [AppResponse](docs/AppResponse.md) - [AppSettings](docs/AppSettings.md) - - [AppUpdate](docs/AppUpdate.md) - - [AppUser](docs/AppUser.md) - - [AppUserBusinessSystemsResponse](docs/AppUserBusinessSystemsResponse.md) - - [AppUserChannelsResponse](docs/AppUserChannelsResponse.md) - - [AppUserLink](docs/AppUserLink.md) - - [AppUserMerge](docs/AppUserMerge.md) - - [AppUserPreCreate](docs/AppUserPreCreate.md) - - [AppUserResponse](docs/AppUserResponse.md) - - [AppUserUpdate](docs/AppUserUpdate.md) - - [AttachmentRemove](docs/AttachmentRemove.md) + - [AppSubSchema](docs/AppSubSchema.md) + - [AppUpdateBody](docs/AppUpdateBody.md) + - [Apple](docs/Apple.md) + - [AppleAllOf](docs/AppleAllOf.md) + - [AppleUpdate](docs/AppleUpdate.md) + - [AttachmentDeleteBody](docs/AttachmentDeleteBody.md) + - [AttachmentMediaTokenBody](docs/AttachmentMediaTokenBody.md) + - [AttachmentMediaTokenResponse](docs/AttachmentMediaTokenResponse.md) - [AttachmentResponse](docs/AttachmentResponse.md) - - [AuthCodeResponse](docs/AuthCodeResponse.md) + - [AttachmentSchema](docs/AttachmentSchema.md) + - [AttachmentUploadBody](docs/AttachmentUploadBody.md) - [Author](docs/Author.md) - - [BusinessSystemItem](docs/BusinessSystemItem.md) - - [ChannelEntityItem](docs/ChannelEntityItem.md) + - [AuthorWebhook](docs/AuthorWebhook.md) + - [Buy](docs/Buy.md) + - [CarouselMessage](docs/CarouselMessage.md) + - [CarouselMessageDisplaySettings](docs/CarouselMessageDisplaySettings.md) - [Client](docs/Client.md) - - [ClientInfo](docs/ClientInfo.md) + - [ClientAssociation](docs/ClientAssociation.md) + - [ClientCreate](docs/ClientCreate.md) + - [ClientListResponse](docs/ClientListResponse.md) + - [ClientResponse](docs/ClientResponse.md) + - [ClientType](docs/ClientType.md) - [Confirmation](docs/Confirmation.md) + - [Content](docs/Content.md) - [Conversation](docs/Conversation.md) - - [ConversationActivity](docs/ConversationActivity.md) - - [Coordinates](docs/Coordinates.md) - - [Deployment](docs/Deployment.md) - - [DeploymentActivatePhoneNumber](docs/DeploymentActivatePhoneNumber.md) - - [DeploymentConfirmCode](docs/DeploymentConfirmCode.md) - - [DeploymentCreate](docs/DeploymentCreate.md) - - [DeploymentResponse](docs/DeploymentResponse.md) + - [ConversationAllOf](docs/ConversationAllOf.md) + - [ConversationCreateBody](docs/ConversationCreateBody.md) + - [ConversationCreateEvent](docs/ConversationCreateEvent.md) + - [ConversationCreateEventAllOf](docs/ConversationCreateEventAllOf.md) + - [ConversationCreateEventAllOfPayload](docs/ConversationCreateEventAllOfPayload.md) + - [ConversationListFilter](docs/ConversationListFilter.md) + - [ConversationListResponse](docs/ConversationListResponse.md) + - [ConversationMessageDeliveryChannelEvent](docs/ConversationMessageDeliveryChannelEvent.md) + - [ConversationMessageDeliveryChannelEventAllOf](docs/ConversationMessageDeliveryChannelEventAllOf.md) + - [ConversationMessageDeliveryFailureEvent](docs/ConversationMessageDeliveryFailureEvent.md) + - [ConversationMessageDeliveryFailureEventAllOf](docs/ConversationMessageDeliveryFailureEventAllOf.md) + - [ConversationMessageDeliveryPayload](docs/ConversationMessageDeliveryPayload.md) + - [ConversationMessageDeliveryPayloadDestination](docs/ConversationMessageDeliveryPayloadDestination.md) + - [ConversationMessageDeliveryPayloadExternalMessages](docs/ConversationMessageDeliveryPayloadExternalMessages.md) + - [ConversationMessageDeliveryPayloadMessage](docs/ConversationMessageDeliveryPayloadMessage.md) + - [ConversationMessageDeliveryUserEvent](docs/ConversationMessageDeliveryUserEvent.md) + - [ConversationMessageEvent](docs/ConversationMessageEvent.md) + - [ConversationMessageEventAllOf](docs/ConversationMessageEventAllOf.md) + - [ConversationMessageEventAllOfPayload](docs/ConversationMessageEventAllOfPayload.md) + - [ConversationPostbackEvent](docs/ConversationPostbackEvent.md) + - [ConversationPostbackEventAllOf](docs/ConversationPostbackEventAllOf.md) + - [ConversationPostbackEventAllOfPayload](docs/ConversationPostbackEventAllOfPayload.md) + - [ConversationReadEvent](docs/ConversationReadEvent.md) + - [ConversationReadEventAllOf](docs/ConversationReadEventAllOf.md) + - [ConversationReadEventAllOfPayload](docs/ConversationReadEventAllOfPayload.md) + - [ConversationResponse](docs/ConversationResponse.md) + - [ConversationTruncated](docs/ConversationTruncated.md) + - [ConversationType](docs/ConversationType.md) + - [ConversationTypingEvent](docs/ConversationTypingEvent.md) + - [ConversationTypingEventAllOf](docs/ConversationTypingEventAllOf.md) + - [ConversationTypingEventAllOfPayload](docs/ConversationTypingEventAllOfPayload.md) + - [ConversationUpdateBody](docs/ConversationUpdateBody.md) + - [Custom](docs/Custom.md) + - [CustomAllOf](docs/CustomAllOf.md) + - [CustomUpdate](docs/CustomUpdate.md) - [Destination](docs/Destination.md) - - [DisplaySettings](docs/DisplaySettings.md) - - [Enums](docs/Enums.md) + - [Device](docs/Device.md) + - [EventSubSchema](docs/EventSubSchema.md) + - [ExtraChannelOptions](docs/ExtraChannelOptions.md) + - [ExtraChannelOptionsMessenger](docs/ExtraChannelOptionsMessenger.md) - [Field](docs/Field.md) - - [FieldPost](docs/FieldPost.md) - - [GetIntegrationProfileResponse](docs/GetIntegrationProfileResponse.md) - - [GetMessagesResponse](docs/GetMessagesResponse.md) - - [GetSdkIdsResponse](docs/GetSdkIdsResponse.md) + - [FileMessage](docs/FileMessage.md) + - [FormMessage](docs/FormMessage.md) + - [FormResponseMessage](docs/FormResponseMessage.md) + - [ImageMessage](docs/ImageMessage.md) - [Integration](docs/Integration.md) - - [IntegrationCreate](docs/IntegrationCreate.md) - - [IntegrationProfileUpdate](docs/IntegrationProfileUpdate.md) + - [IntegrationApiKey](docs/IntegrationApiKey.md) + - [IntegrationApiKeyListResponse](docs/IntegrationApiKeyListResponse.md) + - [IntegrationApiKeyResponse](docs/IntegrationApiKeyResponse.md) + - [IntegrationId](docs/IntegrationId.md) + - [IntegrationListFilter](docs/IntegrationListFilter.md) + - [IntegrationListResponse](docs/IntegrationListResponse.md) - [IntegrationResponse](docs/IntegrationResponse.md) + - [IntegrationType](docs/IntegrationType.md) - [IntegrationUpdate](docs/IntegrationUpdate.md) - - [JwtResponse](docs/JwtResponse.md) - - [LinkRequestResponse](docs/LinkRequestResponse.md) - - [LinkRequestResponseLinkRequests](docs/LinkRequestResponseLinkRequests.md) - - [ListAppsResponse](docs/ListAppsResponse.md) - - [ListDeploymentsResponse](docs/ListDeploymentsResponse.md) - - [ListIntegrationsResponse](docs/ListIntegrationsResponse.md) - - [ListSecretKeysResponse](docs/ListSecretKeysResponse.md) - - [ListServiceAccountsResponse](docs/ListServiceAccountsResponse.md) - - [ListTemplatesResponse](docs/ListTemplatesResponse.md) - - [ListWebhooksResponse](docs/ListWebhooksResponse.md) - - [Location](docs/Location.md) - - [Menu](docs/Menu.md) - - [MenuItem](docs/MenuItem.md) - - [MenuResponse](docs/MenuResponse.md) - - [MergedUser](docs/MergedUser.md) + - [IntegrationUpdateBase](docs/IntegrationUpdateBase.md) + - [Ios](docs/Ios.md) + - [IosAllOf](docs/IosAllOf.md) + - [IosUpdate](docs/IosUpdate.md) + - [IosUpdateAllOf](docs/IosUpdateAllOf.md) + - [Item](docs/Item.md) + - [Line](docs/Line.md) + - [LineAllOf](docs/LineAllOf.md) + - [LineUpdate](docs/LineUpdate.md) + - [Link](docs/Link.md) + - [Links](docs/Links.md) + - [ListMessage](docs/ListMessage.md) + - [LocationMessage](docs/LocationMessage.md) + - [LocationMessageCoordinates](docs/LocationMessageCoordinates.md) + - [LocationMessageLocation](docs/LocationMessageLocation.md) + - [LocationRequest](docs/LocationRequest.md) + - [Mailgun](docs/Mailgun.md) + - [MailgunAllOf](docs/MailgunAllOf.md) + - [MailgunUpdate](docs/MailgunUpdate.md) + - [MailgunUpdateAllOf](docs/MailgunUpdateAllOf.md) + - [MatchCriteria](docs/MatchCriteria.md) + - [MatchCriteriaBase](docs/MatchCriteriaBase.md) + - [MatchCriteriaMailgun](docs/MatchCriteriaMailgun.md) + - [MatchCriteriaMailgunAllOf](docs/MatchCriteriaMailgunAllOf.md) + - [MatchCriteriaMessagebird](docs/MatchCriteriaMessagebird.md) + - [MatchCriteriaMessagebirdAllOf](docs/MatchCriteriaMessagebirdAllOf.md) + - [MatchCriteriaTwilio](docs/MatchCriteriaTwilio.md) + - [MatchCriteriaTwilioAllOf](docs/MatchCriteriaTwilioAllOf.md) + - [MatchCriteriaWhatsapp](docs/MatchCriteriaWhatsapp.md) + - [MatchCriteriaWhatsappAllOf](docs/MatchCriteriaWhatsappAllOf.md) - [Message](docs/Message.md) - - [MessageItem](docs/MessageItem.md) + - [MessageBird](docs/MessageBird.md) + - [MessageBirdAllOf](docs/MessageBirdAllOf.md) + - [MessageBirdUpdate](docs/MessageBirdUpdate.md) + - [MessageListResponse](docs/MessageListResponse.md) - [MessageOverride](docs/MessageOverride.md) + - [MessageOverrideApple](docs/MessageOverrideApple.md) - [MessageOverrideLine](docs/MessageOverrideLine.md) - [MessageOverrideMessenger](docs/MessageOverrideMessenger.md) + - [MessageOverridePayload](docs/MessageOverridePayload.md) - [MessageOverrideWhatsapp](docs/MessageOverrideWhatsapp.md) - [MessagePost](docs/MessagePost.md) - - [MessageResponse](docs/MessageResponse.md) - - [NotificationPost](docs/NotificationPost.md) - - [NotificationPostDestination](docs/NotificationPostDestination.md) - - [NotificationResponse](docs/NotificationResponse.md) - - [NotificationResponseNotification](docs/NotificationResponseNotification.md) - - [Option](docs/Option.md) + - [MessagePostResponse](docs/MessagePostResponse.md) + - [Messenger](docs/Messenger.md) + - [MessengerAllOf](docs/MessengerAllOf.md) + - [MessengerUpdate](docs/MessengerUpdate.md) + - [MessengerUpdateAllOf](docs/MessengerUpdateAllOf.md) + - [Meta](docs/Meta.md) + - [OfferControlBody](docs/OfferControlBody.md) + - [Page](docs/Page.md) + - [Participant](docs/Participant.md) + - [ParticipantJoinBody](docs/ParticipantJoinBody.md) + - [ParticipantLeaveBody](docs/ParticipantLeaveBody.md) + - [ParticipantLeaveBodyParticipantId](docs/ParticipantLeaveBodyParticipantId.md) + - [ParticipantLeaveBodyUserExternalId](docs/ParticipantLeaveBodyUserExternalId.md) + - [ParticipantLeaveBodyUserId](docs/ParticipantLeaveBodyUserId.md) + - [ParticipantListResponse](docs/ParticipantListResponse.md) + - [ParticipantResponse](docs/ParticipantResponse.md) + - [ParticipantSubSchema](docs/ParticipantSubSchema.md) + - [ParticipantWithUserExternalId](docs/ParticipantWithUserExternalId.md) + - [ParticipantWithUserId](docs/ParticipantWithUserId.md) + - [PassControlBody](docs/PassControlBody.md) + - [Postback](docs/Postback.md) + - [PostbackWebhook](docs/PostbackWebhook.md) + - [PrechatCapture](docs/PrechatCapture.md) + - [Profile](docs/Profile.md) - [QuotedMessage](docs/QuotedMessage.md) - - [SecretKey](docs/SecretKey.md) - - [SecretKeyCreate](docs/SecretKeyCreate.md) - - [SecretKeyResponse](docs/SecretKeyResponse.md) - - [Select](docs/Select.md) - - [ServiceAccount](docs/ServiceAccount.md) - - [ServiceAccountCreate](docs/ServiceAccountCreate.md) - - [ServiceAccountResponse](docs/ServiceAccountResponse.md) - - [ServiceAccountUpdate](docs/ServiceAccountUpdate.md) + - [QuotedMessageExternalMessageId](docs/QuotedMessageExternalMessageId.md) + - [QuotedMessageMessage](docs/QuotedMessageMessage.md) + - [Referral](docs/Referral.md) + - [ReferralDetails](docs/ReferralDetails.md) + - [Reply](docs/Reply.md) - [Source](docs/Source.md) - - [SubMenuItem](docs/SubMenuItem.md) - - [Template](docs/Template.md) - - [TemplateCreate](docs/TemplateCreate.md) - - [TemplateResponse](docs/TemplateResponse.md) - - [TemplateUpdate](docs/TemplateUpdate.md) - - [UploadIntegrationProfilePhotoResponse](docs/UploadIntegrationProfilePhotoResponse.md) + - [SourceWebhook](docs/SourceWebhook.md) + - [Status](docs/Status.md) + - [Switchboard](docs/Switchboard.md) + - [SwitchboardAcceptControl](docs/SwitchboardAcceptControl.md) + - [SwitchboardAcceptControlAllOf](docs/SwitchboardAcceptControlAllOf.md) + - [SwitchboardAcceptControlAllOfPayload](docs/SwitchboardAcceptControlAllOfPayload.md) + - [SwitchboardAcceptControlFailure](docs/SwitchboardAcceptControlFailure.md) + - [SwitchboardAcceptControlFailureAllOf](docs/SwitchboardAcceptControlFailureAllOf.md) + - [SwitchboardAcceptControlFailureAllOfPayload](docs/SwitchboardAcceptControlFailureAllOfPayload.md) + - [SwitchboardIntegration](docs/SwitchboardIntegration.md) + - [SwitchboardIntegrationCreateBody](docs/SwitchboardIntegrationCreateBody.md) + - [SwitchboardIntegrationListResponse](docs/SwitchboardIntegrationListResponse.md) + - [SwitchboardIntegrationResponse](docs/SwitchboardIntegrationResponse.md) + - [SwitchboardIntegrationUpdateBody](docs/SwitchboardIntegrationUpdateBody.md) + - [SwitchboardIntegrationWebhook](docs/SwitchboardIntegrationWebhook.md) + - [SwitchboardListResponse](docs/SwitchboardListResponse.md) + - [SwitchboardOfferControl](docs/SwitchboardOfferControl.md) + - [SwitchboardOfferControlAllOf](docs/SwitchboardOfferControlAllOf.md) + - [SwitchboardOfferControlAllOfPayload](docs/SwitchboardOfferControlAllOfPayload.md) + - [SwitchboardOfferControlFailure](docs/SwitchboardOfferControlFailure.md) + - [SwitchboardPassControl](docs/SwitchboardPassControl.md) + - [SwitchboardPassControlAllOf](docs/SwitchboardPassControlAllOf.md) + - [SwitchboardPassControlAllOfPayload](docs/SwitchboardPassControlAllOfPayload.md) + - [SwitchboardPassControlFailure](docs/SwitchboardPassControlFailure.md) + - [SwitchboardResponse](docs/SwitchboardResponse.md) + - [SwitchboardUpdateBody](docs/SwitchboardUpdateBody.md) + - [Target](docs/Target.md) + - [Telegram](docs/Telegram.md) + - [TelegramAllOf](docs/TelegramAllOf.md) + - [TelegramUpdate](docs/TelegramUpdate.md) + - [TextMessage](docs/TextMessage.md) + - [Twilio](docs/Twilio.md) + - [TwilioAllOf](docs/TwilioAllOf.md) + - [TwilioUpdate](docs/TwilioUpdate.md) + - [Twitter](docs/Twitter.md) + - [TwitterAllOf](docs/TwitterAllOf.md) + - [TwitterUpdate](docs/TwitterUpdate.md) + - [User](docs/User.md) + - [UserAllOf](docs/UserAllOf.md) + - [UserCreateBody](docs/UserCreateBody.md) + - [UserMergeEvent](docs/UserMergeEvent.md) + - [UserMergeEventAllOf](docs/UserMergeEventAllOf.md) + - [UserMergeEventAllOfPayload](docs/UserMergeEventAllOfPayload.md) + - [UserMergeEventAllOfPayloadMergedConversations](docs/UserMergeEventAllOfPayloadMergedConversations.md) + - [UserMergeEventAllOfPayloadMergedUsers](docs/UserMergeEventAllOfPayloadMergedUsers.md) + - [UserResponse](docs/UserResponse.md) + - [UserTruncated](docs/UserTruncated.md) + - [UserUpdateBody](docs/UserUpdateBody.md) + - [Viber](docs/Viber.md) + - [ViberAllOf](docs/ViberAllOf.md) + - [ViberUpdate](docs/ViberUpdate.md) + - [Web](docs/Web.md) + - [WebAllOf](docs/WebAllOf.md) + - [WebUpdate](docs/WebUpdate.md) + - [WebUpdateAllOf](docs/WebUpdateAllOf.md) - [Webhook](docs/Webhook.md) - - [WebhookCreate](docs/WebhookCreate.md) + - [WebhookBody](docs/WebhookBody.md) + - [WebhookCreateBody](docs/WebhookCreateBody.md) + - [WebhookListResponse](docs/WebhookListResponse.md) - [WebhookResponse](docs/WebhookResponse.md) - - [WebhookUpdate](docs/WebhookUpdate.md) + - [WebhookSubSchema](docs/WebhookSubSchema.md) + - [Webview](docs/Webview.md) + - [WhatsAppUpdate](docs/WhatsAppUpdate.md) + - [WhatsAppUpdateAllOf](docs/WhatsAppUpdateAllOf.md) + - [Whatsapp](docs/Whatsapp.md) + - [WhatsappAllOf](docs/WhatsappAllOf.md) ## Documentation for Authorization @@ -326,16 +458,14 @@ Authentication schemes defined for the API: - **Type**: HTTP basic authentication -### jwt +### bearerAuth -- **Type**: API key -- **API key parameter name**: Authorization -- **Location**: HTTP header +- **Type**: HTTP basic authentication ## Recommendation -It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. Alternatively, configure the connectionPool to use a number of threads for the ApiClient. The default number is 20, but can be configured through the constructor `new ApiClient(30);` ## Copyright and license @@ -346,4 +476,4 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. \ No newline at end of file diff --git a/api/openapi.yaml b/api/openapi.yaml new file mode 100644 index 00000000..0e5ebe1a --- /dev/null +++ b/api/openapi.yaml @@ -0,0 +1,8055 @@ +openapi: 3.0.2 +info: + description: "# Introduction\n\n\nWelcome to the Sunshine Conversations API. The API allows\ + \ you to craft entirely unique messaging experiences for your app and website\ + \ as well as talk to any backend or external service.\n\nThe Sunshine Conversations\ + \ API is designed according to REST principles. The API accepts JSON in request\ + \ bodies and requires that the content-type: application/json header be specified\ + \ for \nall such requests. The API will always respond with an object. Depending\ + \ on context, resources may be returned as single objects or as arrays of objects,\ + \ nested within the response object.\n\nIn some cases, the API will also facilitate\ + \ cross-origin resource sharing so that it can be called from a web application.\n\ + \n\n\n## Regions\n\nSunshine Conversations is available\ + \ in the following regions. Each Sunshine Conversations region has its own API\ + \ host.\n\n| Region | Host |\n| -------------- |\ + \ -------------------------- |\n| United States | https://api.smooch.io \ + \ |\n| European Union | https://api.eu-1.smooch.io |\n\nFor more information on\ + \ regions, visit [the guide](/guide/regions/).\n\n\n\ + \n## Errors\n\nSunshine Conversations uses standard HTTP status codes to communicate\ + \ errors. In general, a `2xx` status code indicates success while `4xx` indicates\ + \ an error, in which case, the response body includes a JSON object which includes\ + \ an array of errors, with a text `code` and `title` containing more details.\ + \ Multiple errors can only be included in a `400 Bad Request`. A `5xx` status\ + \ code indicates that something went wrong on our end.\n\n```javascript\n{\n \ + \ \"errors\": [\n {\n \"code\": \"unauthorized\",\n \"title\"\ + : \"Authorization is required\"\n }\n ]\n}\n```\n\n## API Version\n\nThe\ + \ latest version of the API is v2. Version v1.1 is still supported and you can\ + \ continue using it but we encourage you to upgrade to the latest version. To\ + \ learn more about API versioning at Sunshine Conversations, including instructions\ + \ on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning).\n\ + \n## API Pagination and Records Limits\n\nSome APIs can be paginated by providing\ + \ the `offset` query string parameter.\n\nThe `offset` is the number of initial\ + \ records to skip before picking records to return (default 0).\n\nThe `limit`\ + \ query string can also be provided to change the number of records to return\ + \ (maximum\n100, default 25).\n\nAll paginated endpoints will eventually support\ + \ cursor pagination and `offset` based pagination support will be dropped.\n\n\ + ### Cursor Pagination\n\nSome APIs are paginated through cursor pagination. Rather\ + \ than providing an `offset`, a `page[after]` or `page[before]` query string parameter\ + \ may be provided. `page[after]` and `page[before]` are cursors pointing to a\ + \ record id.\n\nThe `page[after]` cursor indicates that only records **subsequent**\ + \ to it should be returned.\n\nThe `page[before]` cursor indicates that only records\ + \ **preceding** it should be returned.\n\n**Only one** of `page[after]` or `page[before]`\ + \ may be provided in a query, not both.\n\nIn cursor pagination, the equivalent\ + \ to the `limit` query string is the `page[size]` query string parameter.\n\n\ + ## API Libraries\n\nSunshine Conversations provides an official API library for\ + \ [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages\ + \ to come. These helpful libraries wrap calls to the API and can make interfacing\ + \ with Sunshine Conversations easier.\n\n## Postman Collection\n\nIn addition\ + \ to API libraries, Sunshine Conversations also has a Postman collection that\ + \ can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/)\ + \ for information on how to install and use the collection in your Postman client.\n\ + \n## Rate Limits\n\nSunshine Conversations APIs are subject to rate limiting.\ + \ If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many\ + \ Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service\ + \ attacks, and similar issues. Our goal is to keep the limits high enough so that\ + \ any application using Sunshine Conversations as intended will not encounter\ + \ them. However usage spikes do occur and encountering a rate limit may be unavoidable.\ + \ In order to avoid production outages, when calling the Sunshine Conversations\ + \ API you should implement `429` retry logic using exponential backoff and jitter.\n\ + \nIf your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact).\n\ + \n## Request Size Limits\n\nThe Sunshine Conversations API imposes the following\ + \ size limits on HTTP requests:\n\n| Request Type | Limit |\n| --------------\ + \ | --------------- |\n| JSON | 100kb |\n| File upload\t |\ + \ 25mb |\n\n## Authorization\n\nThis is an overview of how authorization\ + \ works with the Sunshine Conversations API. Sunshine Conversations allows basic\ + \ authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server\ + \ calls. [See below](#authentication) for more details.\nThere are two different\ + \ authorization scopes available - app and account.\n\n| Scope | Authorized\ + \ Methods |\n| -------------- | -----------------------------------------\ + \ |\n| app | All methods besides Account Provisioning |\n| account\ + \ \t | All methods |\n\nThe app scope can be used\ + \ to access any of the Sunshine Conversations APIs, besides account provisioning\ + \ methods, on behalf of a single app, or any app user related to that app. The\ + \ account scope can be used to access any of the Sunshine Conversations and Account\ + \ Provisioning APIs on behalf of the account owner, any app belonging to the account,\ + \ or any app user related to those apps.\n\n\n\n## Authentication\n\nTo authenticate requests\ + \ to the API, you will need an API key, composed of a key id and a secret.\nFor\ + \ an overview of how authentication works in Sunshine Conversations and instructions\ + \ on how to generate an API key, see the guide.\nAPI requests can be authenticated\ + \ in two ways:\n * With Basic authentication you can make requests using an API\ + \ key directly.\n * With JSON Web Tokens (JWTs) you sign tokens with an API key,\ + \ which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts)\ + \ to learn if JWTs are relevant for your usage.\n * Before using an API key in\ + \ production, make sure to familiarize yourself with best practices on how to\ + \ [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/).\n\ + \n### Basic Authentication\n\nAPI requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication)\ + \ using an API key. The key id is used as the username and the secret as the password.\ + \ The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access)\ + \ for more details.\n\n### JWTs\n\nJSON Web Tokens (JWTs) are an industry standard\ + \ authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519),\ + \ and a set of supported JWT libraries for a variety of languages and platforms\ + \ can be found at http://jwt.io. To summarize, a JWT is composed of a header,\ + \ a payload, and a signature. The payload contains information called claims which\ + \ describe the subject to whom the token was issued.\nThe JWT itself is transmitted\ + \ via the HTTP `authorization` header. The token should be prefixed with “Bearer”\ + \ followed by a space. For example: `Bearer your-jwt`.\nTo generate a JWT, you\ + \ need an API key, which is composed of a key ID and a secret. The key ID is included\ + \ in a JWT’s header, as the `kid` property, while the secret is used to sign the\ + \ JWT.\nFor more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt).\n\ + \n#### Header \n\nThe JWT header must contain the key id (kid) of the API key\ + \ that is used to sign it. The algorithm (alg) used should be HS256. Unsigned\ + \ JWTs are not accepted.\n\n```javascript\n{\n \"alg\": \"HS256\",\n \"\ + typ\": \"JWT\",\n \"kid\": \"act_5963ceb97cde542d000dbdb1\"\n}\n```\n\n####\ + \ Payload\nThe JWT payload must include a scope claim which specifies the caller’\ + s scope of access.\n\n * account-scoped JWTs must be generated with an API key\ + \ associated with a Sunshine Conversations account (act_) or service account (svc_).\n\ + ```javascript\n{\n \"scope\": \"account\"\n}\n```\n * app-scoped JWTs can be\ + \ generated with an API key associated with an app (app_).\n ```javascript\n{\n\ + \ \"scope\": \"app\"\n}\n ```" + termsOfService: https://www.zendesk.com/company/customers-partners/master-subscription-agreement/ + title: Sunshine Conversations API + version: 9.0.0 + x-logo: + url: sunco_logo.svg + altText: Sunshine Conversations + href: https://smooch.io/ +servers: +- description: United States server + url: https://api.smooch.io +- description: European Union server + url: https://api.eu-1.smooch.io +security: +- basicAuth: + - app + - account +- bearerAuth: + - app + - account +tags: +- description: "If you’re looking to enable messaging inside your product for your\ + \ customers, with as much control over the experience as you’d like, you can create\ + \ and control Sunshine Conversations apps programmatically using [Account Provisioning](https://docs.smooch.io/guide/intro-to-account-provisioning/).\n\ + ### Authentication\nAccount Provisioning endpoints require `account` scope. See\ + \ the [authorization](#authorization) and [authentication](#authentication) sections\ + \ for information.\nA user account API key (key id that starts with `act_`) can\ + \ access all account provisioning routes. You can create an account key by going\ + \ to your account page.\nA service account API key (key id that starts with `svc_`)\ + \ may be used to manage apps, but not service accounts or service account keys.\n\ + \n| Key Type | Authorized Methods \ + \ |\n| -------------- | -----------------------------------------------------------------\ + \ |\n| act | All Core and Account Provisioning methods. \ + \ |\n| svc \t | All Core methods, App Management methods, and\ + \ App Keys methods. |\n\n### Service Accounts\nService Account schema and\ + \ endpoints used for provisioning service accounts. A service account represents\ + \ an API user, with its own set of credentials, that has only access to a certain\ + \ subset of apps. For software makers that create apps on behalf of separate customers\ + \ or businesses, service accounts can be used to generate and distribute credentials\ + \ that only have access to a single business's data.\n" + name: Apps + x-displayName: Apps +- description: This set of endpoints is used to provision and revoke API keys for + a Sunshine Conversations app. An app can have a maximum of 10 keys. + name: App Keys + x-displayName: App Keys +- description: | + You can upload files of any type that can then be used to send a file, image or carousel message to a user. + + ## Attachments for Messages + The attachments API allows you to upload a file for the purpose of sending a message. + Using the for parameter, you can signal to Sunshine Conversations that your upload will be used to send a message to a user. + Knowing this, Sunshine Conversations will safely delete the attachment when the message, conversation or user is deleted. + name: Attachments + x-displayName: Attachments +- description: A stored history of messages sent to and received from a `user`. This + set of endpoints is used to provision and manage conversations. + name: Conversations + x-displayName: Conversations +- description: Endpoints used for managing conversation [participants](https://docs.smooch.io/guide/multi-party-conversations#participant). + name: Participants + x-displayName: Participants +- description: Endpoints used for managing [messages](https://docs.smooch.io/guide/key-concepts/#message). + name: Messages + x-displayName: Messages +- description: Notify Sunshine Conversations of different conversation activities. + name: Activities + x-displayName: Activities +- description: Manage which switchboard integration has control over a conversation. + name: Switchboard Actions + x-displayName: Switchboard Actions +- description: | + This set of endpoints is used to configure and manage various front-end messaging channels. + name: Integrations + x-displayName: Integrations +- description: This set of endpoints is used to provision and revoke API keys for + a Sunshine Conversations integration. An integration can have a maximum of 10 + keys. This endpoint is only available for integrations of type custom. An error + will be returned when attempting to provision API keys for any other integration + type. + name: CustomIntegrationApiKeys + x-displayName: Custom Integration API Keys +- description: Switchboard operations + name: Switchboards + x-displayName: Switchboards +- description: Switchboard Integrations operations + name: Switchboard Integrations + x-displayName: Switchboard Integrations +- description: This set of endpoints is used to manage users. + name: Users + x-displayName: Users +- description: Endpoints used for provisioning [clients](https://docs.smooch.io/guide/key-concepts/#client). + name: Clients + x-displayName: Clients +- description: All notable changes to the API will be referenced in the [v2 API changelog](https://docs.smooch.io/guide/v2-api-changelog/). + name: Changelog +- description: "Endpoints for managing webhooks associated to a Sunshine Conversations\ + \ Connect integration or a custom integration. Webhooks are a fantastic way to\ + \ extend the Sunshine Conversations platform beyond the built-in feature set.\ + \ You can use webhooks to build your own Sunshine Conversations chat clients,\ + \ to integrate more deeply with your favorite CRM, or to build a bot.\nA webhook\ + \ can only operate within the scope of a single Sunshine Conversations app.\n\ + \n\n## Webhook Triggers\nWhen a webhook trigger\ + \ is triggered, a POST request will be made to the URL configured in your webhook\ + \ object along with a JSON payload specific for the event type.\n\n| Trigger \ + \ | Description |\n| ----------------------\ + \ | -------------------------- |\n| conversation:create | When a new conversation\ + \ is created. |\n| conversation:message | When a new message was sent in the\ + \ conversation. |\n| conversation:message:delivery:channel | When a message is\ + \ successfully delivered to a channel. |\n| conversation:message:delivery:failure\ + \ | When a new message fails to be delivered in the conversation. |\n| conversation:message:delivery:user\ + \ | When a new message is successfully delivered to a user. |\n| conversation:postback\ + \ | When a user clicks on a postback action button. |\n| conversation:read |\ + \ When a user has read the conversation. |\n| conversation:typing | When a user\ + \ starts or stops typing. |\n| switchboard:acceptControl | When a switchboard\ + \ integration accepts control of a conversation. | \n| switchboard:acceptControl:failure\ + \ | When control of a conversation fails to be accepted by a switchboard integration.\ + \ |\n| switchboard:offerControl | When a switchboard integration has been offered\ + \ control of the conversation. |\n| switchboard:offerControl:failure | When control\ + \ of a conversation can't be offered to another switchboard integration. |\n|\ + \ switchboard:passControl | When a switchboard integration gives control of the\ + \ conversation to another switchboard integration. |\n| switchboard:passControl:failure\ + \ | When changing a switchboard integration to active fails. |\n| user:merge \ + \ | When two or more users are merged into one. |\n" + name: Webhooks +paths: + /v2/apps: + get: + description: "Lists all apps that a user is part of. This API is paginated through\ + \ [cursor pagination](#section/Introduction/API-pagination-and-records-limits).\ + \ \n```shell\n/v2/apps?page[after]=5e1606762556d93e9c176f69&page[size]=10\n\ + ```\n" + operationId: listApps + parameters: + - description: Contains parameters for applying cursor pagination. + explode: true + in: query + name: page + required: false + schema: + $ref: '#/components/schemas/page' + style: deepObject + - $ref: '#/components/parameters/appListFilter' + description: Contains parameters for filtering the results. + explode: true + in: query + name: filter + required: false + schema: + properties: + serviceAccountId: + description: When specified, lists only the apps that the service account + has access to. + type: string + title: appListFilter + type: object + style: deepObject + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/appListResponse' + description: Ok + "400": + description: Can supply only one of page[after] or page[before], not both + "403": + description: The serviceAccountId provided does not match supplied credentials + security: + - basicAuth: + - account + - bearerAuth: + - account + summary: List Apps + tags: + - Apps + x-accepts: application/json + post: + description: Creates a new app. When using [service account](#service-accounts) + credentials, the service account is automatically granted access to the app. + operationId: createApp + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/appCreateBody' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/appResponse' + description: Created + "400": + description: should have required property 'displayName' + "402": + description: Your account has reached the maximum number of apps for your + subscription plan + security: + - basicAuth: + - account + - bearerAuth: + - account + summary: Create App + tags: + - Apps + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}: + delete: + description: Removes the specified app, including all its enabled integrations. + operationId: deleteApp + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "404": + description: App not found + security: + - basicAuth: + - account + - bearerAuth: + - account + summary: Delete App + tags: + - Apps + x-accepts: application/json + get: + description: Fetches an individual app. + operationId: getApp + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/appResponse' + description: Ok + "404": + description: App not found + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: Get App + tags: + - Apps + x-accepts: application/json + patch: + description: Updates an app. + operationId: updateApp + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/appUpdateBody' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/appResponse' + description: Ok + "400": + description: App metadata is limited to 4096 bytes in size. + "404": + description: App not found + security: + - basicAuth: + - account + - bearerAuth: + - account + summary: Update App + tags: + - Apps + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/keys: + get: + description: Lists all API keys for a given app. + operationId: listAppKeys + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/appKeyListResponse' + description: Ok + security: + - basicAuth: + - account + - bearerAuth: + - account + summary: List App Keys + tags: + - App Keys + x-accepts: application/json + post: + description: "Creates an API key for the specified app. The response body will\ + \ include a secret \nas well as its corresponding id, which you can use to\ + \ generate JSON Web Tokens to \nsecurely make API calls on behalf of the app.\n" + operationId: createAppKey + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/AppKeyCreateBody' + content: + application/json: + schema: + example: + displayName: Key 1 + properties: + displayName: + allOf: + - $ref: '#/components/schemas/displayName' + example: Key 1 + required: + - displayName + title: AppKeyCreateBody + type: object + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/appKeyResponse' + description: Created + security: + - basicAuth: + - account + - bearerAuth: + - account + summary: Create App Key + tags: + - App Keys + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/keys/{keyId}: + delete: + description: Removes an API key. + operationId: deleteAppKey + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The id of the key. + explode: false + in: path + name: keyId + required: true + schema: + example: int_5d8cff3cd55b040010928b5b + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "404": + description: App not found + security: + - basicAuth: + - account + - bearerAuth: + - account + summary: Delete App Key + tags: + - App Keys + x-accepts: application/json + get: + description: Returns an API key. + operationId: getAppKey + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The id of the key. + explode: false + in: path + name: keyId + required: true + schema: + example: int_5d8cff3cd55b040010928b5b + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/appKeyResponse' + description: Ok + "404": + description: Not Found + security: + - basicAuth: + - account + - bearerAuth: + - account + summary: Get App Key + tags: + - App Keys + x-accepts: application/json + /v2/apps/{appId}/attachments: + post: + description: | + 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. + + operationId: uploadAttachment + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The access level for the attachment. Currently the available + access levels are public and private. + explode: true + in: query + name: access + required: true + schema: + default: public + example: public + type: string + style: form + - description: Specifies the intended container for the attachment, to enable + automatic attachment deletion (on deletion of associated message, conversation + or user). For now, only message is supported. See [Attachments for Messages](#section/Attachments-for-Messages) + for details. + explode: true + in: query + name: for + required: false + schema: + example: message + type: string + style: form + - description: Links the attachment getting uploaded to the conversation ID. + explode: true + in: query + name: conversationId + required: false + schema: + example: c616a583e4c240a871818541 + type: string + style: form + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/attachmentUploadBody' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/attachmentResponse' + description: Created + "400": + description: Bad request + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: Upload Attachment + tags: + - Attachments + x-contentType: multipart/form-data + x-accepts: application/json + /v2/apps/{appId}/attachments/remove: + post: + description: | + 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. + + operationId: deleteAttachment + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/attachmentDeleteBody' + required: true + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "404": + description: Attachment not found + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: Delete Attachment + tags: + - Attachments + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/attachments/token: + post: + description: | + Generates a media JWT for a list of attachment paths. This media token is a prerequisite for setting the cookie needed to visualize a private attachment. + + operationId: generateMediaJsonWebToken + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/attachmentMediaTokenBody' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/attachmentMediaTokenResponse' + description: Ok + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: Generate Media Token + tags: + - Attachments + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/attachments/cookie: + post: + description: | + With the media JWT retrieved, pass it in the header of the below request as it’s authorization in order to set a cookie in the user’s browser corresponding to the path within the media JWT. + The expiration date of this cookie will match the expiration date of the media JWT. This cookie will be needed to visualize a private attachment. + operationId: setCookie + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + security: + - bearerAuth: + - mediaToken + summary: Set Cookie + tags: + - Attachments + x-accepts: application/json + /v2/apps/{appId}/conversations: + get: + description: | + 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 + ``` + operationId: listConversations + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Contains parameters for applying cursor pagination. + explode: true + in: query + name: page + required: false + schema: + $ref: '#/components/schemas/page' + style: deepObject + - $ref: '#/components/parameters/conversationListFilter' + description: Contains parameters for filtering the results. + explode: true + in: query + name: filter + required: true + schema: + properties: + userId: + description: The user's id. One of `userId` or `userExternalId` is required, + but not both. + type: string + userExternalId: + description: The external Id of the user. One of `userId` or `userExternalId` + is required, but not both. + type: string + title: conversationListFilter + type: object + style: deepObject + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/conversationListResponse' + description: Ok + "404": + description: User not found + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: List Conversations + tags: + - Conversations + x-accepts: application/json + post: + description: Create a conversation for the specified user(s). + operationId: createConversation + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/conversationCreateBody' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/conversationResponse' + description: Created + "404": + description: App not found + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: Create Conversation + tags: + - Conversations + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/conversations/{conversationId}: + delete: + description: 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). + operationId: deleteConversation + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the conversation. + explode: false + in: path + name: conversationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "400": + description: Conversation c93bb9c14dde8ffb94564eae cannot be deleted because + it is the default. + "404": + description: Conversation not found + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: Delete Conversation + tags: + - Conversations + x-accepts: application/json + get: + description: Fetches an individual conversation. + operationId: getConversation + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the conversation. + explode: false + in: path + name: conversationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/conversationResponse' + description: Ok + "404": + description: Conversation not found + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: Get Conversation + tags: + - Conversations + x-accepts: application/json + patch: + description: Updates a conversation record. + operationId: updateConversation + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the conversation. + explode: false + in: path + name: conversationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/conversationUpdateBody' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/conversationResponse' + description: Ok + "404": + description: Conversation not found + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: Update Conversation + tags: + - Conversations + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/conversations/{conversationId}/join: + post: + description: | + Adds a user to a conversation using either their userId or userExternalId. The endpoint only + supports adding a participant to a sdkGroup conversation. + operationId: joinConversation + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the conversation. + explode: false + in: path + name: conversationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/participantJoinBody' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/ParticipantResponse' + description: Created + "400": + description: Too many participants + "404": + description: Conversation not found + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: Join Conversation + tags: + - Participants + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/conversations/{conversationId}/participants: + get: + description: | + 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 + ``` + operationId: listParticipants + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the conversation. + explode: false + in: path + name: conversationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + - description: Contains parameters for applying cursor pagination. + explode: true + in: query + name: page + required: false + schema: + $ref: '#/components/schemas/page' + style: deepObject + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/participantListResponse' + description: Ok + "404": + description: Not found + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: List Participants + tags: + - Participants + x-accepts: application/json + /v2/apps/{appId}/conversations/{conversationId}/leave: + post: + description: | + Removes a user from a conversation using either their userId, userExternalId, or participantId. + operationId: leaveConversation + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the conversation. + explode: false + in: path + name: conversationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/participantLeaveBody' + required: true + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "404": + description: User is not a member of the conversation + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: Leave Conversation + tags: + - Participants + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/conversations/{conversationId}/messages: + delete: + description: Delete all messages of a particular conversation. + operationId: deleteAllMessages + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the conversation. + explode: false + in: path + name: conversationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "404": + description: Not found + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: Delete All Messages + tags: + - Messages + x-accepts: application/json + get: + description: | + 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 + ``` + operationId: listMessages + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the conversation. + explode: false + in: path + name: conversationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + - description: Contains parameters for applying cursor pagination. + explode: true + in: query + name: page + required: false + schema: + $ref: '#/components/schemas/page' + style: deepObject + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/messageListResponse' + description: Ok + "404": + description: Message not found + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: List Messages + tags: + - Messages + x-accepts: application/json + post: + description: Send a message in a particular conversation. + operationId: postMessage + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the conversation. + explode: false + in: path + name: conversationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + requestBody: + content: + application/json: + examples: + request: + value: + author: + type: business + displayName: Steve + avatarUrl: https://www.gravatar.com/image.jpg + content: + type: text + text: Hello! + metadata: + lang: en-ca + schema: + $ref: '#/components/schemas/messagePost' + required: true + responses: + "201": + content: + application/json: + examples: + response: + value: + messages: + - id: 5f748c1a2b5315fc007e7977 + received: 2020-09-30T13:46:02.733Z + author: + type: business + displayName: Steve + avatarUrl: https://www.gravatar.com/image.jpg + content: + type: text + text: Hello! + metadata: + lang: en-ca + source: + type: api:conversations + schema: + $ref: '#/components/schemas/messagePostResponse' + description: Created + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: Post Message + tags: + - Messages + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/conversations/{conversationId}/messages/{messageId}: + delete: + description: Delete a single message of a particular conversation. + operationId: deleteMessage + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the conversation. + explode: false + in: path + name: conversationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + - description: The id of the message. + explode: false + in: path + name: messageId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "404": + description: Not found + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: Delete Message + tags: + - Messages + x-accepts: application/json + /v2/apps/{appId}/conversations/{conversationId}/activity: + post: + description: | + Notify Sunshine Conversations of different conversation activities. Supported activity types are: + * Typing activity + * Conversation read event + operationId: postActivity + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the conversation. + explode: false + in: path + name: conversationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + requestBody: + content: + application/json: + examples: + request: + value: + author: + type: user + userId: 5963c0d619a30a2e00de36b8 + type: conversation:read + schema: + $ref: '#/components/schemas/activityPost' + required: true + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: Post Activity + tags: + - Activities + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/conversations/{conversationId}/acceptControl: + post: + description: 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. + operationId: acceptControl + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the conversation. + explode: false + in: path + name: conversationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/acceptControlBody' + required: true + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "403": + description: Forbidden + "404": + description: Not Found + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: Accept Control + tags: + - Switchboard Actions + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/conversations/{conversationId}/offerControl: + post: + description: 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. + operationId: offerControl + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the conversation. + explode: false + in: path + name: conversationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/offerControlBody' + required: true + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "404": + description: Not Found + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: Offer Control + tags: + - Switchboard Actions + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/conversations/{conversationId}/passControl: + post: + description: Mark the named switchboard integration as active and transition + all the other switchboard integrations to standby status. + operationId: passControl + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the conversation. + explode: false + in: path + name: conversationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/passControlBody' + required: true + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "404": + description: Not Found + security: + - basicAuth: + - integration + - app + - account + - bearerAuth: + - integration + - app + - account + summary: Pass Control + tags: + - Switchboard Actions + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/integrations: + get: + description: | + 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 + ``` + operationId: listIntegrations + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Contains parameters for applying cursor pagination. + explode: true + in: query + name: page + required: false + schema: + $ref: '#/components/schemas/page' + style: deepObject + - $ref: '#/components/parameters/integrationListFilter' + description: Contains parameters for filtering the results. + explode: true + in: query + name: filter + required: false + schema: + properties: + types: + description: Comma-separated list of types to return. If omitted, all + types are returned. + example: android,ios + type: string + title: integrationListFilter + type: object + style: deepObject + responses: + "200": + content: + application/json: + examples: + success: + $ref: '#/components/examples/integrationListResponse' + schema: + $ref: '#/components/schemas/integrationListResponse' + description: Ok + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: List Integrations + tags: + - Integrations + x-accepts: application/json + post: + description: The Create Integration endpoint allows you to provision apps with + front-end messaging channels. Selecting a `custom` integration allows the + creation of webhooks. + operationId: createIntegration + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/integration' + required: true + responses: + "201": + content: + application/json: + examples: + success: + $ref: '#/components/examples/integrationResponse' + schema: + allOf: + - $ref: '#/components/schemas/integrationResponse' + description: The created integration. + description: Created + "400": + description: Invalid integration type + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: Create Integration + tags: + - Integrations + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/integrations/{integrationId}: + delete: + description: Delete the specified integration. + operationId: deleteIntegration + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The id of the integration. + explode: false + in: path + name: integrationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "404": + description: Integration not found + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: Delete Integration + tags: + - Integrations + x-accepts: application/json + get: + description: Get integration. + operationId: getIntegration + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The id of the integration. + explode: false + in: path + name: integrationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + responses: + "200": + content: + application/json: + examples: + success: + $ref: '#/components/examples/integrationResponse' + schema: + allOf: + - $ref: '#/components/schemas/integrationResponse' + description: The fetched integration. + description: Ok + "404": + description: Integration not found + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: Get Integration + tags: + - Integrations + x-accepts: application/json + patch: + description: 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. + operationId: updateIntegration + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The id of the integration. + explode: false + in: path + name: integrationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/integrationUpdate' + required: true + responses: + "200": + content: + application/json: + examples: + success: + $ref: '#/components/examples/integrationResponse' + schema: + allOf: + - $ref: '#/components/schemas/integrationResponse' + description: The updated integration. + description: Ok + "404": + description: Integration not found + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: Update Integration + tags: + - Integrations + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/integrations/{integrationId}/keys: + get: + description: Lists all API keys for a given integration. + operationId: listCustomIntegrationKeys + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The id of the integration. + explode: false + in: path + name: integrationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/IntegrationApiKeyListResponse' + description: Ok + "400": + description: API keys are available only for custom integrations + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: List Integration Keys + tags: + - CustomIntegrationApiKeys + x-accepts: application/json + post: + description: 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. + operationId: createCustomIntegrationKey + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The id of the integration. + explode: false + in: path + name: integrationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/IntegrationApiKey' + content: + application/json: + schema: + example: + displayName: My custom key + properties: + displayName: + description: The name of the API key. + example: My custom key + type: string + required: + - displayName + title: IntegrationApiKey + type: object + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/integrationApiKeyResponse' + description: Created + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: Create Integration Key + tags: + - CustomIntegrationApiKeys + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/integrations/{integrationId}/keys/{keyId}: + delete: + description: Removes an API key. + operationId: deleteCustomIntegrationKey + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The id of the integration. + explode: false + in: path + name: integrationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + - description: The id of the key. + explode: false + in: path + name: keyId + required: true + schema: + example: int_5d8cff3cd55b040010928b5b + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: Delete Integration Key + tags: + - CustomIntegrationApiKeys + x-accepts: application/json + get: + description: Get the specified API key. + operationId: getCustomIntegrationKey + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The id of the integration. + explode: false + in: path + name: integrationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + - description: The id of the key. + explode: false + in: path + name: keyId + required: true + schema: + example: int_5d8cff3cd55b040010928b5b + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/integrationApiKeyResponse' + description: Ok + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: Get Integration Key + tags: + - CustomIntegrationApiKeys + x-accepts: application/json + /v2/apps/{appId}/integrations/{integrationId}/webhooks: + get: + description: Lists all webhooks for a given Sunshine Conversations Connect integration + or custom integration. + operationId: listWebhooks + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The id of the integration. + explode: false + in: path + name: integrationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/webhookListResponse' + description: Ok + "403": + description: Forbidden + "404": + description: Not Found + security: + - basicAuth: + - integration + - app + - bearerAuth: + - integration + - app + summary: List Webhooks + tags: + - Webhooks + x-accepts: application/json + post: + description: Creates a new webhook associated with a Sunshine Conversations + Connect integration or a custom integration. + operationId: createWebhook + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The id of the integration. + explode: false + in: path + name: integrationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/webhookCreateBody' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/webhookResponse' + description: Created + "400": + description: Bad Request + "403": + description: Forbidden + "404": + description: Not Found + security: + - basicAuth: + - integration + - app + - bearerAuth: + - integration + - app + summary: Create Webhook + tags: + - Webhooks + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId}: + delete: + description: Deletes the specified webhook associated with a Sunshine Conversations + Connect integration or a custom integration. + operationId: deleteWebhook + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The id of the integration. + explode: false + in: path + name: integrationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + - description: The id of the webhook. + explode: false + in: path + name: webhookId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "404": + description: Not Found + security: + - basicAuth: + - integration + - app + - bearerAuth: + - integration + - app + summary: Delete Webhook + tags: + - Webhooks + x-accepts: application/json + get: + description: Gets the specified webhook associated with a Sunshine Conversations + Connect integration or a custom integration. + operationId: getWebhook + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The id of the integration. + explode: false + in: path + name: integrationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + - description: The id of the webhook. + explode: false + in: path + name: webhookId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/webhookResponse' + description: Ok + "404": + description: Not Found + security: + - basicAuth: + - integration + - app + - bearerAuth: + - integration + - app + summary: Get Webhook + tags: + - Webhooks + x-accepts: application/json + patch: + description: Updates the specified webhook associated with a Sunshine Conversations + Connect integration or a custom integration. + operationId: updateWebhook + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The id of the integration. + explode: false + in: path + name: integrationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + - description: The id of the webhook. + explode: false + in: path + name: webhookId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/webhookBody' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/webhookResponse' + description: Ok + "400": + description: Bad Request + "404": + description: Not Found + security: + - basicAuth: + - integration + - app + - bearerAuth: + - integration + - app + summary: Update Webhook + tags: + - Webhooks + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/switchboards: + get: + description: | + Lists all switchboards belonging to the app. + operationId: listSwitchboards + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/switchboardListResponse' + description: Ok + "404": + description: Not Found + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: List Switchboards + tags: + - Switchboards + x-accepts: application/json + post: + description: Create a switchboard. + operationId: createSwitchboard + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + responses: + "201": + content: + application/json: + examples: + response: + value: + switchboard: + id: 5ef21b132f21af34f088530d + enabled: false + schema: + $ref: '#/components/schemas/switchboardResponse' + description: Created + "404": + description: Not Found + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: Create Switchboard + tags: + - Switchboards + x-accepts: application/json + /v2/apps/{appId}/switchboards/{switchboardId}: + delete: + description: 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. + operationId: deleteSwitchboard + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the switchboard. + explode: false + in: path + name: switchboardId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "404": + description: Not Found + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: Delete Switchboard + tags: + - Switchboards + x-accepts: application/json + patch: + description: Updates a switchboard record. + operationId: updateSwitchboard + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the switchboard. + explode: false + in: path + name: switchboardId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/switchboardUpdateBody' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/switchboardResponse' + description: Ok + "404": + description: Not Found + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: Update Switchboard + tags: + - Switchboards + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations: + get: + description: | + Lists all switchboard integrations linked to the switchboard. + operationId: listSwitchboardIntegrations + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the switchboard. + explode: false + in: path + name: switchboardId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/switchboardIntegrationListResponse' + description: Ok + "404": + description: Switchboard not found + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: List Switchboard Integrations + tags: + - Switchboard Integrations + x-accepts: application/json + post: + description: Create a switchboard integration. + operationId: createSwitchboardIntegration + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the switchboard. + explode: false + in: path + name: switchboardId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + requestBody: + content: + application/json: + examples: + request: + value: + name: bot + integrationType: zd:agentWorkspace + deliverStandbyEvents: true + nextSwitchboardIntegrationId: 5ef21b86e933b7355c11c606 + messageHistoryCount: 5 + schema: + $ref: '#/components/schemas/switchboardIntegrationCreateBody' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/switchboardIntegrationResponse' + description: Created + "400": + description: Only one switchboard per app can be created + "404": + description: Switchboard not found + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: Create Switchboard Integration + tags: + - Switchboard Integrations + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations/{switchboardIntegrationId}: + delete: + description: 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. + operationId: deleteSwitchboardIntegration + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the switchboard. + explode: false + in: path + name: switchboardId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the switchboard integration. + explode: false + in: path + name: switchboardIntegrationId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "404": + description: Not Found + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: Delete Switchboard Integration + tags: + - Switchboard Integrations + x-accepts: application/json + patch: + description: Updates a switchboard integration record. + operationId: updateSwitchboardIntegration + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the switchboard. + explode: false + in: path + name: switchboardId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: Identifies the switchboard integration. + explode: false + in: path + name: switchboardIntegrationId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + requestBody: + content: + application/json: + examples: + request: + value: + name: bot + integrationType: zd:agentWorkspace + deliverStandbyEvents: true + nextSwitchboardIntegrationId: 5ef21b86e933b7355c11c606 + messageHistoryCount: 5 + schema: + $ref: '#/components/schemas/switchboardIntegrationUpdateBody' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/switchboardIntegrationResponse' + description: Ok + "404": + description: Enabled switchboard must have an associated default switchboardIntegration + security: + - basicAuth: + - app + - account + - bearerAuth: + - app + - account + summary: Update Switchboard Integration + tags: + - Switchboard Integrations + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/users: + post: + description: Creates a new user. + operationId: createUser + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/userCreateBody' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/userResponse' + description: Created + "409": + description: User already exists + security: + - basicAuth: + - account + - app + - integration + - bearerAuth: + - account + - app + - integration + summary: Create User + tags: + - Users + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/users/{userIdOrExternalId}: + delete: + description: 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). + operationId: deleteUser + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The user's id or externalId. + explode: false + in: path + name: userIdOrExternalId + required: true + schema: + example: 42589ad070d43be9b00ff7e5 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "404": + description: User not found + security: + - basicAuth: + - app + - account + - integration + - bearerAuth: + - app + - account + - integration + summary: Delete User + tags: + - Users + x-accepts: application/json + get: + description: Fetches an individual user. + operationId: getUser + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The user's id or externalId. + explode: false + in: path + name: userIdOrExternalId + required: true + schema: + example: 42589ad070d43be9b00ff7e5 + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/userResponse' + description: Ok + "404": + description: User not found + security: + - basicAuth: + - app + - account + - integration + - bearerAuth: + - app + - account + - integration + summary: Get User + tags: + - Users + x-accepts: application/json + patch: + description: Updates a user. + operationId: updateUser + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The user's id or externalId. + explode: false + in: path + name: userIdOrExternalId + required: true + schema: + example: 42589ad070d43be9b00ff7e5 + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/userUpdateBody' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/userResponse' + description: Ok + "404": + description: User not found + security: + - basicAuth: + - app + - account + - integration + - bearerAuth: + - app + - account + - integration + summary: Update User + tags: + - Users + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/users/{userIdOrExternalId}/clients: + get: + description: | + 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 + ``` + operationId: listClients + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The user's id or externalId. + explode: false + in: path + name: userIdOrExternalId + required: true + schema: + example: 42589ad070d43be9b00ff7e5 + type: string + style: simple + - description: Contains parameters for applying cursor pagination. + explode: true + in: query + name: page + required: false + schema: + $ref: '#/components/schemas/page' + style: deepObject + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/clientListResponse' + description: Ok + security: + - basicAuth: + - app + - account + - integration + - bearerAuth: + - app + - account + - integration + summary: List Clients + tags: + - Clients + x-accepts: application/json + post: + description: Create a client and link it to a channel specified by the matchCriteria.type. + operationId: createClient + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The user's id or externalId. + explode: false + in: path + name: userIdOrExternalId + required: true + schema: + example: 42589ad070d43be9b00ff7e5 + type: string + style: simple + requestBody: + content: + application/json: + examples: + mailgun: + value: + matchCriteria: + type: mailgun + integrationId: 582dedf230e788746891281a + primary: true + address: steveb@channel5.com + subject: New message from {appName} + confirmation: + type: immediate + message: + author: + type: business + displayName: Steve + avatarUrl: https://www.gravatar.com/image.jpg + content: + type: text + text: Hello! + metadata: + lang: en-ca + target: + conversationId: 029c31f25a21b47effd7be90 + messsagebird: + value: + matchCriteria: + type: messsagebird + integrationId: 582dedf230e788746891281a + primary: true + phoneNumber: +1 212-555-2368 + confirmation: + type: immediate + message: + author: + type: business + displayName: Steve + avatarUrl: https://www.gravatar.com/image.jpg + content: + type: text + text: Hello! + metadata: + lang: en-ca + target: + conversationId: 029c31f25a21b47effd7be90 + twilio: + value: + matchCriteria: + type: twilio + integrationId: 582dedf230e788746891281a + primary: true + phoneNumber: +1 212-555-2368 + confirmation: + type: immediate + message: + author: + type: business + displayName: Steve + avatarUrl: https://www.gravatar.com/image.jpg + content: + type: text + text: Hello! + metadata: + lang: en-ca + target: + conversationId: 029c31f25a21b47effd7be90 + whatsapp: + value: + matchCriteria: + type: whatsapp + integrationId: 582dedf230e788746891281a + primary: true + phoneNumber: +1 212-555-2368 + confirmation: + type: immediate + message: + author: + type: business + displayName: Steve + avatarUrl: https://www.gravatar.com/image.jpg + content: + type: text + text: Hello! + metadata: + lang: en-ca + target: + conversationId: 029c31f25a21b47effd7be90 + schema: + $ref: '#/components/schemas/clientCreate' + required: true + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/ClientResponse' + description: Created + security: + - basicAuth: + - app + - account + - integration + - bearerAuth: + - app + - account + - integration + summary: Create Client + tags: + - Clients + x-contentType: application/json + x-accepts: application/json + /v2/apps/{appId}/users/{userIdOrExternalId}/clients/{clientId}: + delete: + description: Remove a particular client and unsubscribe it from all connected + conversations. + operationId: removeClient + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The user's id or externalId. + explode: false + in: path + name: userIdOrExternalId + required: true + schema: + example: 42589ad070d43be9b00ff7e5 + type: string + style: simple + - description: The client's id. + explode: false + in: path + name: clientId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + type: object + description: Ok + "400": + description: Cannot remove a client of type 'sdk' + "404": + description: Client not found + security: + - basicAuth: + - app + - account + - integration + - bearerAuth: + - app + - account + - integration + summary: Remove Client + tags: + - Clients + x-accepts: application/json + /v2/apps/{appId}/users/{userIdOrExternalId}/personalinformation: + delete: + description: 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). + operationId: deleteUserPersonalInformation + parameters: + - description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + - description: The user's id or externalId. + explode: false + in: path + name: userIdOrExternalId + required: true + schema: + example: 42589ad070d43be9b00ff7e5 + type: string + style: simple + responses: + "200": + content: + application/json: + examples: + success: + $ref: '#/components/examples/userDeletePersonalInformationResponse' + schema: + $ref: '#/components/schemas/userResponse' + description: Ok + "404": + description: User not found + security: + - basicAuth: + - app + - account + - integration + - bearerAuth: + - app + - account + - integration + summary: Delete User Personal Information + tags: + - Users + x-accepts: application/json +components: + examples: + integrationListResponse: + value: + integrations: + - id: 5e4af71a81966cfff3ef6550 + type: android + status: active + displayName: Android + serverId: + canUserCreateMoreConversations: true + meta: + hasMore: true + afterCursor: 5e4af71a81966cfff3ef6550 + beforeCursor: 5e4af71a81966cfff3ef6550 + links: + prev: https://api.smooch.io/v2/apps/5e4af71a81966cfff3ef6551/integrations?page[before]=5e4af71a81966cfff3ef6550 + after: https://api.smooch.io/v2/apps/5e4af71a81966cfff3ef6551/integrations?page[after]=5e4af71a81966cfff3ef6550 + integrationResponse: + value: + integration: + id: 5e4af71a81966cfff3ef6550 + type: android + status: active + displayName: Android + serverId: + canUserCreateMoreConversations: true + userDeletePersonalInformationResponse: + value: + user: + id: 6e416caac6a5e9544e3fb6d7 + externalId: your-own-id + profile: {} + signedUpAt: 2020-05-21T15:53:30.197Z + metadata: {} + parameters: + pageQuery: + description: Contains parameters for applying cursor pagination. + explode: true + in: query + name: page + required: false + schema: + $ref: '#/components/schemas/page' + style: deepObject + appFilterQuery: + $ref: '#/components/parameters/appListFilter' + description: Contains parameters for filtering the results. + explode: true + in: query + name: filter + required: false + schema: + properties: + serviceAccountId: + description: When specified, lists only the apps that the service account + has access to. + type: string + title: appListFilter + type: object + style: deepObject + appId: + description: Identifies the app. + explode: false + in: path + name: appId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + keyId: + description: The id of the key. + explode: false + in: path + name: keyId + required: true + schema: + example: int_5d8cff3cd55b040010928b5b + type: string + style: simple + accessQuery: + description: The access level for the attachment. Currently the available access + levels are public and private. + explode: true + in: query + name: access + required: true + schema: + default: public + example: public + type: string + style: form + forQuery: + description: Specifies the intended container for the attachment, to enable + automatic attachment deletion (on deletion of associated message, conversation + or user). For now, only message is supported. See [Attachments for Messages](#section/Attachments-for-Messages) + for details. + explode: true + in: query + name: for + required: false + schema: + example: message + type: string + style: form + conversationIdQuery: + description: Links the attachment getting uploaded to the conversation ID. + explode: true + in: query + name: conversationId + required: false + schema: + example: c616a583e4c240a871818541 + type: string + style: form + conversationFilterQuery: + $ref: '#/components/parameters/conversationListFilter' + description: Contains parameters for filtering the results. + explode: true + in: query + name: filter + required: true + schema: + properties: + userId: + description: The user's id. One of `userId` or `userExternalId` is required, + but not both. + type: string + userExternalId: + description: The external Id of the user. One of `userId` or `userExternalId` + is required, but not both. + type: string + title: conversationListFilter + type: object + style: deepObject + conversationId: + description: Identifies the conversation. + explode: false + in: path + name: conversationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + messageId: + description: The id of the message. + explode: false + in: path + name: messageId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + integrationFilterQuery: + $ref: '#/components/parameters/integrationListFilter' + description: Contains parameters for filtering the results. + explode: true + in: query + name: filter + required: false + schema: + properties: + types: + description: Comma-separated list of types to return. If omitted, all + types are returned. + example: android,ios + type: string + title: integrationListFilter + type: object + style: deepObject + integrationId: + description: The id of the integration. + explode: false + in: path + name: integrationId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + webhookId: + description: The id of the webhook. + explode: false + in: path + name: webhookId + required: true + schema: + example: 029c31f25a21b47effd7be90 + type: string + style: simple + switchboardId: + description: Identifies the switchboard. + explode: false + in: path + name: switchboardId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + switchboardIntegrationId: + description: Identifies the switchboard integration. + explode: false + in: path + name: switchboardIntegrationId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + userIdOrExternalId: + description: The user's id or externalId. + explode: false + in: path + name: userIdOrExternalId + required: true + schema: + example: 42589ad070d43be9b00ff7e5 + type: string + style: simple + clientId: + description: The client's id. + explode: false + in: path + name: clientId + required: true + schema: + example: 5d8cff3cd55b040010928b5b + type: string + style: simple + requestBodies: + AppKeyCreateBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AppKeyCreateBody' + required: true + IntegrationApiKey: + content: + application/json: + schema: + $ref: '#/components/schemas/IntegrationApiKey' + required: true + schemas: + page: + properties: + after: + description: "A record id. Results will only contain the records that come\ + \ after the specified record. \nOnly one of `after` or `before` can be\ + \ provided, not both.\n" + example: 5e1606762556d93e9c176f69 + type: string + before: + description: | + A record id. Results will only contain the records that come before the specified record. + Only one of `after` or `before` can be provided, not both. + example: 5e1606762556d93e9c176f69 + type: string + size: + default: 25 + description: The number of records to return. + example: 10 + maximum: 100 + minimum: 0 + type: integer + type: object + displayName: + maxLength: 100 + minLength: 1 + nullable: true + type: string + appSettings: + description: Customizable app settings. + example: + attachmentsAccess: public + conversationRetentionSeconds: 0 + ignoreAutoConversationStart: true + useAnimalNames: true + echoPostback: true + multiConvoEnabled: true + attachmentsTokenExpirationSeconds: "64028" + maskCreditCardNumbers: true + properties: + conversationRetentionSeconds: + description: "Number of seconds of inactivity before a conversation’s messages\ + \ \nwill be automatically deleted. See \n[Conversation Retention Seconds](https://docs.smooch.io/rest/#conversation-retention-seconds)\n\ + for more information.\n" + minimum: 0 + type: integer + maskCreditCardNumbers: + description: "A boolean specifying whether credit card numbers should be\ + \ masked \nwhen sent through Sunshine Conversations.\n" + type: boolean + useAnimalNames: + description: "A boolean specifying whether animal names should be used for\ + \ \nunnamed users. See the \n[user naming guide](https://docs.smooch.io/guide/receiving-messages/#message-author-name)\n\ + for details.\n" + type: boolean + echoPostback: + description: "A boolean specifying whether a message should be added to\ + \ the conversation \nhistory when a postback button is clicked. See \n\ + [Echo Postbacks](https://docs.smooch.io/rest/#echo-postbacks)\nfor more\ + \ information.\n" + type: boolean + ignoreAutoConversationStart: + description: "A boolean specifying whether a non message event coming from\ + \ a channel will \ntrigger a \n[start conversation](https://docs.smooch.io/rest/#conversation-events)\n\ + event and count as a monthly active user (MAU).\n\n" + type: boolean + multiConvoEnabled: + description: | + A boolean specifying whether users are allowed to be part of several conversations. + Enabling `multiConvo` is **irreversible**. + type: boolean + attachmentsAccess: + description: | + A string specifying whether attachments should be stored in a publicly or privately accessible cloud storage. + attachmentsAccess is set to public by default but can be modified to private. + See Private Attachments for more information. + example: public + type: string + attachmentsTokenExpirationSeconds: + description: | + Number of seconds representing the expiration time of the generated media tokens for private attachments. The JWT will be valid for 2 hours by default. + See See Private Attachments for more information. + example: "64028" + type: string + type: object + metadata: + description: "Flat object containing custom properties. Strings, numbers and\ + \ booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + app: + example: + settings: + attachmentsAccess: public + conversationRetentionSeconds: 0 + ignoreAutoConversationStart: true + useAnimalNames: true + echoPostback: true + multiConvoEnabled: true + attachmentsTokenExpirationSeconds: "64028" + maskCreditCardNumbers: true + metadata: + lang: en-ca + displayName: My App + id: 5d8cff3cd55b040010928b5b + properties: + id: + description: A canonical ID that can be used to retrieve the Sunshine Conversations + app. + example: 5d8cff3cd55b040010928b5b + type: string + displayName: + allOf: + - $ref: '#/components/schemas/displayName' + description: The friendly name of the app. + example: My App + settings: + $ref: '#/components/schemas/appSettings' + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + type: object + meta: + description: Response metadata. + example: + beforeCursor: 55c8d9758590aa1900b9b9f6 + afterCursor: 55c8d9758590aa1900b9b9f6 + hasMore: true + properties: + hasMore: + description: A flag that indicates if there are more records that can be + fetched. + type: boolean + afterCursor: + description: "A record id that can be used as a `page[after]` parameter\ + \ in a new request to get the next page. \nNot specified if there are\ + \ no subsequent pages.\n" + example: 55c8d9758590aa1900b9b9f6 + type: string + beforeCursor: + description: "A record id that can be used as a `page[before]` parameter\ + \ in a new request to get the previous page. \nNot specified if there\ + \ are no previous pages.\n" + example: 55c8d9758590aa1900b9b9f6 + type: string + type: object + links: + description: Previous and next page links, if they exist. + example: + next: https://api.smooch.io/v2/apps?page[after]=5ea868f862cdd24abf010b38 + prev: https://api.smooch.io/v2/apps?page[before]=fcafad804c39a39648004af9 + properties: + prev: + description: A link to the previous page. Not specified if there are no + previous pages. + example: https://api.smooch.io/v2/apps?page[before]=fcafad804c39a39648004af9 + type: string + next: + description: A link to the next page. Not specified if there are no subsequent + pages. + example: https://api.smooch.io/v2/apps?page[after]=5ea868f862cdd24abf010b38 + type: string + type: object + appListResponse: + example: + meta: + beforeCursor: 55c8d9758590aa1900b9b9f6 + afterCursor: 55c8d9758590aa1900b9b9f6 + hasMore: true + links: + next: https://api.smooch.io/v2/apps?page[after]=5ea868f862cdd24abf010b38 + prev: https://api.smooch.io/v2/apps?page[before]=fcafad804c39a39648004af9 + apps: + - settings: + attachmentsAccess: public + conversationRetentionSeconds: 0 + ignoreAutoConversationStart: true + useAnimalNames: true + echoPostback: true + multiConvoEnabled: true + attachmentsTokenExpirationSeconds: "64028" + maskCreditCardNumbers: true + metadata: + lang: en-ca + displayName: My App + id: 5d8cff3cd55b040010928b5b + - settings: + attachmentsAccess: public + conversationRetentionSeconds: 0 + ignoreAutoConversationStart: true + useAnimalNames: true + echoPostback: true + multiConvoEnabled: true + attachmentsTokenExpirationSeconds: "64028" + maskCreditCardNumbers: true + metadata: + lang: en-ca + displayName: My App + id: 5d8cff3cd55b040010928b5b + properties: + apps: + description: List of returned apps. + items: + $ref: '#/components/schemas/app' + type: array + meta: + $ref: '#/components/schemas/meta' + links: + $ref: '#/components/schemas/links' + type: object + appCreateBody: + properties: + displayName: + allOf: + - $ref: '#/components/schemas/displayName' + description: The friendly name of the app. + example: My App + nullable: false + settings: + $ref: '#/components/schemas/appSettings' + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + required: + - displayName + title: AppCreateBody + type: object + appResponse: + example: + app: "" + properties: + app: + allOf: + - $ref: '#/components/schemas/app' + description: The app. + title: AppResponse + type: object + appUpdateBody: + properties: + displayName: + allOf: + - $ref: '#/components/schemas/displayName' + description: The friendly name of the app. + example: My App + nullable: false + settings: + $ref: '#/components/schemas/appSettings' + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + type: object + appKey: + example: + displayName: Key 1 + id: app_5723a347f82ba0516cb4ea34 + secret: 5XJ85yjUtRcaQu_pDINblPZb + properties: + id: + description: The unique ID of the API key, used when signing JWTs or accessing + the API using Basic Authentication. + example: app_5723a347f82ba0516cb4ea34 + type: string + displayName: + description: The name of the API key. + example: Key 1 + type: string + secret: + description: The secret of the API key, used when signing JWTs or accessing + the API using Basic Authentication + example: 5XJ85yjUtRcaQu_pDINblPZb + type: string + type: object + appKeyListResponse: + example: + keys: + - displayName: Key 1 + id: app_5723a347f82ba0516cb4ea34 + secret: 5XJ85yjUtRcaQu_pDINblPZb + - displayName: Key 1 + id: app_5723a347f82ba0516cb4ea34 + secret: 5XJ85yjUtRcaQu_pDINblPZb + properties: + keys: + description: List of returned keys. + items: + $ref: '#/components/schemas/appKey' + type: array + type: object + appKeyResponse: + example: + key: "" + properties: + key: + allOf: + - $ref: '#/components/schemas/appKey' + description: The created key object. + title: AppKeyResponse + type: object + attachmentUploadBody: + properties: + source: + format: binary + type: string + required: + - source + type: object + attachmentSchema: + properties: + mediaUrl: + description: Uploaded attachment’s url + example: http://smooch.io/rocks.smooch.media-dev/apps/5ec41c54fe13cc5ac404bedc/conversations/c616a583e4c240a871818541/TmYMVQUBNsQRItX4fKf4aC-T/Screen%20Shot%202020-09-02%20at%204.04.41%20PM.png + type: string + mediaType: + description: Uploaded attachment's media type + example: image/png + type: string + type: object + attachmentResponse: + example: + attachment: "" + properties: + attachment: + allOf: + - $ref: '#/components/schemas/attachmentSchema' + description: The uploaded attachment object. + title: AttachmentResponse + type: object + attachmentDeleteBody: + properties: + mediaUrl: + description: The media URL used for a file or image message. + example: https://s3.amazonaws.com/document.pdf + type: string + required: + - mediaUrl + type: object + attachmentMediaTokenBody: + properties: + paths: + description: An array of strings representing the list of attachment paths + used to generate the media JWT. One token will be generated for each path. + Each token will be valid for 2 hours by default. This value can be modified, + see [App Settings](#operation/createApp) for more information. + items: + example: /apps/5ec41c54fe13cc5ac404bedc + type: string + type: array + required: + - paths + type: object + attachmentMediaTokenResponse: + example: + tokens: + /apps/5ec41c54fe13cc5ac404bedc: eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCIsImtpZCI6IjM3NzdBNUM3LUI3QUQtNDEyMC1BNEVDLUNBNzk1ODlDRTYxNSJ9.eyJwYXRoIjoiL2FwcHMvNWVkYTk3ZDBhNmQ5ZmUwMDBmN2U2ODQyIiwiZXhwIjoxNTkzMjA2MzEzLCJpYXQiOjE1OTMxOTkxMTN9.R1i7e5YgRHv_QjUqUcP9c5xa4VgJ5aen675V84r1euCjNz165qqkZaep6of7aXNBKsZ29AI1CgbVt_nPn3ZsYTBc1cQ96ucqTv8tFR0FHf20-oR-_1egdyyLqJjxb0UI1wGZPGCP8mEs3mQwMu4lvZMF9vaty1Ye8wy-lPAPYFuZMb1rCES0QT6QUOAn45hAAfdT1zKqQ8ImV5eWVi6m0ENqV-JjExsiZ2mAMwyguDJ5yJUQLGKOV3f_Our1fVWfit5cGoMk-97o3009o628gVfSZVzPuvdNIfQOb0UUr_ELsI2qbY_Ju4REpSqYwdkjvSd3T20baf5K7_FGOrxPQitHAZojQAdlRK3mB-kC3IbVa93YFBcLK5UbRXnJYAo24UH828vU-MLgRrgzD6oVpcxNk8yyaLThJpTynO9Eoi0vKJ0m-_3A1ASKzYrR6ZZZWmRsFtZVtlpS21oYuO2tvS4EkbM8AhH4nh6V8oQUkQtvYIZKkEOadc0AFTjbv-le35hHLmHBZigUTRoZKokeglSDKr0FwDZylp7V3O8l6X0EhOU0BCoP1UYrEf8GjPdSLvu0Mno_k6hFw2Hx9DTdvnybZYroMkG31To2nmVhPglZ4FCswGV85HcqCcWQjhugFmB--9aE19G-OGOVFJfH6rFp0_cB4AxM9kSHQsWyuUs + properties: + tokens: + additionalProperties: + type: string + description: Object with key value pair where the key is the path and the + value is the media JWT. + example: + /apps/5ec41c54fe13cc5ac404bedc: eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCIsImtpZCI6IjM3NzdBNUM3LUI3QUQtNDEyMC1BNEVDLUNBNzk1ODlDRTYxNSJ9.eyJwYXRoIjoiL2FwcHMvNWVkYTk3ZDBhNmQ5ZmUwMDBmN2U2ODQyIiwiZXhwIjoxNTkzMjA2MzEzLCJpYXQiOjE1OTMxOTkxMTN9.R1i7e5YgRHv_QjUqUcP9c5xa4VgJ5aen675V84r1euCjNz165qqkZaep6of7aXNBKsZ29AI1CgbVt_nPn3ZsYTBc1cQ96ucqTv8tFR0FHf20-oR-_1egdyyLqJjxb0UI1wGZPGCP8mEs3mQwMu4lvZMF9vaty1Ye8wy-lPAPYFuZMb1rCES0QT6QUOAn45hAAfdT1zKqQ8ImV5eWVi6m0ENqV-JjExsiZ2mAMwyguDJ5yJUQLGKOV3f_Our1fVWfit5cGoMk-97o3009o628gVfSZVzPuvdNIfQOb0UUr_ELsI2qbY_Ju4REpSqYwdkjvSd3T20baf5K7_FGOrxPQitHAZojQAdlRK3mB-kC3IbVa93YFBcLK5UbRXnJYAo24UH828vU-MLgRrgzD6oVpcxNk8yyaLThJpTynO9Eoi0vKJ0m-_3A1ASKzYrR6ZZZWmRsFtZVtlpS21oYuO2tvS4EkbM8AhH4nh6V8oQUkQtvYIZKkEOadc0AFTjbv-le35hHLmHBZigUTRoZKokeglSDKr0FwDZylp7V3O8l6X0EhOU0BCoP1UYrEf8GjPdSLvu0Mno_k6hFw2Hx9DTdvnybZYroMkG31To2nmVhPglZ4FCswGV85HcqCcWQjhugFmB--9aE19G-OGOVFJfH6rFp0_cB4AxM9kSHQsWyuUs + type: object + title: AttachmentMediaTokenResponse + type: object + conversationType: + description: The type of the conversation. + enum: + - personal + - sdkGroup + example: personal + type: string + name: + description: Identifier for use in control transfer protocols. Restricted to + alphanumeric characters, `-` and `_`. + example: bot + maxLength: 128 + type: string + switchboardIntegrationId: + description: Id of the integration that should deliver events routed by the + switchboard. + example: 5ef21b86e933b7355c11c605 + type: string + switchboardIntegrationType: + description: Type of integration that should deliver events routed by the switchboard. + If referencing an OAuth integration, the clientId issued by Sunshine Conversations + during the OAuth partnership process will be the value of integrationType. + example: zd:agentWorkspace + type: string + switchboardIntegrationWebhook: + properties: + id: + description: The unique ID of the switchboard integration. + example: 5ef21b86e933b7355c11c604 + type: string + name: + description: Identifier for use in control transfer protocols. Restricted + to alphanumeric characters, `-` and `_`. + example: bot + maxLength: 128 + type: string + integrationId: + description: Id of the integration that should deliver events routed by + the switchboard. + example: 5ef21b86e933b7355c11c605 + type: string + integrationType: + description: Type of integration that should deliver events routed by the + switchboard. If referencing an OAuth integration, the clientId issued + by Sunshine Conversations during the OAuth partnership process will be + the value of integrationType. + example: zd:agentWorkspace + type: string + type: object + conversationTruncated: + properties: + id: + description: The unique ID of the conversation. + example: c93bb9c14dde8ffb94564eae + type: string + type: + $ref: '#/components/schemas/conversationType' + activeSwitchboardIntegration: + allOf: + - $ref: '#/components/schemas/switchboardIntegrationWebhook' + description: The current switchboard integration that is in control of the + conversation. This field is omitted if no `activeSwitchboardIntegration` + exists for the conversation. + nullable: true + pendingSwitchboardIntegration: + allOf: + - $ref: '#/components/schemas/switchboardIntegrationWebhook' + description: The switchboard integration that is awaiting control. This + field is omitted if no switchboard integration has been previously offered + control. + nullable: true + type: object + description: + description: A short text describing the conversation. + example: Conversation between Rogers and Carl. + maxLength: 100 + minLength: 1 + nullable: true + type: string + icon: + description: A custom conversation icon url. The image must be in either JPG, + PNG, or GIF format + example: https://www.gravatar.com/image.jpg + format: uri + maxLength: 2048 + minLength: 1 + nullable: true + type: string + conversation: + allOf: + - $ref: '#/components/schemas/conversationTruncated' + - $ref: '#/components/schemas/conversation_allOf' + conversationListResponse: + example: + meta: + beforeCursor: 55c8d9758590aa1900b9b9f6 + afterCursor: 55c8d9758590aa1900b9b9f6 + hasMore: true + links: + next: https://api.smooch.io/v2/apps?page[after]=5ea868f862cdd24abf010b38 + prev: https://api.smooch.io/v2/apps?page[before]=fcafad804c39a39648004af9 + conversations: + - null + - null + properties: + conversations: + description: List of returned conversations. + items: + $ref: '#/components/schemas/conversation' + type: array + meta: + $ref: '#/components/schemas/meta' + links: + $ref: '#/components/schemas/links' + type: object + participantSubSchema: + anyOf: + - $ref: '#/components/schemas/ParticipantWithUserId' + - $ref: '#/components/schemas/ParticipantWithUserExternalId' + conversationCreateBody: + properties: + type: + $ref: '#/components/schemas/conversationType' + participants: + description: | + The users participating in the conversation. For `personal` conversations, this field is required with a length of exactly 1. For `sdkGroup` conversations, must have a length less than or equal to 10. + Can be omitted to have a conversation with no participants if the type is `sdkGroup`. + items: + $ref: '#/components/schemas/participantSubSchema' + maxItems: 10 + type: array + displayName: + allOf: + - $ref: '#/components/schemas/displayName' + description: | + A friendly name for the conversation, may be displayed to the business or + the user. + example: My conversation + description: + description: A short text describing the conversation. + example: Conversation between Rogers and Carl. + maxLength: 100 + minLength: 1 + nullable: true + type: string + iconUrl: + description: A custom conversation icon url. The image must be in either + JPG, PNG, or GIF format + example: https://www.gravatar.com/image.jpg + format: uri + maxLength: 2048 + minLength: 1 + nullable: true + type: string + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + required: + - type + title: ConversationCreateBody + type: object + conversationResponse: + example: + conversation: "" + properties: + conversation: + allOf: + - $ref: '#/components/schemas/conversation' + description: The conversation. + title: ConversationResponse + type: object + conversationUpdateBody: + properties: + displayName: + allOf: + - $ref: '#/components/schemas/displayName' + description: | + A friendly name for the conversation, may be displayed to the business or + the user. + example: My conversation + description: + description: A short text describing the conversation. + example: Conversation between Rogers and Carl. + maxLength: 100 + minLength: 1 + nullable: true + type: string + iconUrl: + description: A custom conversation icon url. The image must be in either + JPG, PNG, or GIF format + example: https://www.gravatar.com/image.jpg + format: uri + maxLength: 2048 + minLength: 1 + nullable: true + type: string + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + type: object + participantJoinBody: + allOf: + - $ref: '#/components/schemas/participantSubSchema' + clientType: + description: The type of integration that the client represents. Can be any + of the supported integration types, or sdk for integrations of type ios, android, + and web. + enum: + - line + - mailgun + - messagebird + - messenger + - sdk + - telegram + - twilio + - twitter + - viber + - wechat + - whatsapp + example: telegram + type: string + clientAssociation: + example: + clientId: 42589ad070d43be9b00ff7e5 + type: telegram + properties: + type: + $ref: '#/components/schemas/clientType' + clientId: + description: The id of the client being referenced. + example: 42589ad070d43be9b00ff7e5 + type: string + type: object + participant: + example: + unreadCount: 0 + userExternalId: your-own-id + id: c93bb9c14dde8ffb94564eae + userId: 42589ad070d43be9b00ff7e5 + lastRead: 2019-01-14T18:55:12.515Z + clientAssociations: + - clientId: 42589ad070d43be9b00ff7e5 + type: telegram + - clientId: 42589ad070d43be9b00ff7e5 + type: telegram + properties: + id: + description: The unique ID of the participant. + example: c93bb9c14dde8ffb94564eae + type: string + userId: + description: The id of the associated user. + example: 42589ad070d43be9b00ff7e5 + type: string + unreadCount: + description: Number of messages the user has not yet read. + example: 0 + type: integer + clientAssociations: + description: | + Represents the clients that are active in the conversation for a particular + user. A participant can have multiple clientAssociations in the case of + channel transfer, business initiated conversations, or identified users. + The order of the array indicates how recently a client has interacted with + the conversation, with the most recent client first. The first item in the + array is considered to be the user's primary client for that conversation, + and will be selected first for message delivery. + items: + $ref: '#/components/schemas/clientAssociation' + type: array + userExternalId: + description: The externalId of the associated user. + example: your-own-id + nullable: true + type: string + lastRead: + description: A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ + representing the latest message the user has read. + example: 2019-01-14T18:55:12.515Z + nullable: true + type: string + type: object + participantListResponse: + description: List of returned participants. + example: + meta: + beforeCursor: 55c8d9758590aa1900b9b9f6 + afterCursor: 55c8d9758590aa1900b9b9f6 + hasMore: true + links: + next: https://api.smooch.io/v2/apps?page[after]=5ea868f862cdd24abf010b38 + prev: https://api.smooch.io/v2/apps?page[before]=fcafad804c39a39648004af9 + participants: + - unreadCount: 0 + userExternalId: your-own-id + id: c93bb9c14dde8ffb94564eae + userId: 42589ad070d43be9b00ff7e5 + lastRead: 2019-01-14T18:55:12.515Z + clientAssociations: + - clientId: 42589ad070d43be9b00ff7e5 + type: telegram + - clientId: 42589ad070d43be9b00ff7e5 + type: telegram + - unreadCount: 0 + userExternalId: your-own-id + id: c93bb9c14dde8ffb94564eae + userId: 42589ad070d43be9b00ff7e5 + lastRead: 2019-01-14T18:55:12.515Z + clientAssociations: + - clientId: 42589ad070d43be9b00ff7e5 + type: telegram + - clientId: 42589ad070d43be9b00ff7e5 + type: telegram + properties: + participants: + items: + $ref: '#/components/schemas/participant' + type: array + meta: + $ref: '#/components/schemas/meta' + links: + $ref: '#/components/schemas/links' + type: object + participantLeaveBody: + oneOf: + - $ref: '#/components/schemas/ParticipantLeaveBodyUserId' + - $ref: '#/components/schemas/ParticipantLeaveBodyUserExternalId' + - $ref: '#/components/schemas/ParticipantLeaveBodyParticipantId' + x-one-of-name: ParticipantLeaveBody + author: + description: The author of the message. + example: + avatarUrl: "" + displayName: Steve + userExternalId: your-own-id + type: business + userId: 5963c0d619a30a2e00de36b8 + properties: + type: + description: The type of the author. + enum: + - business + - user + example: business + type: string + userId: + description: The id of the user. Only supported when `type` is user. + example: 5963c0d619a30a2e00de36b8 + type: string + userExternalId: + description: The externalId of the user. Only supported when `type` is user. + example: your-own-id + type: string + writeOnly: true + displayName: + description: The display name of the message author. + example: Steve + type: string + avatarUrl: + allOf: + - $ref: '#/components/schemas/icon' + description: A custom message icon url. The image must be in either JPG, + PNG, or GIF format + nullable: false + required: + - type + type: object + buy: + properties: + type: + default: buy + description: The type of action. + type: string + text: + description: The button text. + example: Buy vinegar + type: string + amount: + description: The amount being charged. It needs to be specified in cents + and is an integer (9.99$ -> 999). + example: 8000 + type: integer + currency: + description: An ISO 4217 standard currency code in lowercase. Used for actions + of type buy. + example: CAD + type: string + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + required: + - amount + - text + - type + type: object + extraChannelOptions: + description: Extra options to pass directly to the channel API. + properties: + messenger: + $ref: '#/components/schemas/extraChannelOptions_messenger' + type: object + link: + description: A link action will open the provided URI when tapped. + properties: + type: + default: link + description: The type of action. + type: string + uri: + description: The action URI. This is the link that will be used in the clients + when clicking the button. + format: uri + type: string + text: + description: The button text. + type: string + default: + description: Boolean value indicating whether the action is the default + action for a message item in Facebook Messenger. + type: boolean + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + extraChannelOptions: + $ref: '#/components/schemas/extraChannelOptions' + required: + - text + - type + - uri + type: object + locationRequest: + description: A location request action will prompt the user to share their location. + properties: + type: + default: locationRequest + description: The type of action. + type: string + text: + description: The button text. + type: string + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + required: + - text + - type + type: object + postback: + properties: + type: + default: postback + description: The type of action. + type: string + text: + description: The button text. + type: string + payload: + description: The payload of a postback or reply button. + type: object + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + required: + - payload + - text + - type + type: object + reply: + properties: + type: + description: The type of action. + type: string + text: + description: The button text. Text longer than 20 characters will be truncated + on Facebook Messenger, and longer than 40 characters will be truncated + on Web Messenger, iOS, and Android. + type: string + payload: + description: A string payload to help you identify the action context. Used + when posting the reply. You can also use metadata for more complex needs. + type: string + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + iconUrl: + description: An icon to render next to the reply option. + type: string + required: + - payload + - text + - type + type: object + webview: + description: When a webview actions is clicked/tapped, the provided URI will + be loaded in a webview. Channels that do not support webviews will open the + fallback URI instead. + properties: + type: + description: The type of action. + type: string + uri: + description: The webview URI. This is the URI that will open in the webview + when clicking the button. + format: uri + type: string + text: + description: The button text. + type: string + default: + description: Boolean value indicating whether the action is the default + action for a message item in Facebook Messenger. + type: boolean + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + extraChannelOptions: + $ref: '#/components/schemas/extraChannelOptions' + size: + description: The size to display a webview. Used for actions of type webview. + enum: + - compact + - tall + - full + type: string + fallback: + description: The fallback uri for channels that don’t support webviews. + Used for actions of type webview. + type: string + openOnReceive: + description: Boolean value indicating if the webview should open automatically. + Only one action per message can be set to true. Currently only supported + on the Web Messenger. + type: boolean + required: + - fallback + - text + - type + - uri + type: object + action: + discriminator: + propertyName: type + oneOf: + - $ref: '#/components/schemas/buy' + - $ref: '#/components/schemas/link' + - $ref: '#/components/schemas/locationRequest' + - $ref: '#/components/schemas/postback' + - $ref: '#/components/schemas/reply' + - $ref: '#/components/schemas/webview' + x-one-of-name: Action + textMessage: + properties: + type: + default: text + description: The type of message. + type: string + text: + description: The text content of the message. Optional only if actions are + provided. + example: Hello! + maxLength: 4096 + type: string + actions: + description: Array of message actions. + items: + $ref: '#/components/schemas/action' + type: array + required: + - type + type: object + actionSubset: + discriminator: + propertyName: type + oneOf: + - $ref: '#/components/schemas/buy' + - $ref: '#/components/schemas/link' + - $ref: '#/components/schemas/postback' + - $ref: '#/components/schemas/webview' + x-one-of-name: ActionSubset + item: + properties: + title: + description: The title of the item. + maxLength: 128 + minLength: 1 + type: string + description: + description: The description of the item. + maxLength: 128 + type: string + mediaUrl: + description: The image url attached to the item. + format: uri + maxLength: 2048 + type: string + mediaType: + description: The MIME type for any image attached in the mediaUrl. + maxLength: 128 + type: string + size: + description: The size of the image. + enum: + - compact + - large + type: string + actions: + description: An array of objects representing the actions associated with + the item. + items: + $ref: '#/components/schemas/actionSubset' + maxItems: 3 + minItems: 1 + type: array + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + required: + - actions + - title + type: object + carouselMessage: + description: Carousel messages are a horizontally scrollable set of items that + may each contain text, an image, and message actions. Not all messaging channels + fully support carousel messages; currently only Facebook Messenger, LINE, + Telegram, Viber, the Web Messenger, the Android SDK and the iOS SDK cover + the full functionality. For all other platforms a carousel message is rendered + as raw text. The raw text fallback does not include any images or postback + message actions. + properties: + type: + default: carousel + description: The type of message. + type: string + text: + description: The fallback text message used when carousel messages are not + supported by the channel. + readOnly: true + type: string + items: + description: An array of objects representing the items associated with + the message. Only present in carousel and list type messages. + items: + $ref: '#/components/schemas/item' + maxItems: 10 + minItems: 1 + type: array + displaySettings: + $ref: '#/components/schemas/carouselMessage_displaySettings' + required: + - items + - type + type: object + fileMessage: + properties: + type: + default: file + description: The type of message. + type: string + text: + description: The text content of the message. + type: string + mediaUrl: + description: The URL for media, such as an image, attached to the message. + format: uri + type: string + mediaSize: + description: The size of the media. + readOnly: true + type: number + mediaType: + description: The media type of the file. + readOnly: true + type: string + required: + - type + type: object + formOptions: + description: Array of objects representing options for a field of type select. + items: + properties: + label: + description: The label of the option. What the option is displayed as + on Web Messenger. + maxLength: 128 + minLength: 1 + type: string + name: + description: The name of the field. Must be unique per field. + maxLength: 128 + minLength: 1 + type: string + type: object + maxItems: 20 + type: array + field: + description: | + Properties that can be expected to receive inside a form or formResponse message field. + properties: + type: + description: The field type. + enum: + - email + - select + - text + type: string + name: + description: The name of the field. Must be unique per form or formResponse. + maxLength: 128 + minLength: 1 + type: string + label: + description: The label of the field. What the field is displayed as on Web + Messenger. + maxLength: 128 + minLength: 1 + type: string + placeholder: + description: Placeholder text for the field. form message only. + maxLength: 128 + minLength: 1 + type: string + minSize: + default: 1 + description: The minimum allowed length for the response for a field of + type text. form message only. + maximum: 128 + minimum: 1 + type: integer + maxSize: + default: 128 + description: The maximum allowed length for the response for a field of + type text. form message only. + maximum: 128 + minimum: 1 + type: integer + text: + description: Specifies the response for a text field. + maxLength: 128 + minLength: 1 + type: string + email: + description: Specifies the response for a email field. + maxLength: 128 + minLength: 1 + type: string + select: + description: Array of objects representing the response for a field of type + select. form and formResponse messages only. + items: + type: object + type: array + options: + description: Array of objects representing options for a field of type select. + items: + properties: + label: + description: The label of the option. What the option is displayed + as on Web Messenger. + maxLength: 128 + minLength: 1 + type: string + name: + description: The name of the field. Must be unique per field. + maxLength: 128 + minLength: 1 + type: string + type: object + maxItems: 20 + type: array + required: + - label + - name + - type + type: object + formMessage: + description: A form type message without text or actions. + properties: + type: + default: form + description: The type of message. + type: string + blockChatInput: + description: true if the message should block the chat input on Web Messenger. + form message only. + type: boolean + fields: + description: An array of objects representing fields associated with the + message. Only present in form and formResponse messages. + items: + $ref: '#/components/schemas/field' + maxItems: 20 + minItems: 1 + type: array + required: + - fields + - type + type: object + formResponseMessage: + description: A formResponse type message is a response to a form type message. + formResponse type messages are only supported as responses to form messages + on Web Messenger and cannot be sent via the API. + properties: + type: + default: formResponse + description: The type of message. + type: string + fields: + description: Array of field objects that contain the submitted fields. + items: + $ref: '#/components/schemas/field' + maxItems: 20 + minItems: 1 + type: array + textFallback: + description: 'A string containing the `label: value` of all fields, each + separated by a newline character.' + readOnly: true + type: string + required: + - fields + - type + type: object + imageMessage: + properties: + type: + default: image + description: The type of message. + type: string + text: + description: The text content of the message. Optional only if actions are + provided. + type: string + actions: + description: Array of message actions. + items: + $ref: '#/components/schemas/action' + type: array + mediaUrl: + description: The URL for media, such as an image, attached to the message. + format: uri + type: string + required: + - type + type: object + listMessage: + description: | + List messages are a vertically scrollable set of items that may each contain text, an image, and message actions. Not all messaging channels fully support list messages. + * Facebook Messenger and WeChat have native support. + * For LINE and our Android, iOS and Web SDK, Sunshine Conversations converts list messages to carousel. + * On WhatsApp, Telegram and Twitter, Sunshine Conversations converts list messages to multiple rich messages. + * On all other platforms, Sunshine Conversations converts list messages to raw text. + properties: + type: + default: list + description: The type of message. + type: string + items: + description: An array of objects representing the items associated with + the message. Only present in carousel and list type messages. + items: + $ref: '#/components/schemas/item' + maxItems: 10 + minItems: 1 + type: array + actions: + description: An array of objects representing the actions associated with + the message. The array length is limited by the third party channel. + items: + $ref: '#/components/schemas/actionSubset' + maxItems: 10 + minItems: 1 + type: array + required: + - items + - type + title: ListMessage + type: object + locationMessage: + description: A location type message includes the coordinates (latitude and + longitude) of a location and an optional location object which can include + the name and address of the location. Typically sent in response to a Location + Request. + properties: + type: + default: location + description: The type of message. + type: string + text: + description: The fallback text message used when location messages are not + supported by the channel. + readOnly: true + type: string + coordinates: + $ref: '#/components/schemas/locationMessage_coordinates' + location: + $ref: '#/components/schemas/locationMessage_location' + required: + - type + type: object + content: + discriminator: + mapping: + text: '#/components/schemas/textMessage' + carousel: '#/components/schemas/carouselMessage' + file: '#/components/schemas/fileMessage' + form: '#/components/schemas/formMessage' + formResponse: '#/components/schemas/formResponseMessage' + image: '#/components/schemas/imageMessage' + list: '#/components/schemas/listMessage' + location: '#/components/schemas/locationMessage' + propertyName: type + oneOf: + - $ref: '#/components/schemas/textMessage' + - $ref: '#/components/schemas/carouselMessage' + - $ref: '#/components/schemas/fileMessage' + - $ref: '#/components/schemas/formMessage' + - $ref: '#/components/schemas/formResponseMessage' + - $ref: '#/components/schemas/imageMessage' + - $ref: '#/components/schemas/listMessage' + - $ref: '#/components/schemas/locationMessage' + x-one-of-name: Content + client: + example: + lastSeen: 2020-08-20T16:13:07.462Z + avatarUrl: https://openapi-generator.tech + displayName: Steve + integrationId: 582dedf230e788746891281a + externalId: your-own-id + linkedAt: 2020-06-23T14:33:47.492Z + raw: '{}' + id: 5c9a34160c89726709136733 + type: telegram + status: active + info: '{}' + properties: + id: + description: The unique ID of the client. + example: 5c9a34160c89726709136733 + type: string + type: + $ref: '#/components/schemas/clientType' + status: + description: The client status. Indicates if the client is able to receive + messages or not. Can be pending, inactive, active, or blocked. + enum: + - active + - blocked + - inactive + - pending + example: active + type: string + integrationId: + description: The ID of the integration that the client was created for. + Unused for clients of type sdk, as they incorporate multiple integrations. + example: 582dedf230e788746891281a + nullable: true + type: string + externalId: + description: The ID of the user on an external channel. For example, the + user’s phone number for Twilio, or their page-scoped user ID for Facebook + Messenger. Applies only to non-SDK clients. + example: your-own-id + nullable: true + type: string + lastSeen: + description: A datetime string with the format `YYYY-MM-DDThh:mm:ss.SSSZ` + representing the last time the user interacted with this client. + example: 2020-08-20T16:13:07.462Z + nullable: true + type: string + linkedAt: + description: A timestamp signifying when the client was added to the user. + Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + example: 2020-06-23T14:33:47.492Z + nullable: true + type: string + displayName: + description: The user's display name on the channel. + example: Steve + nullable: true + type: string + avatarUrl: + description: The URL for the user's avatar on the channel. + format: uri + nullable: true + type: string + info: + description: A flat curated object with properties that vary for each client + platform. All keys are optional and not guaranteed to be available. + nullable: true + type: object + raw: + description: An object with raw properties that vary for each client platform. + All keys are optional and not guaranteed to be available. + nullable: true + type: object + type: object + device: + properties: + id: + description: The unique ID of the device. + example: de13bee15b51033b34162411 + type: string + type: + description: The type of integration that the device represents. + enum: + - android + - ios + - web + type: string + guid: + description: A unique identifier for the device, generated client-side by + the SDK. + type: string + clientId: + description: The id of the client to which this device is associated. + type: string + status: + description: The device status. Indicates if the device will receive push + notifications or not. + enum: + - active + - inactive + type: string + integrationId: + description: The ID of the integration that the device was created for. + type: string + lastSeen: + description: A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ + representing the last time the user interacted with this device. + type: string + pushNotificationToken: + description: The token used for push notifications on Android and iOS devices. + nullable: true + type: string + info: + description: A flat curated object with properties that vary for each SDK + platform. All keys are optional and not guaranteed to be available. + nullable: true + type: object + appVersion: + description: Version of the mobile app in which the SDK is embedded. Not + applicable for devices of type web. + nullable: true + type: string + type: object + source: + description: The source of the message. + example: + originalMessageTimestamp: 2019-03-21T18:45:53.720Z + integrationId: de13bee15b51033b34162411 + client: "" + originalMessageId: 5f40256af057d0000dda9bd7 + type: ios + device: "" + properties: + type: + description: An identifier for the channel from which a message originated. + May include one of api, sdk, messenger, or any number of other channels. + example: ios + type: string + integrationId: + description: Identifier indicating which integration the message was sent + from. For user messages only. + example: de13bee15b51033b34162411 + nullable: true + type: string + originalMessageId: + description: Message identifier assigned by the originating channel. + example: 5f40256af057d0000dda9bd7 + nullable: true + type: string + originalMessageTimestamp: + description: A datetime string with the format `YYYY-MM-DDThh:mm:ss.SSSZ` + representing when the third party channel received the message. + example: 2019-03-21T18:45:53.720Z + nullable: true + type: string + client: + allOf: + - $ref: '#/components/schemas/client' + description: The client from which the user authored the message or activity, + if applicable. This field is not applicable in API responses, it is used + only in webhook payloads if the `includeFullSource` option is enabled. + nullable: true + device: + allOf: + - $ref: '#/components/schemas/device' + description: The device from which the user authored the message or activity, + if applicable. This field is not applicable in API responses, it is used + only in webhook payloads if the `includeFullSource` option is enabled. + nullable: true + required: + - type + type: object + message: + example: + metadata: "" + deleted: true + author: + avatarUrl: "" + displayName: Steve + userExternalId: your-own-id + type: business + userId: 5963c0d619a30a2e00de36b8 + received: 2019-03-21T18:48:52.760Z + id: 5e552ef595e5206375bb835d + source: + originalMessageTimestamp: 2019-03-21T18:45:53.720Z + integrationId: de13bee15b51033b34162411 + client: "" + originalMessageId: 5f40256af057d0000dda9bd7 + type: ios + device: "" + content: "" + quotedMessage: "" + properties: + id: + description: The unique ID of the message. + example: 5e552ef595e5206375bb835d + type: string + received: + description: A datetime string with the format `YYYY-MM-DDThh:mm:ss.SSSZ` + representing when Sunshine Conversations received the message. + example: 2019-03-21T18:48:52.760Z + type: string + author: + $ref: '#/components/schemas/author' + content: + allOf: + - $ref: '#/components/schemas/content' + description: The content of the message. + source: + $ref: '#/components/schemas/source' + quotedMessage: + allOf: + - $ref: '#/components/schemas/quotedMessage' + description: The quoted message is currently only available for WhatsApp + and Web Messenger `formResponse` messages. + nullable: true + metadata: + allOf: + - $ref: '#/components/schemas/metadata' + nullable: true + deleted: + description: true if the message serves as a placeholder for one that has + been deleted. + nullable: true + type: boolean + type: object + quotedMessageMessage: + properties: + type: + default: message + description: The type of quotedMessage - a complete Sunshine Conversations + message is provided. + type: string + message: + allOf: + - $ref: '#/components/schemas/message' + title: QuotedMessageMessage + type: object + quotedMessageExternalMessageId: + properties: + type: + default: externalMessageId + description: The type of quotedMessage - `externalMessageId` if no Sunshine + Conversations message matched the quoted message. + type: string + externalMessageId: + description: The external message Id of the quoted message. + type: string + title: QuotedMessageExternalMessageId + type: object + quotedMessage: + oneOf: + - $ref: '#/components/schemas/quotedMessageMessage' + - $ref: '#/components/schemas/quotedMessageExternalMessageId' + x-one-of-name: QuotedMessage + messageListResponse: + example: + meta: + beforeCursor: 55c8d9758590aa1900b9b9f6 + afterCursor: 55c8d9758590aa1900b9b9f6 + hasMore: true + messages: + - metadata: "" + deleted: true + author: + avatarUrl: "" + displayName: Steve + userExternalId: your-own-id + type: business + userId: 5963c0d619a30a2e00de36b8 + received: 2019-03-21T18:48:52.760Z + id: 5e552ef595e5206375bb835d + source: + originalMessageTimestamp: 2019-03-21T18:45:53.720Z + integrationId: de13bee15b51033b34162411 + client: "" + originalMessageId: 5f40256af057d0000dda9bd7 + type: ios + device: "" + content: "" + quotedMessage: "" + - metadata: "" + deleted: true + author: + avatarUrl: "" + displayName: Steve + userExternalId: your-own-id + type: business + userId: 5963c0d619a30a2e00de36b8 + received: 2019-03-21T18:48:52.760Z + id: 5e552ef595e5206375bb835d + source: + originalMessageTimestamp: 2019-03-21T18:45:53.720Z + integrationId: de13bee15b51033b34162411 + client: "" + originalMessageId: 5f40256af057d0000dda9bd7 + type: ios + device: "" + content: "" + quotedMessage: "" + links: + next: https://api.smooch.io/v2/apps?page[after]=5ea868f862cdd24abf010b38 + prev: https://api.smooch.io/v2/apps?page[before]=fcafad804c39a39648004af9 + properties: + messages: + description: List of returned messages. + items: + $ref: '#/components/schemas/message' + type: array + meta: + $ref: '#/components/schemas/meta' + links: + $ref: '#/components/schemas/links' + title: MessageListResponse + type: object + destination: + description: The destination of the message, in the case of channel targeting. + Only applicable if the author role is `business` and the conversation is of + type `personal`. + oneOf: + - $ref: '#/components/schemas/integrationId' + - $ref: '#/components/schemas/integrationType' + x-one-of-name: Destination + messageOverridePayload: + description: The exact payload to send to the channel. + properties: + payload: + type: object + type: object + messageOverride: + anyOf: + - $ref: '#/components/schemas/MessageOverrideApple' + - $ref: '#/components/schemas/MessageOverrideLine' + - $ref: '#/components/schemas/MessageOverrideMessenger' + - $ref: '#/components/schemas/MessageOverrideWhatsapp' + description: A raw payload containing a message that is sent directly to a channel. + Messages for [Apple Business Chat](https://docs.smooch.io/guide/apple-business-chat/#passthrough-api), + [Line](https://docs.smooch.io/guide/line/#passthrough-api), [Messenger](https://docs.smooch.io/guide/facebook-messenger/#passthrough-api), + [Whatsapp](https://docs.smooch.io/guide/whatsapp/#passthrough-api) channels + are supported. + messagePost: + properties: + author: + allOf: + - $ref: '#/components/schemas/author' + description: The author of the message. + content: + allOf: + - $ref: '#/components/schemas/content' + description: The content of the message. + destination: + $ref: '#/components/schemas/destination' + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + override: + $ref: '#/components/schemas/messageOverride' + required: + - author + - content + type: object + messagePostResponse: + description: The created messages. A single request may produce multiple messages + when the shorthand syntax is used to send a template message with leading + text. + example: + messages: + - metadata: "" + deleted: true + author: + avatarUrl: "" + displayName: Steve + userExternalId: your-own-id + type: business + userId: 5963c0d619a30a2e00de36b8 + received: 2019-03-21T18:48:52.760Z + id: 5e552ef595e5206375bb835d + source: + originalMessageTimestamp: 2019-03-21T18:45:53.720Z + integrationId: de13bee15b51033b34162411 + client: "" + originalMessageId: 5f40256af057d0000dda9bd7 + type: ios + device: "" + content: "" + quotedMessage: "" + - metadata: "" + deleted: true + author: + avatarUrl: "" + displayName: Steve + userExternalId: your-own-id + type: business + userId: 5963c0d619a30a2e00de36b8 + received: 2019-03-21T18:48:52.760Z + id: 5e552ef595e5206375bb835d + source: + originalMessageTimestamp: 2019-03-21T18:45:53.720Z + integrationId: de13bee15b51033b34162411 + client: "" + originalMessageId: 5f40256af057d0000dda9bd7 + type: ios + device: "" + content: "" + quotedMessage: "" + properties: + messages: + items: + $ref: '#/components/schemas/message' + type: array + type: object + activityTypes: + properties: + type: + description: If the author type is `user`, only `conversation:read` is supported. + enum: + - conversation:read + - typing:start + - typing:stop + type: string + type: object + activityPost: + allOf: + - $ref: '#/components/schemas/activityPost_allOf' + - $ref: '#/components/schemas/activityTypes' + required: + - author + - type + acceptControlBody: + properties: + metadata: + allOf: + - $ref: '#/components/schemas/metadata' + description: Flat object containing custom properties. Strings, numbers + and booleans are the only supported format that can be passed to metadata. + The metadata is limited to 4KB in size. The metadata object will be included + in the `switchboard:acceptControl` and `switchboard:acceptControl:failure` + webhooks. + type: object + offerControlBody: + properties: + switchboardIntegration: + description: The id or the name of the switchboard integration that will + become pending. Also supports the `next` keyword to offer control to the + next switchboard integration designated in the switchboard hierarchy configuration. + This cannot match the active switchboard integration. + example: next + type: string + metadata: + allOf: + - $ref: '#/components/schemas/metadata' + description: Flat object containing custom properties. Strings, numbers + and booleans are the only supported format that can be passed to metadata. + The metadata is limited to 4KB in size. The metadata object will be included + in the `switchboard:offerControl` and `switchboard:offerControl:failure` + webhooks. + required: + - switchboardIntegration + type: object + passControlBody: + properties: + switchboardIntegration: + description: The id or the name of the switchboard integration that will + become active. May also use the `next` keyword to transfer control to + the next switchboard integration designated in the switchboard hierarchy + configuration + example: next + type: string + metadata: + allOf: + - $ref: '#/components/schemas/metadata' + description: Flat object containing custom properties. Strings, numbers + and booleans are the only supported format that can be passed to metadata. + The metadata is limited to 4KB in size. The metadata object will be included + in the `switchboard:passControl` webhook. + required: + - switchboardIntegration + type: object + integration: + description: The integration. + discriminator: + mapping: + android: '#/components/schemas/android' + apple: '#/components/schemas/apple' + custom: '#/components/schemas/custom' + ios: '#/components/schemas/ios' + line: '#/components/schemas/line' + mailgun: '#/components/schemas/mailgun' + messagebird: '#/components/schemas/messageBird' + messenger: '#/components/schemas/messenger' + telegram: '#/components/schemas/telegram' + twilio: '#/components/schemas/twilio' + twitter: '#/components/schemas/twitter' + viber: '#/components/schemas/viber' + web: '#/components/schemas/web' + whatsapp: '#/components/schemas/whatsapp' + propertyName: type + example: + displayName: Channel name + id: 5e4af71a81966cfff3ef6550 + type: android + properties: + id: + description: The unique ID of the integration. + example: 5e4af71a81966cfff3ef6550 + readOnly: true + type: string + type: + description: The type of integration. + example: android + type: string + status: + $ref: '#/components/schemas/status' + displayName: + description: A human-friendly name used to identify the integration. + example: Channel name + maxLength: 100 + nullable: true + type: string + required: + - type + type: object + android: + allOf: + - $ref: '#/components/schemas/integration' + - $ref: '#/components/schemas/android_allOf' + apple: + allOf: + - $ref: '#/components/schemas/integration' + - $ref: '#/components/schemas/apple_allOf' + target: + description: URL to be called when the webhook is triggered. + example: http://example.com/callback + type: string + triggers: + description: An array of triggers the integration is subscribed to. This property + is case sensitive. Current supported triggers in v2 are `conversation:create`, + `conversation:message:delivery:channel`, `conversation:message:delivery:failure`, + `conversation:message:delivery:user`, `conversation:message`, `conversation:read`, + `conversation:typing`, `conversation:postback`, and `user:merge` + example: + - conversation:read + - conversation:message + items: + type: string + type: array + includeFullUser: + default: false + description: A boolean specifying whether webhook payloads should include the + complete user schema for events involving a specific user. + type: boolean + includeFullSource: + default: false + description: A boolean specifying whether webhook payloads should include the + client and device object (when applicable). + type: boolean + webhook: + example: + includeFullSource: false + id: 5e554d2cac66fb73a3c01871 + secret: 8564b3e6a8b20a4bdb68b05ce9bc5936 + triggers: + - conversation:read + - conversation:message + version: v2 + includeFullUser: false + target: http://example.com/callback + properties: + id: + description: A unique identifier for the webhook. + example: 5e554d2cac66fb73a3c01871 + readOnly: true + type: string + version: + description: Schema version of the payload delivered to this webhook. Can + be `v1`, `v1.1` or `v2`. + example: v2 + readOnly: true + type: string + target: + description: URL to be called when the webhook is triggered. + example: http://example.com/callback + type: string + triggers: + description: An array of triggers the integration is subscribed to. This + property is case sensitive. Current supported triggers in v2 are `conversation:create`, + `conversation:message:delivery:channel`, `conversation:message:delivery:failure`, + `conversation:message:delivery:user`, `conversation:message`, `conversation:read`, + `conversation:typing`, `conversation:postback`, and `user:merge` + example: + - conversation:read + - conversation:message + items: + type: string + type: array + secret: + description: Webhook secret, used to verify the origin of incoming requests. + example: 8564b3e6a8b20a4bdb68b05ce9bc5936 + type: string + includeFullUser: + default: false + description: A boolean specifying whether webhook payloads should include + the complete user schema for events involving a specific user. + type: boolean + includeFullSource: + default: false + description: A boolean specifying whether webhook payloads should include + the client and device object (when applicable). + type: boolean + required: + - target + - triggers + type: object + custom: + allOf: + - $ref: '#/components/schemas/integration' + - $ref: '#/components/schemas/custom_allOf' + ios: + allOf: + - $ref: '#/components/schemas/integration' + - $ref: '#/components/schemas/ios_allOf' + line: + allOf: + - $ref: '#/components/schemas/integration' + - $ref: '#/components/schemas/line_allOf' + mailgun: + allOf: + - $ref: '#/components/schemas/integration' + - $ref: '#/components/schemas/mailgun_allOf' + messageBird: + allOf: + - $ref: '#/components/schemas/integration' + - $ref: '#/components/schemas/messageBird_allOf' + messenger: + allOf: + - $ref: '#/components/schemas/integration' + - $ref: '#/components/schemas/messenger_allOf' + telegram: + allOf: + - $ref: '#/components/schemas/integration' + - $ref: '#/components/schemas/telegram_allOf' + twilio: + allOf: + - $ref: '#/components/schemas/integration' + - $ref: '#/components/schemas/twilio_allOf' + twitter: + allOf: + - $ref: '#/components/schemas/integration' + - $ref: '#/components/schemas/twitter_allOf' + viber: + allOf: + - $ref: '#/components/schemas/integration' + - $ref: '#/components/schemas/viber_allOf' + prechatCapture: + properties: + avatarUrl: + default: undefined + description: Sets the URL of the avatar to use for the automatic reply to + the prechat capture messages. + example: http://domain.com/images/avatar.png + type: string + enabled: + default: false + description: If true, enables the Prechat Capture add-on when the Web Messenger + is initialized. + type: boolean + enableEmailLinking: + default: false + description: f true and Mailgun is integrated, will automatically link submitted + emails. + type: boolean + fields: + description: Array of Fields. Overrides the default Prechat Capture fields + to define a custom form. + example: + - type: email + name: email + label: Email + placeholder: your@email.com + - type: text + name: company-website + label: Company website + placeholder: mycompany.com + items: + $ref: '#/components/schemas/field' + type: array + type: object + web: + allOf: + - $ref: '#/components/schemas/integration' + - $ref: '#/components/schemas/web_allOf' + whatsapp: + allOf: + - $ref: '#/components/schemas/integration' + - $ref: '#/components/schemas/whatsapp_allOf' + status: + description: The status of the integration. + enum: + - inactive + - active + - error + readOnly: true + type: string + integrationListResponse: + example: + meta: + beforeCursor: 55c8d9758590aa1900b9b9f6 + afterCursor: 55c8d9758590aa1900b9b9f6 + hasMore: true + links: + next: https://api.smooch.io/v2/apps?page[after]=5ea868f862cdd24abf010b38 + prev: https://api.smooch.io/v2/apps?page[before]=fcafad804c39a39648004af9 + integrations: + - displayName: Channel name + id: 5e4af71a81966cfff3ef6550 + type: android + - displayName: Channel name + id: 5e4af71a81966cfff3ef6550 + type: android + properties: + integrations: + description: List of returned integrations. + items: + $ref: '#/components/schemas/integration' + type: array + meta: + $ref: '#/components/schemas/meta' + links: + $ref: '#/components/schemas/links' + type: object + integrationResponse: + properties: + integration: + $ref: '#/components/schemas/integration' + title: integrationResponse + type: object + integrationUpdateBase: + properties: + displayName: + description: A human-friendly name used to identify the integration. `displayName` + can be unset by changing it to `null`. + example: My awesome integration + maxLength: 100 + minLength: 1 + nullable: true + type: string + type: object + androidUpdate: + allOf: + - $ref: '#/components/schemas/integrationUpdateBase' + - $ref: '#/components/schemas/androidUpdate_allOf' + appleUpdate: + allOf: + - $ref: '#/components/schemas/integrationUpdateBase' + customUpdate: + allOf: + - $ref: '#/components/schemas/integrationUpdateBase' + iosUpdate: + allOf: + - $ref: '#/components/schemas/integrationUpdateBase' + - $ref: '#/components/schemas/iosUpdate_allOf' + lineUpdate: + allOf: + - $ref: '#/components/schemas/integrationUpdateBase' + mailgunUpdate: + allOf: + - $ref: '#/components/schemas/integrationUpdateBase' + - $ref: '#/components/schemas/mailgunUpdate_allOf' + messageBirdUpdate: + allOf: + - $ref: '#/components/schemas/integrationUpdateBase' + messengerUpdate: + allOf: + - $ref: '#/components/schemas/integrationUpdateBase' + - $ref: '#/components/schemas/messengerUpdate_allOf' + telegramUpdate: + allOf: + - $ref: '#/components/schemas/integrationUpdateBase' + twilioUpdate: + allOf: + - $ref: '#/components/schemas/integrationUpdateBase' + twitterUpdate: + allOf: + - $ref: '#/components/schemas/integrationUpdateBase' + viberUpdate: + allOf: + - $ref: '#/components/schemas/integrationUpdateBase' + webUpdate: + allOf: + - $ref: '#/components/schemas/integrationUpdateBase' + - $ref: '#/components/schemas/webUpdate_allOf' + whatsAppUpdate: + allOf: + - $ref: '#/components/schemas/integrationUpdateBase' + - $ref: '#/components/schemas/whatsAppUpdate_allOf' + integrationUpdate: + oneOf: + - $ref: '#/components/schemas/androidUpdate' + - $ref: '#/components/schemas/appleUpdate' + - $ref: '#/components/schemas/customUpdate' + - $ref: '#/components/schemas/iosUpdate' + - $ref: '#/components/schemas/lineUpdate' + - $ref: '#/components/schemas/mailgunUpdate' + - $ref: '#/components/schemas/messageBirdUpdate' + - $ref: '#/components/schemas/messengerUpdate' + - $ref: '#/components/schemas/telegramUpdate' + - $ref: '#/components/schemas/twilioUpdate' + - $ref: '#/components/schemas/twitterUpdate' + - $ref: '#/components/schemas/viberUpdate' + - $ref: '#/components/schemas/webUpdate' + - $ref: '#/components/schemas/whatsAppUpdate' + x-one-of-name: IntegrationUpdate + apiKey: + description: The integration key. + example: + displayName: My custom key + id: int_5e4b0f225aca01092928f917 + secret: Ck1LjzzlUzvlCTtqAdQ2z1QukuBTrN3TIx + properties: + id: + description: The unique ID of the API key, used when signing JWTs or accessing + the API using Basic Authentication. + example: int_5e4b0f225aca01092928f917 + type: string + displayName: + allOf: + - $ref: '#/components/schemas/displayName' + description: The name of the API key. + example: My custom key + secret: + description: The secret of the API key, used when signing JWTs or accessing + the API using Basic Authentication + example: Ck1LjzzlUzvlCTtqAdQ2z1QukuBTrN3TIx + type: string + type: object + integrationApiKeyResponse: + example: + key: + displayName: My custom key + id: int_5e4b0f225aca01092928f917 + secret: Ck1LjzzlUzvlCTtqAdQ2z1QukuBTrN3TIx + properties: + key: + $ref: '#/components/schemas/apiKey' + type: object + webhookListResponse: + example: + webhooks: + - includeFullSource: false + id: 5e554d2cac66fb73a3c01871 + secret: 8564b3e6a8b20a4bdb68b05ce9bc5936 + triggers: + - conversation:read + - conversation:message + version: v2 + includeFullUser: false + target: http://example.com/callback + - includeFullSource: false + id: 5e554d2cac66fb73a3c01871 + secret: 8564b3e6a8b20a4bdb68b05ce9bc5936 + triggers: + - conversation:read + - conversation:message + version: v2 + includeFullUser: false + target: http://example.com/callback + properties: + webhooks: + description: List of webhooks associated with the integration. + items: + $ref: '#/components/schemas/webhook' + type: array + type: object + webhookBody: + properties: + target: + description: URL to be called when the webhook is triggered. + example: http://example.com/callback + type: string + triggers: + description: An array of triggers the integration is subscribed to. This + property is case sensitive. Current supported triggers in v2 are `conversation:create`, + `conversation:message:delivery:channel`, `conversation:message:delivery:failure`, + `conversation:message:delivery:user`, `conversation:message`, `conversation:read`, + `conversation:typing`, `conversation:postback`, and `user:merge` + example: + - conversation:read + - conversation:message + items: + type: string + type: array + includeFullUser: + default: false + description: A boolean specifying whether webhook payloads should include + the complete user schema for events involving a specific user. + type: boolean + includeFullSource: + default: false + description: A boolean specifying whether webhook payloads should include + the client and device object (when applicable). + type: boolean + type: object + webhookCreateBody: + allOf: + - $ref: '#/components/schemas/webhookBody' + required: + - target + - triggers + webhookResponse: + example: + webhook: "" + properties: + webhook: + allOf: + - $ref: '#/components/schemas/webhook' + description: The webhook. + title: WebhookResponse + type: object + enabled: + description: Whether the switchboard is enabled. Allows creating the switchboard + in a disabled state so that messages don't get lost or misrouted during switchboard + configuration. When a switchboard is disabled, integrations linked to the + switchboard will receive all events. + type: boolean + defaultSwitchboardIntegrationId: + description: The id of the switchboard integration that will be given control + when a new conversation begins. It will also be used for conversations that + existed before the switchboard was enabled. + example: 5ef21b132f21af34f088530e + type: string + switchboard: + example: + defaultSwitchboardIntegrationId: 5ef21b132f21af34f088530e + id: 5ef21b132f21af34f088530d + enabled: true + properties: + id: + description: The unique ID of the switchboard. + example: 5ef21b132f21af34f088530d + type: string + enabled: + description: Whether the switchboard is enabled. Allows creating the switchboard + in a disabled state so that messages don't get lost or misrouted during + switchboard configuration. When a switchboard is disabled, integrations + linked to the switchboard will receive all events. + type: boolean + defaultSwitchboardIntegrationId: + description: The id of the switchboard integration that will be given control + when a new conversation begins. It will also be used for conversations + that existed before the switchboard was enabled. + example: 5ef21b132f21af34f088530e + type: string + required: + - enabled + - id + type: object + switchboardListResponse: + example: + switchboards: + - defaultSwitchboardIntegrationId: 5ef21b132f21af34f088530e + id: 5ef21b132f21af34f088530d + enabled: true + - defaultSwitchboardIntegrationId: 5ef21b132f21af34f088530e + id: 5ef21b132f21af34f088530d + enabled: true + properties: + switchboards: + description: List of returned switchboards. + items: + $ref: '#/components/schemas/switchboard' + type: array + type: object + switchboardResponse: + example: + switchboard: "" + properties: + switchboard: + allOf: + - $ref: '#/components/schemas/switchboard' + description: The switchboard. + title: SwitchboardResponse + type: object + switchboardUpdateBody: + properties: + enabled: + description: Whether the switchboard is enabled. Allows creating the switchboard + in a disabled state so that messages don't get lost or misrouted during + switchboard configuration. When a switchboard is disabled, integrations + linked to the switchboard will receive all events. + type: boolean + defaultSwitchboardIntegrationId: + description: The id of the switchboard integration that will be given control + when a new conversation begins. It will also be used for conversations + that existed before the switchboard was enabled. + example: 5ef21b132f21af34f088530e + type: string + type: object + deliverStandbyEvents: + description: Setting to determine if webhooks should be sent when the switchboard + integration is not in control of a conversation (standby status) + type: boolean + nextSwitchboardIntegrationId: + description: The switchboard integration id to which control of a conversation + is passed / offered by default. + example: 5ef21b86e933b7355c11c606 + type: string + messageHistoryCount: + description: Number of messages to include in the message history context. + example: 5 + maximum: 10 + minimum: 1 + nullable: true + type: integer + switchboardIntegration: + example: + integrationType: zd:agentWorkspace + deliverStandbyEvents: true + nextSwitchboardIntegrationId: 5ef21b86e933b7355c11c606 + name: bot + integrationId: 5ef21b86e933b7355c11c605 + messageHistoryCount: 5 + id: 5ef21b86e933b7355c11c604 + properties: + id: + description: The unique ID of the switchboard integration. + example: 5ef21b86e933b7355c11c604 + type: string + name: + description: Identifier for use in control transfer protocols. Restricted + to alphanumeric characters, `-` and `_`. + example: bot + maxLength: 128 + type: string + integrationId: + description: Id of the integration that should deliver events routed by + the switchboard. + example: 5ef21b86e933b7355c11c605 + type: string + integrationType: + description: Type of integration that should deliver events routed by the + switchboard. If referencing an OAuth integration, the clientId issued + by Sunshine Conversations during the OAuth partnership process will be + the value of integrationType. + example: zd:agentWorkspace + type: string + deliverStandbyEvents: + description: Setting to determine if webhooks should be sent when the switchboard + integration is not in control of a conversation (standby status) + type: boolean + nextSwitchboardIntegrationId: + description: The switchboard integration id to which control of a conversation + is passed / offered by default. + example: 5ef21b86e933b7355c11c606 + type: string + messageHistoryCount: + description: Number of messages to include in the message history context. + example: 5 + maximum: 10 + minimum: 1 + nullable: true + type: integer + required: + - deliverStandbyEvents + - id + - integrationId + - integrationType + - name + type: object + switchboardIntegrationListResponse: + example: + switchboardIntegrations: + - integrationType: zd:agentWorkspace + deliverStandbyEvents: true + nextSwitchboardIntegrationId: 5ef21b86e933b7355c11c606 + name: bot + integrationId: 5ef21b86e933b7355c11c605 + messageHistoryCount: 5 + id: 5ef21b86e933b7355c11c604 + - integrationType: zd:agentWorkspace + deliverStandbyEvents: true + nextSwitchboardIntegrationId: 5ef21b86e933b7355c11c606 + name: bot + integrationId: 5ef21b86e933b7355c11c605 + messageHistoryCount: 5 + id: 5ef21b86e933b7355c11c604 + properties: + switchboardIntegrations: + description: List of returned switchboard integrations. + items: + $ref: '#/components/schemas/switchboardIntegration' + type: array + type: object + switchboardIntegrationCreateBody: + properties: + name: + description: Identifier for use in control transfer protocols. Restricted + to alphanumeric characters, `-` and `_`. + example: bot + maxLength: 128 + type: string + integrationId: + allOf: + - $ref: '#/components/schemas/switchboardIntegrationId' + description: The id of the integration to link to the switchboard integration. + Must be used when linking a custom integration. One of `integrationId` + or `integrationType` must be provided. + integrationType: + allOf: + - $ref: '#/components/schemas/switchboardIntegrationType' + description: The type of the integration to link to the switchboard integration. + Must be used when linking an OAuth integration. One of `integrationId` + or `integrationType` must be provided. + deliverStandbyEvents: + allOf: + - $ref: '#/components/schemas/deliverStandbyEvents' + nextSwitchboardIntegrationId: + allOf: + - $ref: '#/components/schemas/nextSwitchboardIntegrationId' + nullable: true + messageHistoryCount: + description: Number of messages to include in the message history context. + example: 5 + maximum: 10 + minimum: 1 + nullable: true + type: integer + required: + - name + type: object + switchboardIntegrationResponse: + example: + switchboardIntegration: "" + properties: + switchboardIntegration: + allOf: + - $ref: '#/components/schemas/switchboardIntegration' + description: The switchboard integration. + title: SwitchboardIntegrationResponse + type: object + switchboardIntegrationUpdateBody: + properties: + name: + description: Identifier for use in control transfer protocols. Restricted + to alphanumeric characters, `-` and `_`. + example: bot + maxLength: 128 + type: string + integrationId: + allOf: + - $ref: '#/components/schemas/switchboardIntegrationId' + description: The id of the integration to link to the switchboard integration. + Must be used when linking a custom integration. Can't provide both `integrationId` + and `integrationType`. + integrationType: + allOf: + - $ref: '#/components/schemas/switchboardIntegrationType' + description: The type of the integration to link to the switchboard integration. + Must be used when linking an OAuth integration. Can't provide both `integrationId` + and `integrationType`. + deliverStandbyEvents: + description: Setting to determine if webhooks should be sent when the switchboard + integration is not in control of a conversation (standby status) + type: boolean + nextSwitchboardIntegrationId: + allOf: + - $ref: '#/components/schemas/nextSwitchboardIntegrationId' + nullable: true + messageHistoryCount: + description: Number of messages to include in the message history context. + example: 5 + maximum: 10 + minimum: 1 + nullable: true + type: integer + type: object + signedUpAt: + description: The date at which the user signed up. Must be ISO 8601 time format + `YYYY-MM-DDThh:mm:ss.sssZ`. + example: 2020-05-21T15:53:30.197Z + type: string + profile: + description: Object hosting user profile information. + properties: + givenName: + description: The user's given name (first name). + example: Jane + maxLength: 128 + minLength: 1 + nullable: true + type: string + surname: + description: The user's surname (last name). + example: Doe + maxLength: 128 + minLength: 1 + nullable: true + type: string + email: + description: The user's email address. + example: jane.doe@gmail.com + format: email + maxLength: 128 + minLength: 1 + nullable: true + type: string + avatarUrl: + description: The user's avatar. + example: https://s3.amazonaws.com/avatar.jpg + format: uri + maxLength: 2048 + minLength: 1 + nullable: true + type: string + type: object + userCreateBody: + properties: + externalId: + description: | + A unique identifier for the user. The `externalId` can be used to link a user to the same conversation [across multiple devices](https://docs.smooch.io/guide/authenticating-users/). + example: your-own-id + maxLength: 1024 + minLength: 1 + type: string + signedUpAt: + description: The date at which the user signed up. Must be ISO 8601 time + format `YYYY-MM-DDThh:mm:ss.sssZ`. + example: 2020-05-21T15:53:30.197Z + type: string + profile: + $ref: '#/components/schemas/profile' + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + required: + - externalId + title: UserCreateBody + type: object + userTruncated: + properties: + id: + description: The unique ID of the user. + example: 7494535bff5cef41a15be74d + type: string + externalId: + description: | + An optional ID that if specified can also be used to retrieve the user. + example: your-own-id + nullable: true + type: string + type: object + user: + allOf: + - $ref: '#/components/schemas/userTruncated' + - $ref: '#/components/schemas/user_allOf' + userResponse: + example: + user: "" + properties: + user: + allOf: + - $ref: '#/components/schemas/user' + description: The user. + title: UserResponse + type: object + userUpdateBody: + properties: + signedUpAt: + allOf: + - $ref: '#/components/schemas/signedUpAt' + profile: + allOf: + - $ref: '#/components/schemas/profile' + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + title: UserUpdateBody + type: object + clientListResponse: + example: + clients: + - lastSeen: 2020-08-20T16:13:07.462Z + avatarUrl: https://openapi-generator.tech + displayName: Steve + integrationId: 582dedf230e788746891281a + externalId: your-own-id + linkedAt: 2020-06-23T14:33:47.492Z + raw: '{}' + id: 5c9a34160c89726709136733 + type: telegram + status: active + info: '{}' + - lastSeen: 2020-08-20T16:13:07.462Z + avatarUrl: https://openapi-generator.tech + displayName: Steve + integrationId: 582dedf230e788746891281a + externalId: your-own-id + linkedAt: 2020-06-23T14:33:47.492Z + raw: '{}' + id: 5c9a34160c89726709136733 + type: telegram + status: active + info: '{}' + meta: + beforeCursor: 55c8d9758590aa1900b9b9f6 + afterCursor: 55c8d9758590aa1900b9b9f6 + hasMore: true + links: + next: https://api.smooch.io/v2/apps?page[after]=5ea868f862cdd24abf010b38 + prev: https://api.smooch.io/v2/apps?page[before]=fcafad804c39a39648004af9 + properties: + clients: + description: List of returned clients. + items: + $ref: '#/components/schemas/client' + type: array + meta: + $ref: '#/components/schemas/meta' + links: + $ref: '#/components/schemas/links' + type: object + matchCriteriaMailgun: + allOf: + - $ref: '#/components/schemas/matchCriteriaBase' + - $ref: '#/components/schemas/matchCriteriaMailgun_allOf' + matchCriteriaMessagebird: + allOf: + - $ref: '#/components/schemas/matchCriteriaBase' + - $ref: '#/components/schemas/matchCriteriaMessagebird_allOf' + matchCriteriaTwilio: + allOf: + - $ref: '#/components/schemas/matchCriteriaBase' + - $ref: '#/components/schemas/matchCriteriaTwilio_allOf' + matchCriteriaWhatsapp: + allOf: + - $ref: '#/components/schemas/matchCriteriaBase' + - $ref: '#/components/schemas/matchCriteriaWhatsapp_allOf' + matchCriteriaBase: + description: The set of criteria used to determine the user's identity on a + third-party channel. + properties: + type: + description: The channel type. + type: string + integrationId: + description: The ID of the integration to link. Must match the provided + type. + example: 582dedf230e788746891281a + type: string + primary: + default: true + description: Flag indicating whether the client will become the primary + for the target conversation once linking is complete. + type: boolean + required: + - integrationId + - type + type: object + matchCriteria: + description: The set of criteria used to determine the user's identity on a + third-party channel. + discriminator: + mapping: + mailgun: '#/components/schemas/matchCriteriaMailgun' + messagebird: '#/components/schemas/matchCriteriaMessagebird' + twilio: '#/components/schemas/matchCriteriaTwilio' + whatsapp: '#/components/schemas/matchCriteriaWhatsapp' + propertyName: type + oneOf: + - $ref: '#/components/schemas/matchCriteriaMailgun' + - $ref: '#/components/schemas/matchCriteriaMessagebird' + - $ref: '#/components/schemas/matchCriteriaTwilio' + - $ref: '#/components/schemas/matchCriteriaWhatsapp' + x-one-of-name: MatchCriteria + clientCreate: + properties: + matchCriteria: + $ref: '#/components/schemas/matchCriteria' + confirmation: + $ref: '#/components/schemas/Confirmation' + target: + $ref: '#/components/schemas/Target' + required: + - confirmation + - matchCriteria + - target + type: object + appSubSchema: + description: The app that triggered the events. + properties: + id: + description: The unique ID of the app. + example: 5e4af71a81966cfff3ef6550 + type: string + type: object + webhookSubSchema: + description: The webhook that generated the payload. + example: + id: 582dedf230e788746891281a + version: v2 + properties: + id: + description: The unique ID of the webhook. + type: string + version: + description: Schema version of the payload delivered to this webhook (v2). + type: string + type: object + eventSubSchema: + example: + id: 0ca7d56ba7b2e081e479fe9e + type: conversation:message + createdAt: 2020-02-25T18:06:37.547Z + properties: + id: + description: The unique ID of the event. May be used to ensure that an event + is not processed twice in the case of a webhook that is re-tried due to + an error or timeout. + type: string + type: + description: The type of the event. Will match one of the subscribed triggers + for your [webhook](#operation/createWebhook). + type: string + createdAt: + description: A timestamp signifying when the event was generated. Formatted + as `YYYY-MM-DDThh:mm:ss.SSSZ`. + type: string + type: object + sourceWebhook: + properties: + type: + description: An identifier for the channel from which a message originated. + May include one of api, sdk, messenger, or any number of other channels. + example: ios + type: string + integrationId: + description: Identifier indicating which integration the message was sent + from. For user messages only. + type: string + originalMessageId: + description: Message identifier assigned by the originating channel. + nullable: true + type: string + originalMessageTimestamp: + description: A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ + representing when the third-party channel received the message. + nullable: true + type: string + client: + allOf: + - $ref: '#/components/schemas/client' + description: The client from which the user authored the message or activity, + if applicable. This field will only be present if the `includeFullSource` + option is enabled for the webhook. + nullable: true + device: + allOf: + - $ref: '#/components/schemas/device' + description: The device from which the user authored the message or activity, + if applicable. This field will only be present if the `includeFullSource` + option is enabled for the webhook + nullable: true + type: object + referral: + properties: + code: + description: The referral’s identifier. + type: string + details: + $ref: '#/components/schemas/referral_details' + type: object + conversationCreateEvent: + allOf: + - $ref: '#/components/schemas/eventSubSchema' + - $ref: '#/components/schemas/conversationCreateEvent_allOf' + title: conversation:create + conversationMessageDeliveryPayload: + description: The payload of the event. The contents of this object depend on + the type of event. + properties: + user: + allOf: + - $ref: '#/components/schemas/user' + description: The user associated with the conversation. + conversation: + allOf: + - $ref: '#/components/schemas/conversationTruncated' + description: The conversation in which the message was sent. + message: + $ref: '#/components/schemas/conversationMessageDeliveryPayload_message' + destination: + $ref: '#/components/schemas/conversationMessageDeliveryPayload_destination' + externalMessages: + description: An array of objects representing the third-party messages associated + with the event. The order of the external messages is not guaranteed to + be the same across the different triggers. Note that some channels don’t + expose message IDs, in which case this field will be unset. + items: + $ref: '#/components/schemas/conversationMessageDeliveryPayload_externalMessages' + nullable: true + type: array + isFinalEvent: + description: A boolean indicating whether the webhook is the final one for + the `message.id` and `destination.type` pair. + type: boolean + type: object + conversationMessageDeliveryChannelEvent: + allOf: + - $ref: '#/components/schemas/eventSubSchema' + - $ref: '#/components/schemas/conversationMessageDeliveryChannelEvent_allOf' + title: conversation:message:delivery:channel + conversationMessageDeliveryFailureEvent: + allOf: + - $ref: '#/components/schemas/eventSubSchema' + - $ref: '#/components/schemas/conversationMessageDeliveryFailureEvent_allOf' + title: conversation:message:delivery:failure + conversationMessageDeliveryUserEvent: + allOf: + - $ref: '#/components/schemas/eventSubSchema' + - $ref: '#/components/schemas/conversationMessageDeliveryChannelEvent_allOf' + title: conversation:message:delivery:user + authorWebhook: + description: The author of the activity. + properties: + type: + description: The role of the message or activity. + enum: + - business + - user + type: string + userId: + description: The id of the user. Only supported when role is `user`. + example: 5963c0d619a30a2e00de36b8 + type: string + user: + allOf: + - $ref: '#/components/schemas/user' + description: Full profile of the user that authored the message or activity. + It is used only in webhook payloads if the `includeFullUser` option is + enabled. + required: + - type + type: object + conversationMessageEvent: + allOf: + - $ref: '#/components/schemas/eventSubSchema' + - $ref: '#/components/schemas/conversationMessageEvent_allOf' + title: conversation:message + postbackWebhook: + properties: + payload: + description: The payload associated with the postback. + type: string + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + type: object + conversationPostbackEvent: + allOf: + - $ref: '#/components/schemas/eventSubSchema' + - $ref: '#/components/schemas/conversationPostbackEvent_allOf' + title: conversation:postback + activity: + allOf: + - $ref: '#/components/schemas/activityTypes' + - $ref: '#/components/schemas/activity_allOf' + conversationReadEvent: + allOf: + - $ref: '#/components/schemas/eventSubSchema' + - $ref: '#/components/schemas/conversationReadEvent_allOf' + title: conversation:read + conversationTypingEvent: + allOf: + - $ref: '#/components/schemas/eventSubSchema' + - $ref: '#/components/schemas/conversationTypingEvent_allOf' + title: conversation:typing + switchboardAcceptControl: + allOf: + - $ref: '#/components/schemas/eventSubSchema' + - $ref: '#/components/schemas/switchboardAcceptControl_allOf' + title: switchboard:acceptControl + switchboardAcceptControlFailure: + allOf: + - $ref: '#/components/schemas/eventSubSchema' + - $ref: '#/components/schemas/switchboardAcceptControlFailure_allOf' + title: switchboard:acceptControl:failure + switchboardOfferControl: + allOf: + - $ref: '#/components/schemas/eventSubSchema' + - $ref: '#/components/schemas/switchboardOfferControl_allOf' + title: switchboard:offerControl + switchboardOfferControlFailure: + allOf: + - $ref: '#/components/schemas/eventSubSchema' + - $ref: '#/components/schemas/switchboardAcceptControlFailure_allOf' + title: switchboard:offerControl:failure + switchboardPassControl: + allOf: + - $ref: '#/components/schemas/eventSubSchema' + - $ref: '#/components/schemas/switchboardPassControl_allOf' + title: switchboard:passControl + switchboardPassControlFailure: + allOf: + - $ref: '#/components/schemas/eventSubSchema' + - $ref: '#/components/schemas/switchboardAcceptControlFailure_allOf' + title: switchboard:passControl:failure + userMergeEvent: + allOf: + - $ref: '#/components/schemas/eventSubSchema' + - $ref: '#/components/schemas/userMergeEvent_allOf' + title: user:merge + appListFilter: + properties: + serviceAccountId: + description: When specified, lists only the apps that the service account + has access to. + type: string + title: appListFilter + type: object + AppKeyCreateBody: + example: + displayName: Key 1 + properties: + displayName: + allOf: + - $ref: '#/components/schemas/displayName' + example: Key 1 + required: + - displayName + title: AppKeyCreateBody + type: object + conversationListFilter: + properties: + userId: + description: The user's id. One of `userId` or `userExternalId` is required, + but not both. + type: string + userExternalId: + description: The external Id of the user. One of `userId` or `userExternalId` + is required, but not both. + type: string + title: conversationListFilter + type: object + ParticipantResponse: + description: The created participant. + example: + participant: + unreadCount: 0 + userExternalId: your-own-id + id: c93bb9c14dde8ffb94564eae + userId: 42589ad070d43be9b00ff7e5 + lastRead: 2019-01-14T18:55:12.515Z + clientAssociations: + - clientId: 42589ad070d43be9b00ff7e5 + type: telegram + - clientId: 42589ad070d43be9b00ff7e5 + type: telegram + properties: + participant: + $ref: '#/components/schemas/participant' + integrationListFilter: + properties: + types: + description: Comma-separated list of types to return. If omitted, all types + are returned. + example: android,ios + type: string + title: integrationListFilter + type: object + IntegrationApiKeyListResponse: + example: + keys: + - displayName: My custom key + id: int_5e4b0f225aca01092928f917 + secret: Ck1LjzzlUzvlCTtqAdQ2z1QukuBTrN3TIx + - displayName: My custom key + id: int_5e4b0f225aca01092928f917 + secret: Ck1LjzzlUzvlCTtqAdQ2z1QukuBTrN3TIx + properties: + keys: + description: Integration keys of the supplied integration. + items: + $ref: '#/components/schemas/apiKey' + type: array + IntegrationApiKey: + example: + displayName: My custom key + properties: + displayName: + description: The name of the API key. + example: My custom key + type: string + required: + - displayName + title: IntegrationApiKey + type: object + ClientResponse: + example: + client: + lastSeen: 2020-08-20T16:13:07.462Z + avatarUrl: https://openapi-generator.tech + displayName: Steve + integrationId: 582dedf230e788746891281a + externalId: your-own-id + linkedAt: 2020-06-23T14:33:47.492Z + raw: '{}' + id: 5c9a34160c89726709136733 + type: telegram + status: active + info: '{}' + properties: + client: + $ref: '#/components/schemas/client' + conversation_allOf: + properties: + isDefault: + description: | + Whether the conversation is the default conversation for the user. Will be + true for the first personal conversation created for the user, and false in + all other cases. + example: false + type: boolean + displayName: + allOf: + - $ref: '#/components/schemas/displayName' + description: | + A friendly name for the conversation, may be displayed to the business or + the user. + example: My conversation + description: + description: A short text describing the conversation. + example: Conversation between Rogers and Carl. + maxLength: 100 + minLength: 1 + nullable: true + type: string + iconUrl: + description: A custom conversation icon url. The image must be in either + JPG, PNG, or GIF format + example: https://www.gravatar.com/image.jpg + format: uri + maxLength: 2048 + minLength: 1 + nullable: true + type: string + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + businessLastRead: + description: | + A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ + representing the moment the conversation was last marked as read with + role business. + example: 2020-06-23T14:33:47.492Z + nullable: true + type: string + lastUpdatedAt: + description: | + A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ + representing the moment the last message was received in the + conversation, or the creation time if no messages have been received yet. + example: 2020-06-26T14:33:47.120Z + nullable: true + type: string + ParticipantWithUserId: + properties: + userId: + description: The id of the user that will be participating in the conversation. + It will return `404` if the user can’t be found. One of `userId` or `userExternalId` + is required, but not both. + example: 42589ad070d43be9b00ff7e5 + type: string + subscribeSDKClient: + description: When passed as true, the SDK client of the concerned participant + will be subscribed to the conversation. The user will start receiving + push notifications for this conversation right away, without having to + view the conversation on the SDK beforehand. An SDK client will be created + for users that don’t already have one. This field is required if the conversation + is of type `sdkGroup`. + example: false + type: boolean + ParticipantWithUserExternalId: + properties: + userExternalId: + description: The `externalId` of the user that will be participating in + the conversation. It will return `404` if the user can’t be found. One + of `userId` or `userExternalId` is required, but not both. + example: your-own-user-id + type: string + subscribeSDKClient: + description: When passed as true, the SDK client of the concerned participant + will be subscribed to the conversation. The user will start receiving + push notifications for this conversation right away, without having to + view the conversation on the SDK beforehand. An SDK client will be created + for users that don’t already have one. This field is required if the conversation + is of type `sdkGroup`. + example: false + type: boolean + ParticipantLeaveBodyUserId: + properties: + userId: + description: | + The id of the user that will be removed from the conversation. It will + return 404 if the user can’t be found. + example: 42589ad070d43be9b00ff7e5 + type: string + ParticipantLeaveBodyUserExternalId: + properties: + userExternalId: + description: | + The externalId of the user that will be removed from the conversation. It + will return 404 if the user can’t be found. + example: your-own-user-id + type: string + ParticipantLeaveBodyParticipantId: + properties: + participantId: + description: | + The participantId of the user that will be removed from the conversation. + It will return 404 if the user can’t be found. + example: 42589ad070d43be9b00ff7e5 + type: string + extraChannelOptions_messenger: + description: Messenger channel options. + properties: + messenger_extensions: + default: false + description: For webview type actions, a boolean value indicating whether + the URL should be loaded with Messenger Extensions enabled. [More info](https://developers.facebook.com/docs/messenger-platform/send-api-reference/url-button). + example: false + type: boolean + webview_share_button: + description: For webview type actions, a string value indicating if the + share button should be hidden. [More Info](https://developers.facebook.com/docs/messenger-platform/reference/buttons/url). + enum: + - hide + type: string + carouselMessage_displaySettings: + description: Settings to adjust the carousel layout. + properties: + imageAspectRatio: + description: Specifies how to display all carousel images. Valid values + are horizontal (default) and square. Only supported in Facebook Messenger, + Web Messenger, Android SDK and iOS SDK carousels. + enum: + - horizontal + - square + type: string + locationMessage_coordinates: + description: The coordinates of the location. + properties: + lat: + description: Global latitude. + type: number + long: + description: Global longitude. + type: number + locationMessage_location: + description: Information about the location. + properties: + address: + description: A string representing the address of the location. + type: string + name: + description: A string representing the name of the location. + type: string + integrationId: + properties: + integrationId: + description: | + The id of the integration to deliver the message to. Will return an error if + the integration does not exist or if the user does not have a client for the + integration attached to the conversation. + example: 582dedf230e788746891281a + type: string + integrationType: + properties: + integrationType: + description: | + The type of the integration to deliver the message to. Will return an error + if the user does not have a client of that type attached to the + conversation. + example: whatsapp + type: string + MessageOverrideApple: + properties: + apple: + $ref: '#/components/schemas/messageOverridePayload' + MessageOverrideLine: + properties: + line: + $ref: '#/components/schemas/messageOverridePayload' + MessageOverrideMessenger: + properties: + messenger: + $ref: '#/components/schemas/messageOverridePayload' + MessageOverrideWhatsapp: + properties: + whatsapp: + $ref: '#/components/schemas/messageOverridePayload' + activityPost_allOf: + properties: + author: + allOf: + - $ref: '#/components/schemas/author' + description: The author of the activity. + android_allOf: + properties: + type: + default: android + description: The type of integration. + type: string + serverKey: + description: Your server key from the fcm console. + example: + minLength: 1 + nullable: true + type: string + writeOnly: true + senderId: + description: Your sender id from the fcm console. + example: + minLength: 1 + nullable: true + type: string + canUserCreateMoreConversations: + description: Allows users to create more than one conversation on the android + integration. + type: boolean + apple_allOf: + description: | + To configure an Apple Business Chat integration, acquire the required information and call the Create Integration endpoint. + properties: + type: + default: apple + description: The type of integration. + type: string + businessId: + description: Apple Business Chat ID. + example: 2740f141-89c1-515f-07eb-1128dd73491 + type: string + apiSecret: + description: Your Apple API secret which is tied to your Messaging Service + Provider. + example: QLA//Z13paUYo/2tLReQa-43c5JEAASujGamiY/QTvs= + type: string + writeOnly: true + mspId: + description: Your Messaging Service Provider ID. + example: e7e495d5-bf78-531d-baf6-7f419f7fb592 + type: string + required: + - apiSecret + - businessId + - mspId + custom_allOf: + properties: + type: + default: custom + description: The type of integration. + type: string + webhooks: + description: An array of webhooks associated with the custom integration. + items: + $ref: '#/components/schemas/webhook' + maxItems: 1 + minItems: 1 + type: array + required: + - webhooks + ios_allOf: + properties: + type: + default: ios + description: The type of integration. + type: string + certificate: + description: The binary of your APN certificate base64 encoded. + example: your_APN_certificate + minLength: 1 + nullable: true + type: string + writeOnly: true + password: + description: The password for your APN certificate. + example: your_APN_password + type: string + writeOnly: true + production: + description: The APN environment to connect to (Production, if true, or + Sandbox). Defaults to value inferred from certificate if not specified. + type: boolean + autoUpdateBadge: + description: Use the unread count of the conversation as the application + badge. + type: boolean + canUserCreateMoreConversations: + description: Allows users to create more than one conversation on the iOS + integration. + type: boolean + line_allOf: + description: | + For LINE, each of your customers will need to manually configure a webhook in their LINE configuration page that will point to Sunshine Conversations servers. You must instruct your customers how to configure this manually on their LINE bot page. + Once you’ve acquired all the required information, call the Create Integration endpoint. + Then, using the returned integration _id, your customer must set the Callback URL field in their LINE Business Center page. + The URL should look like the following: `https://app.smooch.io:443/api/line/webhooks/{appId}/{integrationId}`. + properties: + type: + default: line + description: The type of integration. + type: string + channelId: + description: LINE Channel ID. + example: "1286564967" + type: string + channelSecret: + description: LINE Channel Secret. + example: your_line_channel_secret + type: string + channelAccessToken: + description: LINE Channel Access Token. + example: your_line_channel_token + type: string + serviceCode: + description: LINE Service Code. + example: your_line_service_code + type: string + switcherSecret: + description: LINE Switcher Secret. + example: your_line_switcher_secret + minLength: 1 + type: string + qrCodeUrl: + description: URL provided by LINE in the [Developer Console](https://developers.line.biz/console/). + example: https://qr-official.line.me/M/1O4fb8.png + type: string + lineId: + description: LINE Basic ID. Is automatically set when qrCodeUrl is updated. + example: 104fb8 + readOnly: true + type: string + required: + - channelId + - channelSecret + mailgun_allOf: + description: | + To configure a Mailgun integration, visit the API Keys tab in the settings page of the Mailgun dashboard and copy your active API key. Call the Create Integration endpoint with your API Key, a domain you have configured in Mailgun, and the incoming address you would like to use. Must have the same domain as the one specified in the domain parameter. + properties: + type: + default: mailgun + description: The type of integration. + type: string + apiKey: + description: The public API key of your Mailgun account. + example: key-f265hj32f0sd897lqd2j5keb96784043 + minLength: 1 + type: string + writeOnly: true + domain: + description: The domain used to relay email. This domain must be configured + and verified in your Mailgun account. + example: sandbox123.mailgun.org + minLength: 1 + type: string + incomingAddress: + description: Sunshine Conversations will receive all emails sent to this + address. It will also be used as the Reply-To address. + example: mytestemail@sandbox123.mailgun.org + minLength: 1 + type: string + hideUnsubscribeLink: + description: A boolean value indicating whether the unsubscribe link should + be omitted from outgoing emails. When enabled, it is expected that the + business is providing the user a way to unsubscribe by some other means. + By default, the unsubscribe link will be included in all outgoing emails. + type: boolean + fromAddress: + description: Email address to use as the From and Reply-To address if it + must be different from incomingAddress. Only use this option if the address + that you supply is configured to forward emails to the incomingAddress, + otherwise user replies will be lost. You must also make sure that the + domain is properly configured as a mail provider so as to not be flagged + as spam by the user’s email client. May be unset with null. + example: test@sandbox123.mailgun.org + minLength: 1 + nullable: true + type: string + required: + - apiKey + - domain + - incomingAddress + messageBird_allOf: + description: "To configure a MessageBird integration, acquire the accessKey,\ + \ the signingKey and the MessageBird number you would like to use, then call\ + \ the Create Integration endpoint. The response will include the integration’\ + s _id and webhookSecret, which must be used to configure the webhook in MessageBird.\n\ + In the Flow Builder for the MessageBird number you’ve used to integrate, add\ + \ a new step with the following settings:\n* Create a new Call HTTP endpoint\ + \ with SMS flow.\n* Select your desired SMS number for Incoming SMS.\n* Click\ + \ on Forward to URL and set its method to POST.\n* Then, using the integration\ + \ _id and webhookSecret returned from the create integration call, enter the\ + \ following into the URL field: \n`https://app.smooch.io/api/messagebird/webhooks/{appId}/{integrationId}/{webhookSecret}`\n\ + * Select application/json for the Set Content-Type header field.\n* Save and\ + \ publish your changes.\n" + properties: + type: + default: messagebird + description: The type of integration. + type: string + accessKey: + description: The public API key of your MessageBird account. + example: 9V2iJmd93kFJ390L9495JCl11 + minLength: 1 + type: string + writeOnly: true + signingKey: + description: The signing key of your MessageBird account. Used to validate + the webhooks' origin. + example: Uu6N09Lkdji3820DJIO89I39sl9dJ + minLength: 1 + type: string + writeOnly: true + originator: + description: Sunshine Conversations will receive all messages sent to this + phone number. + example: "12262121021" + minLength: 1 + type: string + webhookSecret: + description: The secret that is used to configure webhooks in MessageBird. + example: 72ade38394d1da51566cede33bd1e67e + readOnly: true + type: string + required: + - accessKey + - originator + - signingKey + messenger_allOf: + description: | + Facebook Messenger Setup steps: + Take note of your Facebook app ID and secret (apps can be created at developer.facebook.com); + The Facebook app must have been submitted to Facebook for approval with the “manage_pages” (to receive messages through webhook) and “pages_messaging” (to send messages) permissions. + In order to integrate a Facebook Messenger app you must acquire a Page Access Token from your user. Once you have acquired a page access token from your user, call the Create Integration endpoint with your app secret and ID and the user’s page access token. + properties: + type: + default: messenger + description: The type of integration. + type: string + pageAccessToken: + description: A Facebook Page Access Token. + example: your_access_token + type: string + appId: + description: A Facebook App ID. + example: your_facebook_app_id + type: string + appSecret: + description: A Facebook App Secret. + example: your_facebook_app_secret + type: string + writeOnly: true + required: + - appId + - appSecret + - pageAccessToken + telegram_allOf: + description: | + To configure a Telegram integration, acquire the required information from the user and call the Create Integration endpoint. + properties: + type: + default: telegram + description: The type of integration. + type: string + token: + description: Telegram Bot Token. + example: 192033615:AAEuee2FS2JYKWfDlTulfygjaIGJi4s + minLength: 1 + type: string + writeOnly: true + username: + description: Username of the botId + readOnly: true + type: string + botId: + description: A human-friendly name used to identify the integration. + readOnly: true + type: string + required: + - token + twilio_allOf: + description: | + To configure a Twilio integration, acquire the required information from the user and call the Create Integration endpoint. + properties: + type: + default: twilio + description: The type of integration. + type: string + accountSid: + description: Twilio Account SID. + example: ACa1b4c65ee0722712fab89867cb14eac7 + type: string + authToken: + description: Twilio Auth Token. + example: 160c024303f53049e1e060fd67ca6aefc + minLength: 1 + type: string + writeOnly: true + phoneNumberSid: + description: SID for specific phone number. + example: PN0674df0ecee0c9819bca0ff0bc0a159e + minLength: 1 + type: string + required: + - accountSid + - authToken + - phoneNumberSid + twitter_allOf: + description: | + To set up a Twitter integration, please follow the steps outlined in the [Twitter Setup Guide](https://docs.smooch.io/guide/twitter/#setup). + properties: + type: + default: twitter + description: The type of integration. + type: string + tier: + description: Your Twitter app’s tier, sandbox, premium or enterprise. + enum: + - sandbox + - premium + - enterprise + type: string + envName: + description: The Twitter dev environments label (required for sandbox and + premium tiers). + example: your_env_label + minLength: 1 + type: string + consumerKey: + description: The consumer key for your Twitter app. + example: your_consumer_key + minLength: 1 + type: string + consumerSecret: + description: The consumer key secret for your Twitter app. + example: your_consumer_secret + minLength: 1 + type: string + accessTokenKey: + description: The access token key obtained from your user via oauth. + example: your_access_token_key + minLength: 1 + type: string + writeOnly: true + accessTokenSecret: + description: The access token secret obtained from your user via oauth. + example: your_access_token_secret + minLength: 1 + type: string + required: + - acceessTokenKey + - accessTokenSecret + - consumerKey + - consumerSecret + - tier + viber_allOf: + description: | + To configure a Viber integration, acquire the Viber Public Account token from the user and call the Create Integration endpoint. + properties: + type: + default: viber + description: The type of integration. + type: string + token: + description: Viber Public Account token. + example: 445da6az1s345z78-dazcczb2542zv51a-e0vc5fva17480im9 + minLength: 1 + type: string + writeOnly: true + uri: + description: Unique URI of the Viber account. + readOnly: true + type: string + accountId: + description: Unique ID of the Viber account. + readOnly: true + type: string + required: + - token + web_allOf: + description: | + To configure a Web Messenger integration, acquire the required information and call the Create Integration endpoint. + properties: + type: + default: web + description: The type of integration. + type: string + brandColor: + default: 65758e + description: This color will be used in the messenger header and the button + or tab in idle state. Must be a 3 or 6-character hexadecimal color. + type: string + fixedIntroPane: + default: false + description: When true, the introduction pane will be pinned at the top + of the conversation instead of scrolling with it. + type: boolean + conversationColor: + default: 0099ff + description: This color will be used for customer messages, quick replies + and actions in the footer. Must be a 3 or 6-character hexadecimal color. + type: string + actionColor: + default: 0099ff + description: This color will be used for call-to-actions inside your messages. + Must be a 3 or 6-character hexadecimal color. + type: string + displayStyle: + default: button + description: Choose how the messenger will appear on your website. Must + be either button or tab. + type: string + buttonIconUrl: + description: With the button style Web Messenger, you have the option of + selecting your own button icon. The image must be at least 200 x 200 pixels + and must be in either JPG, PNG, or GIF format. + example: http://domain.com/images/avatar.png + nullable: true + type: string + buttonWidth: + default: "58" + description: With the button style Web Messenger, you have the option of + specifying the button width. + type: string + buttonHeight: + default: "58" + description: With the button style Web Messenger, you have the option of + specifying the button height. + type: string + integrationOrder: + description: Array of integration IDs, order will be reflected in the Web + Messenger. When set, only integrations from this list will be displayed + in the Web Messenger. If unset, all integrations will be displayed. + example: + - 59fc8466260f48003505228b + - 59d79780481d34002b7d3617 + items: + type: string + nullable: true + type: array + businessName: + description: A custom business name for the Web Messenger. + example: Kent Shop + type: string + businessIconUrl: + description: A custom business icon url for the Web Messenger. The image + must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF + format. + example: https://www.gravatar.com/image.jpg + type: string + backgroundImageUrl: + description: A background image url for the conversation. Image will be + tiled to fit the window. + example: https://a-beautiful-tile.png + type: string + originWhitelist: + description: | + A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. + The elements in the list should follow the serialized-origin format from RFC 6454: scheme "://" host [ ":" port ], where scheme is http or https. + example: + - https://yourdomain.com + items: + type: string + nullable: true + type: array + prechatCapture: + allOf: + - $ref: '#/components/schemas/prechatCapture' + description: Object whose properties can be set to specify the add-on’s + options. See the [guide](https://docs.smooch.io/guide/web-messenger/#prechat-capture) + to learn more about Prechat Capture. + canUserCreateMoreConversations: + description: Allows users to create more than one conversation on the web + messenger integration. + type: boolean + whatsapp_allOf: + description: | + To configure a WhatsApp integration, use your WhatsApp API Client connection information. Sunshine Conversations can provide WhatsApp API Client hosting for approved brands. See our [WhatsApp guide](https://docs.smooch.io/guide/whatsapp/#whatsapp-api-client) for more details on WhatsApp API Client hosting. + properties: + type: + default: whatsapp + description: The type of integration. + type: string + deploymentId: + description: The Id of the deployment. The integrationId and the appId will + be added to the deployment. Additionally, the deployment’s status will + be set to integrated. + example: 55c8d9758590aa1900b9b9aa + type: string + hsmFallbackLanguage: + default: en_US + description: Specify a fallback language to use when sending WhatsApp message + template using the short hand syntax. Defaults to en_US. See WhatsApp + documentation for more info. + nullable: true + type: string + accountId: + description: The business ID associated with the WhatsApp account. In combination + with accountManagementAccessToken, it’s used for Message Template Reconstruction. + example: your_whatsApp_account_id + nullable: true + type: string + accountManagementAccessToken: + description: An access token associated with the accountId used to query + the WhatsApp Account Management API. In combination with accountId, it’s + used for Message Template Reconstruction. + example: your_access_token + nullable: true + type: string + required: + - deploymentId + androidUpdate_allOf: + properties: + serverKey: + description: Your server key from the fcm console. + example: + minLength: 1 + nullable: true + type: string + writeOnly: true + senderId: + description: Your sender id from the fcm console. + example: + minLength: 1 + nullable: true + type: string + canUserCreateConversation: + description: Allows users to create more than one conversation on the android + integration. + type: boolean + iosUpdate_allOf: + properties: + certificate: + description: The binary of your APN certificate base64 encoded. + example: your_APN_certificate + minLength: 1 + nullable: true + type: string + writeOnly: true + password: + description: The password for your APN certificate. + example: your_APN_password + type: string + writeOnly: true + production: + description: The APN environment to connect to (Production, if true, or + Sandbox). Defaults to value inferred from certificate if not specified. + type: boolean + autoUpdateBadge: + description: Use the unread count of the conversation as the application + badge. + type: boolean + canUserCreateConversation: + description: Allows users to create more than one conversation on the iOS + integration. + type: boolean + mailgunUpdate_allOf: + properties: + hideUnsubscribeLink: + description: A boolean value indicating whether the unsubscribe link should + be omitted from outgoing emails. When enabled, it is expected that the + business is providing the user a way to unsubscribe by some other means. + By default, the unsubscribe link will be included in all outgoing emails. + type: boolean + fromAddress: + description: Email address to use as the From and Reply-To address if it + must be different from incomingAddress. Only use this option if the address + that you supply is configured to forward emails to the incomingAddress, + otherwise user replies will be lost. You must also make sure that the + domain is properly configured as a mail provider so as to not be flagged + as spam by the user’s email client. May be unset with null. + example: test@sandbox123.mailgun.org + minLength: 1 + nullable: true + type: string + messengerUpdate_allOf: + properties: + pageAccessToken: + description: A Facebook Page Access Token. + example: your_access_token + type: string + webUpdate_allOf: + description: | + To configure a Web Messenger integration, acquire the required information and call the Create Integration endpoint. + properties: + brandColor: + default: 65758e + description: This color will be used in the messenger header and the button + or tab in idle state. Must be a 3 or 6-character hexadecimal color. + type: string + fixedIntroPane: + default: false + description: When true, the introduction pane will be pinned at the top + of the conversation instead of scrolling with it. + type: boolean + conversationColor: + default: 0099ff + description: This color will be used for customer messages, quick replies + and actions in the footer. Must be a 3 or 6-character hexadecimal color. + type: string + actionColor: + default: 0099ff + description: This color will be used for call-to-actions inside your messages. + Must be a 3 or 6-character hexadecimal color. + type: string + displayStyle: + default: button + description: Choose how the messenger will appear on your website. Must + be either button or tab. + type: string + buttonIconUrl: + description: With the button style Web Messenger, you have the option of + selecting your own button icon. The image must be at least 200 x 200 pixels + and must be in either JPG, PNG, or GIF format. + nullable: true + type: string + buttonWidth: + default: "58" + description: With the button style Web Messenger, you have the option of + specifying the button width. + type: string + buttonHeight: + default: "58" + description: With the button style Web Messenger, you have the option of + specifying the button height. + type: string + integrationOrder: + description: Array of integration IDs, order will be reflected in the Web + Messenger. When set, only integrations from this list will be displayed + in the Web Messenger. If unset, all integrations will be displayed. + example: + - 59fc8466260f48003505228b + - 59d79780481d34002b7d3617 + items: + type: string + nullable: true + type: array + businessName: + description: A custom business name for the Web Messenger. + example: Kent Shop + type: string + businessIconUrl: + description: A custom business icon url for the Web Messenger. The image + must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF + format. + example: https://www.gravatar.com/image.jpg + type: string + backgroundImageUrl: + description: A background image url for the conversation. Image will be + tiled to fit the window. + example: https://a-beautiful-tile.png + type: string + originWhitelist: + description: | + A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. + The elements in the list should follow the serialized-origin format from RFC 6454: scheme "://" host [ ":" port ], where scheme is http or https. + items: + type: string + nullable: true + type: array + prechatCapture: + allOf: + - $ref: '#/components/schemas/prechatCapture' + description: Object whose properties can be set to specify the add-on’s + options. See the [guide](https://docs.smooch.io/guide/web-messenger/#prechat-capture) + to learn more about Prechat Capture. + canUserCreateConversation: + description: Allows users to create more than one conversation on the web + messenger integration. + type: boolean + whatsAppUpdate_allOf: + properties: + hsmFallbackLanguage: + default: en_US + description: Specify a fallback language to use when sending WhatsApp message + template using the short hand syntax. Defaults to en_US. See WhatsApp + documentation for more info. + nullable: true + type: string + accountId: + description: The business ID associated with the WhatsApp account. In combination + with accountManagementAccessToken, it’s used for Message Template Reconstruction. + example: your_whatsApp_account_id + nullable: true + type: string + accountManagementAccessToken: + description: An access token associated with the accountId used to query + the WhatsApp Account Management API. In combination with accountId, it’s + used for Message Template Reconstruction. + example: your_access_token + nullable: true + type: string + user_allOf: + properties: + signedUpAt: + allOf: + - $ref: '#/components/schemas/signedUpAt' + profile: + allOf: + - $ref: '#/components/schemas/profile' + metadata: + allOf: + - $ref: '#/components/schemas/metadata' + nullable: false + matchCriteriaMailgun_allOf: + description: The set of criteria used to determine the user's identity on a + third-party channel. + properties: + type: + default: mailgun + description: The channel type. + type: string + address: + description: The user’s email address. + example: steveb@channel5.com + type: string + subject: + default: New message from {appName} + description: May be specified to set the subject for the outgoing email. + type: string + required: + - address + matchCriteriaMessagebird_allOf: + description: The set of criteria used to determine the user's identity on a + third-party channel. + properties: + type: + default: messagebird + description: The channel type. + type: string + phoneNumber: + description: | + The user’s phone number. It must contain the + prefix and the country code. + Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. + Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. + example: +15550001234 + type: string + required: + - phoneNumber + matchCriteriaTwilio_allOf: + description: The set of criteria used to determine the user's identity on a + third-party channel. + properties: + type: + default: twilio + description: The channel type. + type: string + phoneNumber: + description: | + The user’s phone number. It must contain the + prefix and the country code. + Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. + Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. + example: +15550001234 + type: string + required: + - phoneNumber + matchCriteriaWhatsapp_allOf: + description: The set of criteria used to determine the user's identity on a + third-party channel. + properties: + type: + default: whatsapp + description: The channel type. + type: string + phoneNumber: + description: | + The user’s phone number. It must contain the + prefix and the country code. + Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. + Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. + example: +15550001234 + type: string + required: + - phoneNumber + Confirmation: + description: The confirmation options of the link request. + properties: + type: + description: The type of confirmation. + enum: + - immediate + - userActivity + - prompt + type: string + message: + allOf: + - $ref: '#/components/schemas/messagePost' + description: The message used to reach out to the user, if desired. Messages + sent via this method can only be of type text and image. If actions are + included they can only be of type link. The confirmation message will + not be added to the user’s conversation. + required: + - type + Target: + description: The target conversation to attach the client to. + properties: + conversationId: + description: The conversation ID of the target conversation. + example: 029c31f25a21b47effd7be90 + type: string + required: + - conversationId + referral_details: + description: Nested object containing additional information. + nullable: true + properties: + source: + description: The source of the referral - MESSENGER_CODE, ADS etc… + example: MESSENGER_CODE + type: string + type: + description: The type of referral, typically OPEN-THREAD. + example: OPEN-THREAD + type: string + adId: + description: If the referral came from an ad, this field will be present + with the ad’s Id. + example: "4216212847577" + nullable: true + type: string + conversationCreateEvent_allOf_payload: + description: The payload of the event. The contents of this object depend on + the type of event. + properties: + conversation: + allOf: + - $ref: '#/components/schemas/conversationTruncated' + description: The conversation that was created. + creationReason: + description: | + The reason why the conversation was created, if applicable. + * `linkRequest` - The conversation was created in order to generate a link request to transfer the user to a different channel. + * `message` - The conversation was created because a message was sent. + * `none` - The conversation was not created for a specific purpose. Used primarily when a conversation is created via the Create Conversation API. + * `notification` - The conversation was created by a call to the Notification API. + * `prechatCapture` - The conversation was created because the user completed a prechat capture form in the Web Messenger. + * `startConversation` - The conversation was created because of a call to the startConversation API on one of the SDK integrations, or a start conversation event was triggered from a messaging channel. + enum: + - linkRequest + - message + - none + - notification + - prechatCapture + - startConversation + type: string + source: + allOf: + - $ref: '#/components/schemas/sourceWebhook' + description: The source of the creation. + user: + allOf: + - $ref: '#/components/schemas/user' + description: The user associated with the conversation. Only present if + the created conversation was of type personal. For sdkGroup conversations, + the list of participants can be fetched using the List Participants API, + if required. + nullable: true + referral: + allOf: + - $ref: '#/components/schemas/referral' + description: Referral information, if applicable. + nullable: true + conversationCreateEvent_allOf: + properties: + payload: + $ref: '#/components/schemas/conversationCreateEvent_allOf_payload' + conversationMessageDeliveryPayload_message: + description: The message that was sent. + properties: + id: + description: A string representing the ID of the message. + type: string + conversationMessageDeliveryPayload_destination: + description: A nested object representing the destination of the message. + properties: + type: + description: An identifier for the channel to which a message was sent to. + May include one of "web", "ios", "android", "messenger", "viber", "telegram", + "wechat", "line", "twilio", "api", "notification", or any other channel. + type: string + integrationId: + description: Identifier indicating which integration the message was sent + to. + type: string + conversationMessageDeliveryPayload_externalMessages: + properties: + id: + description: A string representing the ID of the external message. + type: string + conversationMessageDeliveryChannelEvent_allOf: + properties: + payload: + $ref: '#/components/schemas/conversationMessageDeliveryPayload' + conversationMessageDeliveryFailureEvent_allOf: + properties: + payload: + allOf: + - $ref: '#/components/schemas/conversationMessageDeliveryPayload' + - properties: + error: + description: A nested object representing the error associated with + the delivery failure. + properties: + code: + description: A string representing the error code associated with + the error. + type: string + message: + description: The description associated with the error. + type: string + type: object + type: object + conversationMessageEvent_allOf_payload: + description: The payload of the event. The contents of this object depend on + the type of event. + properties: + conversation: + allOf: + - $ref: '#/components/schemas/conversationTruncated' + description: The conversation in which the message was sent. + message: + allOf: + - $ref: '#/components/schemas/message' + - properties: + author: + $ref: '#/components/schemas/authorWebhook' + type: object + description: The message that was sent. + recentNotifications: + description: Messages sent with the Notification API since the last user + message. + items: + $ref: '#/components/schemas/message' + type: array + conversationMessageEvent_allOf: + properties: + payload: + $ref: '#/components/schemas/conversationMessageEvent_allOf_payload' + conversationPostbackEvent_allOf_payload: + description: The payload of the event. The contents of this object depend on + the type of event. + properties: + postback: + allOf: + - $ref: '#/components/schemas/postbackWebhook' + description: The postback associated with the event. + conversation: + allOf: + - $ref: '#/components/schemas/conversationTruncated' + description: The conversation linked to the postback. + user: + allOf: + - $ref: '#/components/schemas/user' + description: The user that triggered the postback. + source: + allOf: + - $ref: '#/components/schemas/sourceWebhook' + description: The source of the postback. + conversationPostbackEvent_allOf: + properties: + payload: + $ref: '#/components/schemas/conversationPostbackEvent_allOf_payload' + activity_allOf: + properties: + source: + allOf: + - $ref: '#/components/schemas/sourceWebhook' + description: The source of the activity. + author: + $ref: '#/components/schemas/authorWebhook' + conversationReadEvent_allOf_payload: + description: The payload of the event. The contents of this object depend on + the type of event. + properties: + conversation: + allOf: + - $ref: '#/components/schemas/conversationTruncated' + description: The conversation in which the message was read. + activity: + allOf: + - $ref: '#/components/schemas/activity' + - properties: + type: + default: conversation:read + description: The type of activity. + type: string + type: object + description: The activity that was sent. + conversationReadEvent_allOf: + properties: + payload: + $ref: '#/components/schemas/conversationReadEvent_allOf_payload' + conversationTypingEvent_allOf_payload: + description: The payload of the event. The contents of this object depend on + the type of event. + properties: + conversation: + allOf: + - $ref: '#/components/schemas/conversationTruncated' + description: The conversation in which the activity was sent. + activity: + allOf: + - $ref: '#/components/schemas/activity' + - properties: + type: + description: The type of activity. + enum: + - typing:start + - typing:stop + type: string + type: object + description: The activity that was sent. + conversationTypingEvent_allOf: + properties: + payload: + $ref: '#/components/schemas/conversationTypingEvent_allOf_payload' + switchboardAcceptControl_allOf_payload: + description: The payload of the event. The contents of this object depend on + the type of event. + properties: + conversation: + allOf: + - $ref: '#/components/schemas/conversationTruncated' + description: The conversation from which the switchboard event was fired. + Will include an `activeSwitchboardIntegration` representing the integration + that has just accepted control. + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + switchboardAcceptControl_allOf: + properties: + payload: + $ref: '#/components/schemas/switchboardAcceptControl_allOf_payload' + switchboardAcceptControlFailure_allOf_payload: + description: The payload of the event. The contents of this object depend on + the type of event. + properties: + error: + description: Object containing details of what went wrong. + type: object + conversation: + allOf: + - $ref: '#/components/schemas/conversationTruncated' + description: The conversation from which the switchboard event was fired. + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + switchboardAcceptControlFailure_allOf: + properties: + payload: + $ref: '#/components/schemas/switchboardAcceptControlFailure_allOf_payload' + switchboardOfferControl_allOf_payload: + description: The payload of the event. The contents of this object depend on + the type of event. + properties: + conversation: + allOf: + - $ref: '#/components/schemas/conversationTruncated' + description: The conversation from which the switchboard event was fired. + On success, the payload will include an `activeSwitchboardIntegration`, + representing the integration from which control is being offered, and + a `pendingSwitchboardIntegration`, representing the integration being + offered control. + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + switchboardOfferControl_allOf: + properties: + payload: + $ref: '#/components/schemas/switchboardOfferControl_allOf_payload' + switchboardPassControl_allOf_payload: + description: The payload of the event. The contents of this object depend on + the type of event. + properties: + conversation: + allOf: + - $ref: '#/components/schemas/conversationTruncated' + description: The conversation from which the switchboard event was fired. + On success, the payload will include an `activeSwitchboardIntegration`, + representing the switchboard integration that is now in control of the + conversation. + metadata: + description: "Flat object containing custom properties. Strings, numbers\ + \ and booleans \nare the only supported format that can be passed to metadata.\n\ + The metadata is limited to 4KB in size.\n" + example: + lang: en-ca + nullable: true + type: object + switchboardPassControl_allOf: + properties: + payload: + $ref: '#/components/schemas/switchboardPassControl_allOf_payload' + userMergeEvent_allOf_payload_mergedUsers: + description: Contains information about the users that were merged together. + properties: + surviving: + allOf: + - $ref: '#/components/schemas/user' + description: The user that now represents the merged user object. + discarded: + allOf: + - $ref: '#/components/schemas/user' + description: The user that was unified into the surviving user object. + userMergeEvent_allOf_payload_mergedConversations: + description: Contains information about the conversations that were merged together + as a result of the operation, if applicable. If no conversations were merged, + this property is omitted. + nullable: true + properties: + surviving: + allOf: + - $ref: '#/components/schemas/conversationTruncated' + description: The conversation that now represents the merged conversation + object. + discarded: + allOf: + - $ref: '#/components/schemas/conversationTruncated' + description: The conversation that was unified into the surviving conversation + object. + userMergeEvent_allOf_payload: + description: The payload of the event. The contents of this object depend on + the type of event. + properties: + mergedUsers: + $ref: '#/components/schemas/userMergeEvent_allOf_payload_mergedUsers' + mergedConversations: + $ref: '#/components/schemas/userMergeEvent_allOf_payload_mergedConversations' + discardedMetadata: + allOf: + - $ref: '#/components/schemas/metadata' + description: A flat object with the set of metadata properties that were + discarded when merging the two users. This should contain values only + if the combined metadata fields exceed the 4KB limit. + nullable: true + userMergeEvent_allOf: + properties: + payload: + $ref: '#/components/schemas/userMergeEvent_allOf_payload' + securitySchemes: + basicAuth: + scheme: basic + type: http + bearerAuth: + bearerFormat: JWT + scheme: bearer + type: http +x-tagGroups: +- name: Account Provisioning + tags: + - Apps + - App Keys +- name: Attachments + tags: + - Attachments +- name: Conversations + tags: + - Conversations + - Participants + - Messages + - Activities + - Switchboard Actions +- name: Integrations + tags: + - Integrations + - Webhooks + - CustomIntegrationApiKeys +- name: Switchboards + tags: + - Switchboards + - Switchboard Integrations +- name: Users + tags: + - Users + - Clients +- name: Changelog + tags: + - Changelog +x-webhooks: + Webhook Event: + post: + tags: + - Webhooks + description: "A webhook payload contains an array of events, which may or may\ + \ not originate from the same user\nor conversation. When processing webhook\ + \ payloads, your application should take care to process\neach event in the\ + \ array. \n" + summary: Webhook Events + operationId: eventWebhooks + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + app: + $ref: '#/components/schemas/appSubSchema' + webhook: + $ref: '#/components/schemas/webhookSubSchema' + events: + type: array + description: The list of events that occurred. + items: + anyOf: + - $ref: '#/components/schemas/conversationCreateEvent' + - $ref: '#/components/schemas/conversationMessageDeliveryChannelEvent' + - $ref: '#/components/schemas/conversationMessageDeliveryFailureEvent' + - $ref: '#/components/schemas/conversationMessageDeliveryUserEvent' + - $ref: '#/components/schemas/conversationMessageEvent' + - $ref: '#/components/schemas/conversationPostbackEvent' + - $ref: '#/components/schemas/conversationReadEvent' + - $ref: '#/components/schemas/conversationTypingEvent' + - $ref: '#/components/schemas/switchboardAcceptControl' + - $ref: '#/components/schemas/switchboardAcceptControlFailure' + - $ref: '#/components/schemas/switchboardOfferControl' + - $ref: '#/components/schemas/switchboardOfferControlFailure' + - $ref: '#/components/schemas/switchboardPassControl' + - $ref: '#/components/schemas/switchboardPassControlFailure' + - $ref: '#/components/schemas/userMergeEvent' + responses: + "200": + description: Ok + diff --git a/build.gradle b/build.gradle index 0c8814db..de2f1210 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,11 @@ +apply plugin: 'maven-publish' + apply plugin: 'java' apply plugin: 'idea' apply plugin: 'eclipse' -group = 'io.smooch' -version = '5.29.0' +group = 'com.zendesk' +version = '9.0.0' buildscript { repositories { @@ -31,10 +33,10 @@ bintray { override = true pkg { repo = 'maven' - name = 'smooch-api' + name = 'sunshine-conversations-java-client' userOrg = 'smoochorg' - desc = 'Smooch' - websiteUrl = 'http://smooch.io' + desc = 'Sunshine Conversations' + websiteUrl = 'https://smooch.io' } } @@ -53,11 +55,11 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'com.github.dcendents.android-maven' android { - compileSdkVersion 25 - buildToolsVersion '25.0.2' + compileSdkVersion 23 + buildToolsVersion '23.0.2' defaultConfig { minSdkVersion 14 - targetSdkVersion 25 + targetSdkVersion 23 } compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 @@ -105,13 +107,12 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 install { repositories.mavenInstaller { - pom.artifactId = 'api' + pom.artifactId = 'sunshine-conversations-client' } } @@ -121,11 +122,38 @@ if(hasProperty('target') && target == 'android') { } } +ext { + swagger_annotations_version = "1.5.22" + jackson_version = "2.10.3" + jackson_databind_version = "2.10.3" + jackson_databind_nullable_version = "0.2.1" + threetenbp_version = "2.9.10" + resteasy_version = "3.1.3.Final" + jodatime_version = "2.9.9" + junit_version = "4.13" +} + dependencies { - compile 'io.swagger:swagger-annotations:1.5.8' - compile 'com.squareup.okhttp:okhttp:2.7.5' - compile 'com.squareup.okhttp:logging-interceptor:2.7.5' - compile 'com.google.code.gson:gson:2.6.2' - compile 'joda-time:joda-time:2.9.3' - testCompile 'junit:junit:4.12' + compile "io.swagger:swagger-annotations:$swagger_annotations_version" + compile "com.google.code.findbugs:jsr305:3.0.2" + compile "org.jboss.resteasy:resteasy-client:$resteasy_version" + compile "org.jboss.resteasy:resteasy-multipart-provider:$resteasy_version" + compile "org.jboss.resteasy:resteasy-jackson2-provider:$resteasy_version" + compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" + compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version" + compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" + compile "joda-time:joda-time:$jodatime_version" + compile "com.brsanthu:migbase64:2.2" + testCompile "junit:junit:$junit_version" +} + +publishing { + publications { + maven(MavenPublication) { + from components.java + } + } } diff --git a/build.sbt b/build.sbt index ffaf8197..76c617a1 100644 --- a/build.sbt +++ b/build.sbt @@ -1,20 +1,26 @@ lazy val root = (project in file(".")). settings( - organization := "io.smooch", - name := "api", - version := "5.29.0", + organization := "com.zendesk", + name := "sunshine-conversations-client", + version := "9.0.0", scalaVersion := "2.11.4", scalacOptions ++= Seq("-feature"), javacOptions in compile ++= Seq("-Xlint:deprecation"), publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.8", - "com.squareup.okhttp" % "okhttp" % "2.7.5", - "com.squareup.okhttp" % "logging-interceptor" % "2.7.5", - "com.google.code.gson" % "gson" % "2.6.2", - "joda-time" % "joda-time" % "2.9.3" % "compile", - "junit" % "junit" % "4.12" % "test", + "io.swagger" % "swagger-annotations" % "1.5.22" % "compile", + "org.jboss.resteasy" % "resteasy-client" % "3.1.3.Final" % "compile", + "org.jboss.resteasy" % "resteasy-multipart-provider" % "3.1.3.Final" % "compile", + "org.jboss.resteasy" % "resteasy-jackson2-provider" % "3.1.3.Final" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile", + "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.9.10" % "compile", + "joda-time" % "joda-time" % "2.9.9" % "compile", + "com.brsanthu" % "migbase64" % "2.2" % "compile", + "junit" % "junit" % "4.13" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" ) ) diff --git a/docs/AcceptControlBody.md b/docs/AcceptControlBody.md new file mode 100644 index 00000000..903c3052 --- /dev/null +++ b/docs/AcceptControlBody.md @@ -0,0 +1,12 @@ + + +# AcceptControlBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | **Object** | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. The metadata object will be included in the `switchboard:acceptControl` and `switchboard:acceptControl:failure` webhooks. | [optional] + + + diff --git a/docs/Action.md b/docs/Action.md index 5f26b30e..ebf0f1b1 100644 --- a/docs/Action.md +++ b/docs/Action.md @@ -1,22 +1,14 @@ -# Action -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **String** | The action type. See [**ActionTypeEnum**](Enums.md#ActionTypeEnum) for available values. | -**text** | **String** | The button text. | -**payload** | **String** | The payload to be sent with the resulting webhook. Required for *postback* and *reply* actions. | [optional] -**metadata** | **Object** | Flat JSON object containing any custom properties associated with the action. | [optional] -**amount** | **Integer** | The amount being charged. It needs to be specified in cents and is an integer. Required for *buy* actions. | [optional] -**currency** | **String** | The currency of the amount being charged (USD, CAD, etc.). | [optional] -**_default** | **Boolean** | Flag indicating if the message action is the default for a message item in Facebook Messenger. | [optional] -**iconUrl** | **String** | An icon to render next to the reply option (Facebook Messenger and Web Messenger only). | [optional] -**uri** | **String** | The action URI. This is the link that will be used in the clients when clicking the button. Required for *link* and *webview* actions. | [optional] -**fallback** | **String** | The webview action fallback uri. This is the link that will be used in clients that do not support webviews. Required for *webview* actions. | [optional] -**size** | **String** | The size used to display the webview. Allowed values are [\"compact\", \"tall\", \"full\"]. (Optional) Used for *webview* actions. See [**ActionSizeEnum**](Enums.md#ActionSizeEnum) for available values. | [optional] -**extraChannelOptions** | **Object** | Extra options to pass directly to the channel API. See [Extra Channel Options](https://docs.smooch.io/rest#extra-channel-options-schema) | [optional] -**openOnReceive** | **Boolean** | Flag indicating if the webview should open automatically. Only one action per message can be set to true. Currently only supported on the Web Messenger. | [optional] +# Interface Action +## Implementing Classes + +* Buy +* Link +* LocationRequest +* Postback +* Reply +* Webview diff --git a/docs/ActionSubset.md b/docs/ActionSubset.md new file mode 100644 index 00000000..739f670a --- /dev/null +++ b/docs/ActionSubset.md @@ -0,0 +1,12 @@ + + +# Interface ActionSubset + +## Implementing Classes + +* Buy +* Link +* Postback +* Webview + + diff --git a/docs/ActivitiesApi.md b/docs/ActivitiesApi.md new file mode 100644 index 00000000..1e91c6dd --- /dev/null +++ b/docs/ActivitiesApi.md @@ -0,0 +1,89 @@ +# ActivitiesApi + +All URIs are relative to *https://api.smooch.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**postActivity**](ActivitiesApi.md#postActivity) | **POST** /v2/apps/{appId}/conversations/{conversationId}/activity | Post Activity + + + +## postActivity + +> Object postActivity(activityPost, appId, conversationId) + +Post Activity + +Notify Sunshine Conversations of different conversation activities. Supported activity types are: * Typing activity * Conversation read event + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.ActivitiesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + ActivitiesApi apiInstance = new ActivitiesApi(defaultClient); + ActivityPost activityPost = {"author":{"type":"user","userId":"5963c0d619a30a2e00de36b8"},"type":"conversation:read"}; // ActivityPost | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation. + // Add required body parameters + + try { + Object result = apiInstance.postActivity(activityPost, appId, conversationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ActivitiesApi#postActivity"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **activityPost** | [**ActivityPost**](ActivityPost.md)| | + **appId** | **String**| Identifies the app. | + **conversationId** | **String**| Identifies the conversation. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | + diff --git a/docs/Activity.md b/docs/Activity.md new file mode 100644 index 00000000..c1d0bbfe --- /dev/null +++ b/docs/Activity.md @@ -0,0 +1,24 @@ + + +# Activity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**TypeEnum**](#TypeEnum) | If the author type is `user`, only `conversation:read` is supported. | [optional] +**source** | [**SourceWebhook**](SourceWebhook.md) | The source of the activity. | [optional] +**author** | [**AuthorWebhook**](AuthorWebhook.md) | | [optional] + + + +## Enum: TypeEnum + +Name | Value +---- | ----- +CONVERSATION_READ | "conversation:read" +TYPING_START | "typing:start" +TYPING_STOP | "typing:stop" + + + diff --git a/docs/ActivityAllOf.md b/docs/ActivityAllOf.md new file mode 100644 index 00000000..263fcbe6 --- /dev/null +++ b/docs/ActivityAllOf.md @@ -0,0 +1,13 @@ + + +# ActivityAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source** | [**SourceWebhook**](SourceWebhook.md) | The source of the activity. | [optional] +**author** | [**AuthorWebhook**](AuthorWebhook.md) | | [optional] + + + diff --git a/docs/ActivityPost.md b/docs/ActivityPost.md new file mode 100644 index 00000000..75e3fd60 --- /dev/null +++ b/docs/ActivityPost.md @@ -0,0 +1,23 @@ + + +# ActivityPost + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**author** | [**Author**](Author.md) | The author of the activity. | +**type** | [**TypeEnum**](#TypeEnum) | If the author type is `user`, only `conversation:read` is supported. | + + + +## Enum: TypeEnum + +Name | Value +---- | ----- +CONVERSATION_READ | "conversation:read" +TYPING_START | "typing:start" +TYPING_STOP | "typing:stop" + + + diff --git a/docs/ActivityPostAllOf.md b/docs/ActivityPostAllOf.md new file mode 100644 index 00000000..14fae9ac --- /dev/null +++ b/docs/ActivityPostAllOf.md @@ -0,0 +1,12 @@ + + +# ActivityPostAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**author** | [**Author**](Author.md) | The author of the activity. | [optional] + + + diff --git a/docs/ActivityTypes.md b/docs/ActivityTypes.md new file mode 100644 index 00000000..f9ead58d --- /dev/null +++ b/docs/ActivityTypes.md @@ -0,0 +1,22 @@ + + +# ActivityTypes + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**TypeEnum**](#TypeEnum) | If the author type is `user`, only `conversation:read` is supported. | [optional] + + + +## Enum: TypeEnum + +Name | Value +---- | ----- +CONVERSATION_READ | "conversation:read" +TYPING_START | "typing:start" +TYPING_STOP | "typing:stop" + + + diff --git a/docs/Android.md b/docs/Android.md new file mode 100644 index 00000000..b18a0af8 --- /dev/null +++ b/docs/Android.md @@ -0,0 +1,15 @@ + + +# Android + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**serverKey** | **String** | Your server key from the fcm console. | [optional] +**senderId** | **String** | Your sender id from the fcm console. | [optional] +**canUserCreateMoreConversations** | **Boolean** | Allows users to create more than one conversation on the android integration. | [optional] + + + diff --git a/docs/AndroidAllOf.md b/docs/AndroidAllOf.md new file mode 100644 index 00000000..cb30ce70 --- /dev/null +++ b/docs/AndroidAllOf.md @@ -0,0 +1,15 @@ + + +# AndroidAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**serverKey** | **String** | Your server key from the fcm console. | [optional] +**senderId** | **String** | Your sender id from the fcm console. | [optional] +**canUserCreateMoreConversations** | **Boolean** | Allows users to create more than one conversation on the android integration. | [optional] + + + diff --git a/docs/AndroidUpdate.md b/docs/AndroidUpdate.md new file mode 100644 index 00000000..a397e4ac --- /dev/null +++ b/docs/AndroidUpdate.md @@ -0,0 +1,19 @@ + + +# AndroidUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**displayName** | **String** | A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`. | [optional] +**serverKey** | **String** | Your server key from the fcm console. | [optional] +**senderId** | **String** | Your sender id from the fcm console. | [optional] +**canUserCreateConversation** | **Boolean** | Allows users to create more than one conversation on the android integration. | [optional] + + +## Implemented Interfaces + +* IntegrationUpdate + + diff --git a/docs/AndroidUpdateAllOf.md b/docs/AndroidUpdateAllOf.md new file mode 100644 index 00000000..76786e56 --- /dev/null +++ b/docs/AndroidUpdateAllOf.md @@ -0,0 +1,14 @@ + + +# AndroidUpdateAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**serverKey** | **String** | Your server key from the fcm console. | [optional] +**senderId** | **String** | Your sender id from the fcm console. | [optional] +**canUserCreateConversation** | **Boolean** | Allows users to create more than one conversation on the android integration. | [optional] + + + diff --git a/docs/ApiKey.md b/docs/ApiKey.md new file mode 100644 index 00000000..dc9a59ee --- /dev/null +++ b/docs/ApiKey.md @@ -0,0 +1,15 @@ + + +# ApiKey + +The integration key. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the API key, used when signing JWTs or accessing the API using Basic Authentication. | [optional] +**displayName** | **String** | The name of the API key. | [optional] +**secret** | **String** | The secret of the API key, used when signing JWTs or accessing the API using Basic Authentication | [optional] + + + diff --git a/docs/App.md b/docs/App.md index d0fbf2cd..aa111a36 100644 --- a/docs/App.md +++ b/docs/App.md @@ -1,14 +1,15 @@ + # App ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **String** | The app's ID. | -**appToken** | **String** | The appToken, used to initialize the Web, iOS and Android clients and to make calls to the app user facing API. | -**name** | **String** | The app's name. | +**id** | **String** | A canonical ID that can be used to retrieve the Sunshine Conversations app. | [optional] +**displayName** | **String** | The friendly name of the app. | [optional] **settings** | [**AppSettings**](AppSettings.md) | | [optional] -**metadata** | **Object** | Flat JSON object containing any custom properties associated with the app. | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] diff --git a/docs/AppApi.md b/docs/AppApi.md deleted file mode 100644 index 9b7f8563..00000000 --- a/docs/AppApi.md +++ /dev/null @@ -1,724 +0,0 @@ -# AppApi - -All URIs are relative to *https://api.smooch.io* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createApp**](AppApi.md#createApp) | **POST** /v1.1/apps | -[**createSecretKey**](AppApi.md#createSecretKey) | **POST** /v1.1/apps/{appId}/keys | -[**deleteApp**](AppApi.md#deleteApp) | **DELETE** /v1.1/apps/{appId} | -[**deleteSecretKey**](AppApi.md#deleteSecretKey) | **DELETE** /v1.1/apps/{appId}/keys/{keyId} | -[**getApp**](AppApi.md#getApp) | **GET** /v1.1/apps/{appId} | -[**getAppJwt**](AppApi.md#getAppJwt) | **GET** /v1.1/apps/{appId}/keys/{keyId}/jwt | -[**getSdkIds**](AppApi.md#getSdkIds) | **GET** /v1.1/apps/{appId}/sdks | -[**getSecretKey**](AppApi.md#getSecretKey) | **GET** /v1.1/apps/{appId}/keys/{keyId} | -[**listApps**](AppApi.md#listApps) | **GET** /v1.1/apps | -[**listSecretKeys**](AppApi.md#listSecretKeys) | **GET** /v1.1/apps/{appId}/keys | -[**updateApp**](AppApi.md#updateApp) | **PUT** /v1.1/apps/{appId} | - - - -# **createApp** -> AppResponse createApp(appCreateBody) - - - -Create a new app. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppApi apiInstance = new AppApi(); -AppCreate appCreateBody = new AppCreate(); // AppCreate | Body for a createApp request. -try { - AppResponse result = apiInstance.createApp(appCreateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppApi#createApp"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appCreateBody** | [**AppCreate**](AppCreate.md)| Body for a createApp request. | - -### Return type - -[**AppResponse**](AppResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **createSecretKey** -> SecretKeyResponse createSecretKey(appId, secretKeyCreateBody) - - - -Create a secret key for the specified app. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppApi apiInstance = new AppApi(); -String appId = "appId_example"; // String | Identifies the app. -SecretKeyCreate secretKeyCreateBody = new SecretKeyCreate(); // SecretKeyCreate | Body for a createSecretKey request. -try { - SecretKeyResponse result = apiInstance.createSecretKey(appId, secretKeyCreateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppApi#createSecretKey"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **secretKeyCreateBody** | [**SecretKeyCreate**](SecretKeyCreate.md)| Body for a createSecretKey request. | - -### Return type - -[**SecretKeyResponse**](SecretKeyResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **deleteApp** -> deleteApp(appId) - - - -Delete the specified app. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppApi apiInstance = new AppApi(); -String appId = "appId_example"; // String | Identifies the app. -try { - apiInstance.deleteApp(appId); -} catch (ApiException e) { - System.err.println("Exception when calling AppApi#deleteApp"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **deleteSecretKey** -> deleteSecretKey(appId, keyId) - - - -Delete the specified secret key. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppApi apiInstance = new AppApi(); -String appId = "appId_example"; // String | Identifies the app. -String keyId = "keyId_example"; // String | Identifies the secret key. -try { - apiInstance.deleteSecretKey(appId, keyId); -} catch (ApiException e) { - System.err.println("Exception when calling AppApi#deleteSecretKey"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **keyId** | **String**| Identifies the secret key. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getApp** -> AppResponse getApp(appId) - - - -Get the specified app. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppApi apiInstance = new AppApi(); -String appId = "appId_example"; // String | Identifies the app. -try { - AppResponse result = apiInstance.getApp(appId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppApi#getApp"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - -### Return type - -[**AppResponse**](AppResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getAppJwt** -> JwtResponse getAppJwt(appId, keyId) - - - -Get an app-scoped JWT for the specified secret key. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppApi apiInstance = new AppApi(); -String appId = "appId_example"; // String | Identifies the app. -String keyId = "keyId_example"; // String | Identifies the secret key. -try { - JwtResponse result = apiInstance.getAppJwt(appId, keyId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppApi#getAppJwt"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **keyId** | **String**| Identifies the secret key. | - -### Return type - -[**JwtResponse**](JwtResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getSdkIds** -> GetSdkIdsResponse getSdkIds(appId) - - - -Retrieve the IDs of the three SDK integrations (`android`, `ios`, and `web`) for the specified app, to be used when initializing the SDKs. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppApi apiInstance = new AppApi(); -String appId = "appId_example"; // String | Identifies the app. -try { - GetSdkIdsResponse result = apiInstance.getSdkIds(appId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppApi#getSdkIds"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - -### Return type - -[**GetSdkIdsResponse**](GetSdkIdsResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getSecretKey** -> SecretKeyResponse getSecretKey(appId, keyId) - - - -Get the specified secret key. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppApi apiInstance = new AppApi(); -String appId = "appId_example"; // String | Identifies the app. -String keyId = "keyId_example"; // String | Identifies the secret key. -try { - SecretKeyResponse result = apiInstance.getSecretKey(appId, keyId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppApi#getSecretKey"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **keyId** | **String**| Identifies the secret key. | - -### Return type - -[**SecretKeyResponse**](SecretKeyResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **listApps** -> ListAppsResponse listApps(limit, offset, serviceAccountId) - - - -List all apps configured. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppApi apiInstance = new AppApi(); -Integer limit = 25; // Integer | The number of records to return. -Integer offset = 0; // Integer | The number of initial records to skip before picking records to return. -String serviceAccountId = ""; // String | The service account ID for which to list apps. -try { - ListAppsResponse result = apiInstance.listApps(limit, offset, serviceAccountId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppApi#listApps"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **Integer**| The number of records to return. | [optional] [default to 25] - **offset** | **Integer**| The number of initial records to skip before picking records to return. | [optional] [default to 0] - **serviceAccountId** | **String**| The service account ID for which to list apps. | [optional] [default to ] - -### Return type - -[**ListAppsResponse**](ListAppsResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **listSecretKeys** -> ListSecretKeysResponse listSecretKeys(appId) - - - -List the secret keys for the specified app. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppApi apiInstance = new AppApi(); -String appId = "appId_example"; // String | Identifies the app. -try { - ListSecretKeysResponse result = apiInstance.listSecretKeys(appId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppApi#listSecretKeys"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - -### Return type - -[**ListSecretKeysResponse**](ListSecretKeysResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **updateApp** -> AppResponse updateApp(appId, appUpdateBody) - - - -Update the specified app. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppApi apiInstance = new AppApi(); -String appId = "appId_example"; // String | Identifies the app. -AppUpdate appUpdateBody = new AppUpdate(); // AppUpdate | Body for an updateApp request. -try { - AppResponse result = apiInstance.updateApp(appId, appUpdateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppApi#updateApp"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **appUpdateBody** | [**AppUpdate**](AppUpdate.md)| Body for an updateApp request. | - -### Return type - -[**AppResponse**](AppResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - diff --git a/docs/AppCreate.md b/docs/AppCreate.md deleted file mode 100644 index 31b4523a..00000000 --- a/docs/AppCreate.md +++ /dev/null @@ -1,12 +0,0 @@ - -# AppCreate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **String** | The app's name. | -**settings** | [**AppSettings**](AppSettings.md) | | [optional] -**metadata** | **Object** | Flat JSON object containing any custom properties associated with the app. | [optional] - - - diff --git a/docs/AppCreateBody.md b/docs/AppCreateBody.md new file mode 100644 index 00000000..dbad2f5d --- /dev/null +++ b/docs/AppCreateBody.md @@ -0,0 +1,14 @@ + + +# AppCreateBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**displayName** | **String** | The friendly name of the app. | +**settings** | [**AppSettings**](AppSettings.md) | | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] + + + diff --git a/docs/AppKey.md b/docs/AppKey.md new file mode 100644 index 00000000..696c2f06 --- /dev/null +++ b/docs/AppKey.md @@ -0,0 +1,14 @@ + + +# AppKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the API key, used when signing JWTs or accessing the API using Basic Authentication. | [optional] +**displayName** | **String** | The name of the API key. | [optional] +**secret** | **String** | The secret of the API key, used when signing JWTs or accessing the API using Basic Authentication | [optional] + + + diff --git a/docs/JwtResponse.md b/docs/AppKeyCreateBody.md similarity index 65% rename from docs/JwtResponse.md rename to docs/AppKeyCreateBody.md index cb0a45d3..fd07b22d 100644 --- a/docs/JwtResponse.md +++ b/docs/AppKeyCreateBody.md @@ -1,10 +1,12 @@ -# JwtResponse + +# AppKeyCreateBody ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**jwt** | **String** | The JWT. | [optional] +**displayName** | **String** | | diff --git a/docs/AppKeyListResponse.md b/docs/AppKeyListResponse.md new file mode 100644 index 00000000..378c0f3b --- /dev/null +++ b/docs/AppKeyListResponse.md @@ -0,0 +1,12 @@ + + +# AppKeyListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**keys** | [**List<AppKey>**](AppKey.md) | List of returned keys. | [optional] + + + diff --git a/docs/DeploymentResponse.md b/docs/AppKeyResponse.md similarity index 55% rename from docs/DeploymentResponse.md rename to docs/AppKeyResponse.md index 09a15e16..3bb56575 100644 --- a/docs/DeploymentResponse.md +++ b/docs/AppKeyResponse.md @@ -1,10 +1,12 @@ -# DeploymentResponse + +# AppKeyResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**deployment** | [**Deployment**](Deployment.md) | The deployment. | +**key** | [**AppKey**](AppKey.md) | The created key object. | [optional] diff --git a/docs/AppKeysApi.md b/docs/AppKeysApi.md new file mode 100644 index 00000000..e59d108f --- /dev/null +++ b/docs/AppKeysApi.md @@ -0,0 +1,324 @@ +# AppKeysApi + +All URIs are relative to *https://api.smooch.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createAppKey**](AppKeysApi.md#createAppKey) | **POST** /v2/apps/{appId}/keys | Create App Key +[**deleteAppKey**](AppKeysApi.md#deleteAppKey) | **DELETE** /v2/apps/{appId}/keys/{keyId} | Delete App Key +[**getAppKey**](AppKeysApi.md#getAppKey) | **GET** /v2/apps/{appId}/keys/{keyId} | Get App Key +[**listAppKeys**](AppKeysApi.md#listAppKeys) | **GET** /v2/apps/{appId}/keys | List App Keys + + + +## createAppKey + +> AppKeyResponse createAppKey(appKeyCreateBody, appId) + +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. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.AppKeysApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + AppKeysApi apiInstance = new AppKeysApi(defaultClient); + AppKeyCreateBody appKeyCreateBody = new AppKeyCreateBody(); // AppKeyCreateBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + // Add required body parameters + + try { + AppKeyResponse result = apiInstance.createAppKey(appKeyCreateBody, appId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AppKeysApi#createAppKey"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appKeyCreateBody** | [**AppKeyCreateBody**](AppKeyCreateBody.md)| | + **appId** | **String**| Identifies the app. | + +### Return type + +[**AppKeyResponse**](AppKeyResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | + + +## deleteAppKey + +> Object deleteAppKey(appId, keyId) + +Delete App Key + +Removes an API key. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.AppKeysApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + AppKeysApi apiInstance = new AppKeysApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String keyId = "int_5d8cff3cd55b040010928b5b"; // String | The id of the key. + // Add required body parameters + + try { + Object result = apiInstance.deleteAppKey(appId, keyId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AppKeysApi#deleteAppKey"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **keyId** | **String**| The id of the key. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | App not found | - | + + +## getAppKey + +> AppKeyResponse getAppKey(appId, keyId) + +Get App Key + +Returns an API key. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.AppKeysApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + AppKeysApi apiInstance = new AppKeysApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String keyId = "int_5d8cff3cd55b040010928b5b"; // String | The id of the key. + // Add required body parameters + + try { + AppKeyResponse result = apiInstance.getAppKey(appId, keyId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AppKeysApi#getAppKey"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **keyId** | **String**| The id of the key. | + +### Return type + +[**AppKeyResponse**](AppKeyResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Not Found | - | + + +## listAppKeys + +> AppKeyListResponse listAppKeys(appId) + +List App Keys + +Lists all API keys for a given app. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.AppKeysApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + AppKeysApi apiInstance = new AppKeysApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + // Add required body parameters + + try { + AppKeyListResponse result = apiInstance.listAppKeys(appId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AppKeysApi#listAppKeys"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + +### Return type + +[**AppKeyListResponse**](AppKeyListResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | + diff --git a/docs/AppListFilter.md b/docs/AppListFilter.md new file mode 100644 index 00000000..4bb426dd --- /dev/null +++ b/docs/AppListFilter.md @@ -0,0 +1,12 @@ + + +# AppListFilter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**serviceAccountId** | **String** | When specified, lists only the apps that the service account has access to. | [optional] + + + diff --git a/docs/AppListResponse.md b/docs/AppListResponse.md new file mode 100644 index 00000000..b8aabd8e --- /dev/null +++ b/docs/AppListResponse.md @@ -0,0 +1,14 @@ + + +# AppListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**apps** | [**List<App>**](App.md) | List of returned apps. | [optional] +**meta** | [**Meta**](Meta.md) | | [optional] +**links** | [**Links**](Links.md) | | [optional] + + + diff --git a/docs/AppResponse.md b/docs/AppResponse.md index 91b94b2b..8286ae75 100644 --- a/docs/AppResponse.md +++ b/docs/AppResponse.md @@ -1,7 +1,9 @@ + # AppResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **app** | [**App**](App.md) | The app. | [optional] diff --git a/docs/AppSettings.md b/docs/AppSettings.md index cb7b4f5e..c4652431 100644 --- a/docs/AppSettings.md +++ b/docs/AppSettings.md @@ -1,14 +1,20 @@ + # AppSettings +Customizable app settings. ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**maskCreditCardNumbers** | **Boolean** | Flag specifying whether credit card numbers will be automatically masked if sent through Smooch. | [optional] -**useAnimalNames** | **Boolean** | Flag specifying whether animal names should be used for anonymous users. | [optional] -**conversationRetentionSeconds** | **Integer** | Number of seconds of inactivity before a conversation’s messages will be automatically deleted. | [optional] -**echoPostback** | **Boolean** | A boolean specifying whether a message should be added to the conversation history when a postback button is clicked. | [optional] -**ignoreAutoConversationStart** | **Boolean** | A boolean specifying whether a non message event coming from a social channel will trigger a start conversation event and count as an active user conversation (AUC).<br>**Note:** Calling *startConversation()* (or equivalent) from the Android-, iOS- or Web-SDK will count as an AUC, regardless of the value of this setting. | [optional] +**conversationRetentionSeconds** | **Integer** | Number of seconds of inactivity before a conversation’s messages will be automatically deleted. See [Conversation Retention Seconds](https://docs.smooch.io/rest/#conversation-retention-seconds) for more information. | [optional] +**maskCreditCardNumbers** | **Boolean** | A boolean specifying whether credit card numbers should be masked when sent through Sunshine Conversations. | [optional] +**useAnimalNames** | **Boolean** | A boolean specifying whether animal names should be used for unnamed users. See the [user naming guide](https://docs.smooch.io/guide/receiving-messages/#message-author-name) for details. | [optional] +**echoPostback** | **Boolean** | A boolean specifying whether a message should be added to the conversation history when a postback button is clicked. See [Echo Postbacks](https://docs.smooch.io/rest/#echo-postbacks) for more information. | [optional] +**ignoreAutoConversationStart** | **Boolean** | A boolean specifying whether a non message event coming from a channel will trigger a [start conversation](https://docs.smooch.io/rest/#conversation-events) event and count as a monthly active user (MAU). <aside class=\"notice\">Calling <code>startConversation()</code> (or equivalent) from the Android, iOS or Web SDK will count as a MAU, regardless of the value of this setting.</aside> | [optional] +**multiConvoEnabled** | **Boolean** | A boolean specifying whether users are allowed to be part of several conversations. Enabling `multiConvo` is **irreversible**. | [optional] +**attachmentsAccess** | **String** | A string specifying whether attachments should be stored in a publicly or privately accessible cloud storage. attachmentsAccess is set to public by default but can be modified to private. See <a href=\"https://docs.smooch.io/guide/private-attachments/\">Private Attachments</a> for more information. | [optional] +**attachmentsTokenExpirationSeconds** | **String** | Number of seconds representing the expiration time of the generated media tokens for private attachments. The JWT will be valid for 2 hours by default. See See <a href=\"https://docs.smooch.io/guide/private-attachments/\">Private Attachments</a> for more information. | [optional] diff --git a/docs/AppSubSchema.md b/docs/AppSubSchema.md new file mode 100644 index 00000000..11513856 --- /dev/null +++ b/docs/AppSubSchema.md @@ -0,0 +1,13 @@ + + +# AppSubSchema + +The app that triggered the events. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the app. | [optional] + + + diff --git a/docs/AppUpdate.md b/docs/AppUpdate.md deleted file mode 100644 index 06fe5fd2..00000000 --- a/docs/AppUpdate.md +++ /dev/null @@ -1,12 +0,0 @@ - -# AppUpdate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **String** | The app's name. | [optional] -**settings** | [**AppSettings**](AppSettings.md) | | [optional] -**metadata** | **Object** | Flat JSON object containing any custom properties associated with the app. | [optional] - - - diff --git a/docs/AppUpdateBody.md b/docs/AppUpdateBody.md new file mode 100644 index 00000000..3e21edfc --- /dev/null +++ b/docs/AppUpdateBody.md @@ -0,0 +1,14 @@ + + +# AppUpdateBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**displayName** | **String** | The friendly name of the app. | [optional] +**settings** | [**AppSettings**](AppSettings.md) | | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] + + + diff --git a/docs/AppUser.md b/docs/AppUser.md deleted file mode 100644 index 94b7f9ad..00000000 --- a/docs/AppUser.md +++ /dev/null @@ -1,19 +0,0 @@ - -# AppUser - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **String** | The app user's ID, generated automatically. | -**userId** | **String** | The app user's userId. This ID is specified by the appMaker. | [optional] -**givenName** | **String** | The app user's given name. | [optional] -**surname** | **String** | The app user's surname. | [optional] -**email** | **String** | The app user's email. | [optional] -**signedUpAt** | **String** | A datetime string with the format *yyyy-mm-ddThh:mm:ssZ* representing the moment an appUser was created. | [optional] -**properties** | **Object** | Custom properties for the app user. | -**conversationStarted** | **Boolean** | Flag indicating if the conversation has started for the app user. | -**clients** | [**List<Client>**](Client.md) | List of clients associated with the app user. | [optional] -**pendingClients** | [**List<Client>**](Client.md) | As clients, but containing linked clients which have not been confirmed yet (i.e. Twilio SMS). | [optional] - - - diff --git a/docs/AppUserApi.md b/docs/AppUserApi.md deleted file mode 100644 index be3626a7..00000000 --- a/docs/AppUserApi.md +++ /dev/null @@ -1,875 +0,0 @@ -# AppUserApi - -All URIs are relative to *https://api.smooch.io* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**deleteAppUser**](AppUserApi.md#deleteAppUser) | **DELETE** /v1.1/apps/{appId}/appusers/{userId} | -[**deleteAppUserProfile**](AppUserApi.md#deleteAppUserProfile) | **DELETE** /v1.1/apps/{appId}/appusers/{userId}/profile | -[**getAppUser**](AppUserApi.md#getAppUser) | **GET** /v1.1/apps/{appId}/appusers/{userId} | -[**getAppUserAuthCode**](AppUserApi.md#getAppUserAuthCode) | **GET** /v1.1/apps/{appId}/appusers/{userId}/authcode | -[**getAppUserBusinessSystemIds**](AppUserApi.md#getAppUserBusinessSystemIds) | **GET** /v1.1/apps/{appId}/appusers/{userId}/businesssystems | -[**getAppUserEntityIds**](AppUserApi.md#getAppUserEntityIds) | **GET** /v1.1/apps/{appId}/appusers/{userId}/channels | -[**getLinkRequests**](AppUserApi.md#getLinkRequests) | **GET** /v1.1/apps/{appId}/appusers/{userId}/linkrequest | -[**linkAppUser**](AppUserApi.md#linkAppUser) | **POST** /v1.1/apps/{appId}/appusers/{userId}/channels | -[**mergeUsers**](AppUserApi.md#mergeUsers) | **POST** /v1.1/apps/{appId}/appusers/merge | -[**postImageMessage**](AppUserApi.md#postImageMessage) | **POST** /v1.1/apps/{appId}/appusers/{userId}/images | -[**preCreateAppUser**](AppUserApi.md#preCreateAppUser) | **POST** /v1.1/apps/{appId}/appusers | -[**unlinkAppUser**](AppUserApi.md#unlinkAppUser) | **DELETE** /v1.1/apps/{appId}/appusers/{userId}/channels/{channel} | -[**updateAppUser**](AppUserApi.md#updateAppUser) | **PUT** /v1.1/apps/{appId}/appusers/{userId} | - - - -# **deleteAppUser** -> deleteAppUser(appId, userId) - - - -Delete specified app user. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppUserApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppUserApi apiInstance = new AppUserApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -try { - apiInstance.deleteAppUser(appId, userId); -} catch (ApiException e) { - System.err.println("Exception when calling AppUserApi#deleteAppUser"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **deleteAppUserProfile** -> AppUserResponse deleteAppUserProfile(appId, userId) - - - -Delete specified app user's profile. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppUserApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppUserApi apiInstance = new AppUserApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -try { - AppUserResponse result = apiInstance.deleteAppUserProfile(appId, userId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppUserApi#deleteAppUserProfile"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - -### Return type - -[**AppUserResponse**](AppUserResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getAppUser** -> AppUserResponse getAppUser(appId, userId) - - - -Get the specified app user. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppUserApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppUserApi apiInstance = new AppUserApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -try { - AppUserResponse result = apiInstance.getAppUser(appId, userId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppUserApi#getAppUser"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - -### Return type - -[**AppUserResponse**](AppUserResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getAppUserAuthCode** -> AuthCodeResponse getAppUserAuthCode(appId, userId) - - - -Get an auth code for facilitating a channel transfer - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppUserApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppUserApi apiInstance = new AppUserApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -try { - AuthCodeResponse result = apiInstance.getAppUserAuthCode(appId, userId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppUserApi#getAppUserAuthCode"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - -### Return type - -[**AuthCodeResponse**](AuthCodeResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getAppUserBusinessSystemIds** -> AppUserBusinessSystemsResponse getAppUserBusinessSystemIds(appId, userId) - - - -Get specified app user's business system IDs. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppUserApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppUserApi apiInstance = new AppUserApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -try { - AppUserBusinessSystemsResponse result = apiInstance.getAppUserBusinessSystemIds(appId, userId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppUserApi#getAppUserBusinessSystemIds"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - -### Return type - -[**AppUserBusinessSystemsResponse**](AppUserBusinessSystemsResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getAppUserEntityIds** -> AppUserChannelsResponse getAppUserEntityIds(appId, userId) - - - -Get specified app user's channel entity IDs. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppUserApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppUserApi apiInstance = new AppUserApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -try { - AppUserChannelsResponse result = apiInstance.getAppUserEntityIds(appId, userId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppUserApi#getAppUserEntityIds"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - -### Return type - -[**AppUserChannelsResponse**](AppUserChannelsResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getLinkRequests** -> LinkRequestResponse getLinkRequests(appId, userId, integrationIds) - - - -Fetch link requests for the specified app user. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppUserApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppUserApi apiInstance = new AppUserApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -List integrationIds = Arrays.asList("integrationIds_example"); // List | List of integration IDs -try { - LinkRequestResponse result = apiInstance.getLinkRequests(appId, userId, integrationIds); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppUserApi#getLinkRequests"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - **integrationIds** | [**List<String>**](String.md)| List of integration IDs | - -### Return type - -[**LinkRequestResponse**](LinkRequestResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **linkAppUser** -> AppUserResponse linkAppUser(appId, userId, appUserLinkBody) - - - -Link specified app user to given channel. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppUserApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppUserApi apiInstance = new AppUserApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -AppUserLink appUserLinkBody = new AppUserLink(); // AppUserLink | Body for a linkAppUser request. -try { - AppUserResponse result = apiInstance.linkAppUser(appId, userId, appUserLinkBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppUserApi#linkAppUser"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - **appUserLinkBody** | [**AppUserLink**](AppUserLink.md)| Body for a linkAppUser request. | - -### Return type - -[**AppUserResponse**](AppUserResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **mergeUsers** -> mergeUsers(appId, appUserMergeBody) - - - -Force the merge of two specific users, when the business has determined that they represent the same person. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppUserApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppUserApi apiInstance = new AppUserApi(); -String appId = "appId_example"; // String | Identifies the app. -AppUserMerge appUserMergeBody = new AppUserMerge(); // AppUserMerge | Body for a mergeUsers request. -try { - apiInstance.mergeUsers(appId, appUserMergeBody); -} catch (ApiException e) { - System.err.println("Exception when calling AppUserApi#mergeUsers"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **appUserMergeBody** | [**AppUserMerge**](AppUserMerge.md)| Body for a mergeUsers request. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **postImageMessage** -> MessageResponse postImageMessage(appId, userId, source, role) - - - -Send an image message to the conversation. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppUserApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppUserApi apiInstance = new AppUserApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -File source = new File("/path/to/file.txt"); // File | Image to be uploaded -String role = "role_example"; // String | Role of the sender -try { - MessageResponse result = apiInstance.postImageMessage(appId, userId, source, role); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppUserApi#postImageMessage"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - **source** | **File**| Image to be uploaded | - **role** | **String**| Role of the sender | - -### Return type - -[**MessageResponse**](MessageResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: multipart/form-data - - **Accept**: application/json - - -# **preCreateAppUser** -> AppUserResponse preCreateAppUser(appId, appUserPreCreateBody) - - - -Pre-create an app user. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppUserApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppUserApi apiInstance = new AppUserApi(); -String appId = "appId_example"; // String | Identifies the app. -AppUserPreCreate appUserPreCreateBody = new AppUserPreCreate(); // AppUserPreCreate | Body for a preCreateAppUser request. -try { - AppUserResponse result = apiInstance.preCreateAppUser(appId, appUserPreCreateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppUserApi#preCreateAppUser"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **appUserPreCreateBody** | [**AppUserPreCreate**](AppUserPreCreate.md)| Body for a preCreateAppUser request. | - -### Return type - -[**AppUserResponse**](AppUserResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **unlinkAppUser** -> unlinkAppUser(appId, userId, channel) - - - -Unlink specified app user from given channel. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppUserApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppUserApi apiInstance = new AppUserApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -String channel = "channel_example"; // String | Name of the channel. -try { - apiInstance.unlinkAppUser(appId, userId, channel); -} catch (ApiException e) { - System.err.println("Exception when calling AppUserApi#unlinkAppUser"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - **channel** | **String**| Name of the channel. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **updateAppUser** -> AppUserResponse updateAppUser(appId, userId, appUserUpdateBody) - - - -Update the specified app user. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AppUserApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AppUserApi apiInstance = new AppUserApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -AppUserUpdate appUserUpdateBody = new AppUserUpdate(); // AppUserUpdate | Body for an updateAppUser request. -try { - AppUserResponse result = apiInstance.updateAppUser(appId, userId, appUserUpdateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AppUserApi#updateAppUser"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - **appUserUpdateBody** | [**AppUserUpdate**](AppUserUpdate.md)| Body for an updateAppUser request. | - -### Return type - -[**AppUserResponse**](AppUserResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - diff --git a/docs/AppUserBusinessSystemsResponse.md b/docs/AppUserBusinessSystemsResponse.md deleted file mode 100644 index 5d021254..00000000 --- a/docs/AppUserBusinessSystemsResponse.md +++ /dev/null @@ -1,10 +0,0 @@ - -# AppUserBusinessSystemsResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**businessSystems** | [**List<BusinessSystemItem>**](BusinessSystemItem.md) | An array of objects containing the business system type and the id. | - - - diff --git a/docs/AppUserChannelsResponse.md b/docs/AppUserChannelsResponse.md deleted file mode 100644 index 0169a46a..00000000 --- a/docs/AppUserChannelsResponse.md +++ /dev/null @@ -1,10 +0,0 @@ - -# AppUserChannelsResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**channels** | [**List<ChannelEntityItem>**](ChannelEntityItem.md) | An array of objects containing the channel type and the entity id. | - - - diff --git a/docs/AppUserLink.md b/docs/AppUserLink.md deleted file mode 100644 index 0f53312d..00000000 --- a/docs/AppUserLink.md +++ /dev/null @@ -1,17 +0,0 @@ - -# AppUserLink - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **String** | The type of the channel to link. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values. | -**integrationId** | **String** | The id of the integration to link, it must match the provided type. | [optional] -**phoneNumber** | **String** | A String of the appUser’s phone number. It must contain the + prefix and the country code. Required for *messenger*, *twilio*, *messagebird* and *whatsapp* linking. | [optional] -**address** | **String** | A String of the appUser’s email address. Required for *mailgun* linking. | [optional] -**givenName** | **String** | A String of the appUser’s given name. Used as additional criteria to increase the likelihood of a match. (Optional) Used for *messenger* linking. | [optional] -**surname** | **String** | A String of the appUser’s surname. Used as additional criteria to increase the likelihood of a match. (Optional) Used for *messenger* linking. | [optional] -**subject** | **String** | Subject for the outgoing email. (Optional) Used for *mailgun* linking. | [optional] -**confirmation** | [**Confirmation**](Confirmation.md) | Allows you to specify the strategy used to initiate a link with the target user. | - - - diff --git a/docs/AppUserMerge.md b/docs/AppUserMerge.md deleted file mode 100644 index 87f05634..00000000 --- a/docs/AppUserMerge.md +++ /dev/null @@ -1,11 +0,0 @@ - -# AppUserMerge - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**surviving** | [**MergedUser**](MergedUser.md) | Nested object representing the user that will survive at the end of the merge | -**discarded** | [**MergedUser**](MergedUser.md) | Nested object representing the user to merge into the surviving user. This user will be deleted as part of the process. | - - - diff --git a/docs/AppUserPreCreate.md b/docs/AppUserPreCreate.md deleted file mode 100644 index 914fd477..00000000 --- a/docs/AppUserPreCreate.md +++ /dev/null @@ -1,15 +0,0 @@ - -# AppUserPreCreate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**userId** | **String** | The app user's userId. This ID is specified by the appMaker. | -**givenName** | **String** | The app user's given name. | [optional] -**surname** | **String** | The app user's surname. | [optional] -**email** | **String** | The app user's email. | [optional] -**signedUpAt** | **String** | A datetime string with the format *yyyy-mm-ddThh:mm:ssZ* representing the moment an appUser was created. | [optional] -**properties** | **Object** | Custom properties for the app user. | [optional] - - - diff --git a/docs/AppUserUpdate.md b/docs/AppUserUpdate.md deleted file mode 100644 index e4ad8c47..00000000 --- a/docs/AppUserUpdate.md +++ /dev/null @@ -1,14 +0,0 @@ - -# AppUserUpdate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**givenName** | **String** | The app user's given name. | [optional] -**surname** | **String** | The app user's surname. | [optional] -**email** | **String** | The app user's email. | [optional] -**signedUpAt** | **String** | A datetime string with the format *yyyy-mm-ddThh:mm:ssZ* representing the moment an appUser was created. | [optional] -**properties** | **Object** | Custom properties for the app user. | [optional] - - - diff --git a/docs/Apple.md b/docs/Apple.md new file mode 100644 index 00000000..df8288d7 --- /dev/null +++ b/docs/Apple.md @@ -0,0 +1,15 @@ + + +# Apple + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**businessId** | **String** | Apple Business Chat ID. | +**apiSecret** | **String** | Your Apple API secret which is tied to your Messaging Service Provider. | +**mspId** | **String** | Your Messaging Service Provider ID. | + + + diff --git a/docs/AppleAllOf.md b/docs/AppleAllOf.md new file mode 100644 index 00000000..b0759838 --- /dev/null +++ b/docs/AppleAllOf.md @@ -0,0 +1,16 @@ + + +# AppleAllOf + +To configure an Apple Business Chat integration, acquire the required information and call the Create Integration endpoint. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**businessId** | **String** | Apple Business Chat ID. | +**apiSecret** | **String** | Your Apple API secret which is tied to your Messaging Service Provider. | +**mspId** | **String** | Your Messaging Service Provider ID. | + + + diff --git a/docs/AuthCodeResponse.md b/docs/AppleUpdate.md similarity index 64% rename from docs/AuthCodeResponse.md rename to docs/AppleUpdate.md index 5f626821..7af7848c 100644 --- a/docs/AuthCodeResponse.md +++ b/docs/AppleUpdate.md @@ -1,10 +1,15 @@ -# AuthCodeResponse + +# AppleUpdate ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**authCode** | **String** | The auth code | +## Implemented Interfaces + +* IntegrationUpdate + diff --git a/docs/AppsApi.md b/docs/AppsApi.md new file mode 100644 index 00000000..4fab3871 --- /dev/null +++ b/docs/AppsApi.md @@ -0,0 +1,405 @@ +# AppsApi + +All URIs are relative to *https://api.smooch.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createApp**](AppsApi.md#createApp) | **POST** /v2/apps | Create App +[**deleteApp**](AppsApi.md#deleteApp) | **DELETE** /v2/apps/{appId} | Delete App +[**getApp**](AppsApi.md#getApp) | **GET** /v2/apps/{appId} | Get App +[**listApps**](AppsApi.md#listApps) | **GET** /v2/apps | List Apps +[**updateApp**](AppsApi.md#updateApp) | **PATCH** /v2/apps/{appId} | Update App + + + +## createApp + +> AppResponse createApp(appCreateBody) + +Create App + +Creates a new app. When using [service account](#service-accounts) credentials, the service account is automatically granted access to the app. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.AppsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + AppsApi apiInstance = new AppsApi(defaultClient); + AppCreateBody appCreateBody = new AppCreateBody(); // AppCreateBody | + // Add required body parameters + + try { + AppResponse result = apiInstance.createApp(appCreateBody); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AppsApi#createApp"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appCreateBody** | [**AppCreateBody**](AppCreateBody.md)| | + +### Return type + +[**AppResponse**](AppResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **400** | should have required property 'displayName' | - | +| **402** | Your account has reached the maximum number of apps for your subscription plan | - | + + +## deleteApp + +> Object deleteApp(appId) + +Delete App + +Removes the specified app, including all its enabled integrations. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.AppsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + AppsApi apiInstance = new AppsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + // Add required body parameters + + try { + Object result = apiInstance.deleteApp(appId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AppsApi#deleteApp"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | App not found | - | + + +## getApp + +> AppResponse getApp(appId) + +Get App + +Fetches an individual app. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.AppsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + AppsApi apiInstance = new AppsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + // Add required body parameters + + try { + AppResponse result = apiInstance.getApp(appId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AppsApi#getApp"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + +### Return type + +[**AppResponse**](AppResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | App not found | - | + + +## listApps + +> AppListResponse listApps(page, filter) + +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 ``` + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.AppsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + AppsApi apiInstance = new AppsApi(defaultClient); + Page page = new Page(); // Page | Contains parameters for applying cursor pagination. + AppListFilter filter = new AppListFilter(); // AppListFilter | Contains parameters for filtering the results. + // Add required body parameters + + try { + AppListResponse result = apiInstance.listApps(page, filter); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AppsApi#listApps"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **page** | [**Page**](.md)| Contains parameters for applying cursor pagination. | [optional] + **filter** | [**AppListFilter**](.md)| Contains parameters for filtering the results. | [optional] + +### Return type + +[**AppListResponse**](AppListResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **400** | Can supply only one of page[after] or page[before], not both | - | +| **403** | The serviceAccountId provided does not match supplied credentials | - | + + +## updateApp + +> AppResponse updateApp(appUpdateBody, appId) + +Update App + +Updates an app. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.AppsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + AppsApi apiInstance = new AppsApi(defaultClient); + AppUpdateBody appUpdateBody = new AppUpdateBody(); // AppUpdateBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + // Add required body parameters + + try { + AppResponse result = apiInstance.updateApp(appUpdateBody, appId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AppsApi#updateApp"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appUpdateBody** | [**AppUpdateBody**](AppUpdateBody.md)| | + **appId** | **String**| Identifies the app. | + +### Return type + +[**AppResponse**](AppResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **400** | App metadata is limited to 4096 bytes in size. | - | +| **404** | App not found | - | + diff --git a/docs/DeploymentConfirmCode.md b/docs/AttachmentDeleteBody.md similarity index 52% rename from docs/DeploymentConfirmCode.md rename to docs/AttachmentDeleteBody.md index 633bf7eb..23a7a476 100644 --- a/docs/DeploymentConfirmCode.md +++ b/docs/AttachmentDeleteBody.md @@ -1,10 +1,12 @@ -# DeploymentConfirmCode + +# AttachmentDeleteBody ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**code** | **String** | The code that was sent to you via SMS or phone call. | +**mediaUrl** | **String** | The media URL used for a file or image message. | diff --git a/docs/AttachmentMediaTokenBody.md b/docs/AttachmentMediaTokenBody.md new file mode 100644 index 00000000..53e5a077 --- /dev/null +++ b/docs/AttachmentMediaTokenBody.md @@ -0,0 +1,12 @@ + + +# AttachmentMediaTokenBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**paths** | **List<String>** | An array of strings representing the list of attachment paths used to generate the media JWT. One token will be generated for each path. Each token will be valid for 2 hours by default. This value can be modified, see [App Settings](#operation/createApp) for more information. | + + + diff --git a/docs/AttachmentMediaTokenResponse.md b/docs/AttachmentMediaTokenResponse.md new file mode 100644 index 00000000..b05c543f --- /dev/null +++ b/docs/AttachmentMediaTokenResponse.md @@ -0,0 +1,12 @@ + + +# AttachmentMediaTokenResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tokens** | **Map<String, String>** | Object with key value pair where the key is the path and the value is the media JWT. | [optional] + + + diff --git a/docs/AttachmentRemove.md b/docs/AttachmentRemove.md deleted file mode 100644 index 09f3d96e..00000000 --- a/docs/AttachmentRemove.md +++ /dev/null @@ -1,10 +0,0 @@ - -# AttachmentRemove - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**mediaUrl** | **String** | The mediaUrl for the message. Required for image/file messages. | - - - diff --git a/docs/AttachmentResponse.md b/docs/AttachmentResponse.md index 0be7cefd..05d6699b 100644 --- a/docs/AttachmentResponse.md +++ b/docs/AttachmentResponse.md @@ -1,11 +1,12 @@ + # AttachmentResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**mediaUrl** | **String** | The mediaUrl for the message. Required for image/file messages. | -**mediaType** | **String** | The mediaType for the message. Required for image/file messages. | +**attachment** | [**AttachmentSchema**](AttachmentSchema.md) | The uploaded attachment object. | [optional] diff --git a/docs/AttachmentSchema.md b/docs/AttachmentSchema.md new file mode 100644 index 00000000..94ecb086 --- /dev/null +++ b/docs/AttachmentSchema.md @@ -0,0 +1,13 @@ + + +# AttachmentSchema + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mediaUrl** | **String** | Uploaded attachment’s url | [optional] +**mediaType** | **String** | Uploaded attachment's media type | [optional] + + + diff --git a/docs/AppUserResponse.md b/docs/AttachmentUploadBody.md similarity index 59% rename from docs/AppUserResponse.md rename to docs/AttachmentUploadBody.md index 97ebb7d1..c47ec6ef 100644 --- a/docs/AppUserResponse.md +++ b/docs/AttachmentUploadBody.md @@ -1,10 +1,12 @@ -# AppUserResponse + +# AttachmentUploadBody ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**appUser** | [**AppUser**](AppUser.md) | The app user. | +**source** | [**File**](File.md) | | diff --git a/docs/AttachmentsApi.md b/docs/AttachmentsApi.md index cf9cbeb1..1fcb8207 100644 --- a/docs/AttachmentsApi.md +++ b/docs/AttachmentsApi.md @@ -4,133 +4,305 @@ All URIs are relative to *https://api.smooch.io* Method | HTTP request | Description ------------- | ------------- | ------------- -[**removeAttachment**](AttachmentsApi.md#removeAttachment) | **POST** /v1.1/apps/{appId}/attachments/remove | -[**uploadAttachment**](AttachmentsApi.md#uploadAttachment) | **POST** /v1.1/apps/{appId}/attachments | +[**deleteAttachment**](AttachmentsApi.md#deleteAttachment) | **POST** /v2/apps/{appId}/attachments/remove | Delete Attachment +[**generateMediaJsonWebToken**](AttachmentsApi.md#generateMediaJsonWebToken) | **POST** /v2/apps/{appId}/attachments/token | Generate Media Token +[**setCookie**](AttachmentsApi.md#setCookie) | **POST** /v2/apps/{appId}/attachments/cookie | Set Cookie +[**uploadAttachment**](AttachmentsApi.md#uploadAttachment) | **POST** /v2/apps/{appId}/attachments | Upload Attachment - -# **removeAttachment** -> removeAttachment(appId, attachmentRemoveBody) +## deleteAttachment +> Object deleteAttachment(attachmentDeleteBody, appId) -Remove an attachment uploaded to Smooch. +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> ### Example + ```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AttachmentsApi; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.AttachmentsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + AttachmentsApi apiInstance = new AttachmentsApi(defaultClient); + AttachmentDeleteBody attachmentDeleteBody = new AttachmentDeleteBody(); // AttachmentDeleteBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + // Add required body parameters + + try { + Object result = apiInstance.deleteAttachment(attachmentDeleteBody, appId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AttachmentsApi#deleteAttachment"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` -ApiClient defaultClient = Configuration.getDefaultApiClient(); +### Parameters -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **attachmentDeleteBody** | [**AttachmentDeleteBody**](AttachmentDeleteBody.md)| | + **appId** | **String**| Identifies the app. | +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers -// OR +- **Content-Type**: application/json +- **Accept**: application/json -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Attachment not found | - | -AttachmentsApi apiInstance = new AttachmentsApi(); -String appId = "appId_example"; // String | Identifies the app. -AttachmentRemove attachmentRemoveBody = new AttachmentRemove(); // AttachmentRemove | Body for a removeAttachment request. -try { - apiInstance.removeAttachment(appId, attachmentRemoveBody); -} catch (ApiException e) { - System.err.println("Exception when calling AttachmentsApi#removeAttachment"); - e.printStackTrace(); + +## generateMediaJsonWebToken + +> AttachmentMediaTokenResponse generateMediaJsonWebToken(attachmentMediaTokenBody, appId) + +Generate Media Token + +Generates a media JWT for a list of attachment paths. This media token is a prerequisite for setting the cookie needed to visualize a private attachment. <aside class=\"notice\">Note you have the ability to allow files using different rules, see <a href=\"https://docs.smooch.io/guide/private-attachments\">Private Attachments</a> for more details.</aside> + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.AttachmentsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + AttachmentsApi apiInstance = new AttachmentsApi(defaultClient); + AttachmentMediaTokenBody attachmentMediaTokenBody = new AttachmentMediaTokenBody(); // AttachmentMediaTokenBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + // Add required body parameters + + try { + AttachmentMediaTokenResponse result = apiInstance.generateMediaJsonWebToken(attachmentMediaTokenBody, appId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AttachmentsApi#generateMediaJsonWebToken"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **attachmentMediaTokenBody** | [**AttachmentMediaTokenBody**](AttachmentMediaTokenBody.md)| | **appId** | **String**| Identifies the app. | - **attachmentRemoveBody** | [**AttachmentRemove**](AttachmentRemove.md)| Body for a removeAttachment request. | ### Return type -null (empty response body) +[**AttachmentMediaTokenResponse**](AttachmentMediaTokenResponse.md) ### Authorization -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | + - -# **uploadAttachment** -> AttachmentResponse uploadAttachment(appId, source, access, _for, appUserId, userId) +## setCookie +> Object setCookie(appId) +Set Cookie -Upload an attachment to Smooch to use in future messages. +With the media JWT retrieved, pass it in the header of the below request as it’s authorization in order to set a cookie in the user’s browser corresponding to the path within the media JWT. The expiration date of this cookie will match the expiration date of the media JWT. This cookie will be needed to visualize a private attachment. ### Example + ```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.AttachmentsApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -AttachmentsApi apiInstance = new AttachmentsApi(); -String appId = "appId_example"; // String | Identifies the app. -File source = new File("/path/to/file.txt"); // File | File to be uploaded -String access = "access_example"; // String | Access level for the resulting file -String _for = "_for_example"; // String | The intended container for the attachment -String appUserId = "appUserId_example"; // String | The appUserId of the user that will receive the attachment Used in attachments for messages -String userId = "userId_example"; // String | The userId of the user that will receive the attachment Used in attachments for messages -try { - AttachmentResponse result = apiInstance.uploadAttachment(appId, source, access, _for, appUserId, userId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AttachmentsApi#uploadAttachment"); - e.printStackTrace(); +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.AttachmentsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + AttachmentsApi apiInstance = new AttachmentsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + // Add required body parameters + + try { + Object result = apiInstance.setCookie(appId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AttachmentsApi#setCookie"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` ### Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **appId** | **String**| Identifies the app. | - **source** | **File**| File to be uploaded | - **access** | **String**| Access level for the resulting file | - **_for** | **String**| The intended container for the attachment | [optional] - **appUserId** | **String**| The appUserId of the user that will receive the attachment Used in attachments for messages | [optional] - **userId** | **String**| The userId of the user that will receive the attachment Used in attachments for messages | [optional] + +### Return type + +**Object** + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | + + +## uploadAttachment + +> AttachmentResponse uploadAttachment(source, appId, access, _for, conversationId) + +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> + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.AttachmentsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + AttachmentsApi apiInstance = new AttachmentsApi(defaultClient); + File source = new File("/path/to/file"); // File | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String access = "public"; // String | The access level for the attachment. Currently the available access levels are public and private. + String _for = "message"; // String | Specifies the intended container for the attachment, to enable automatic attachment deletion (on deletion of associated message, conversation or user). For now, only message is supported. See [Attachments for Messages](#section/Attachments-for-Messages) for details. + String conversationId = "c616a583e4c240a871818541"; // String | Links the attachment getting uploaded to the conversation ID. + // Add required body parameters + + try { + AttachmentResponse result = apiInstance.uploadAttachment(source, appId, access, _for, conversationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AttachmentsApi#uploadAttachment"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **source** | **File**| | + **appId** | **String**| Identifies the app. | + **access** | **String**| The access level for the attachment. Currently the available access levels are public and private. | [default to "public"] + **_for** | **String**| Specifies the intended container for the attachment, to enable automatic attachment deletion (on deletion of associated message, conversation or user). For now, only message is supported. See [Attachments for Messages](#section/Attachments-for-Messages) for details. | [optional] + **conversationId** | **String**| Links the attachment getting uploaded to the conversation ID. | [optional] ### Return type @@ -138,10 +310,16 @@ Name | Type | Description | Notes ### Authorization -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) ### HTTP request headers - - **Content-Type**: multipart/form-data - - **Accept**: application/json +- **Content-Type**: multipart/form-data +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **400** | Bad request | - | diff --git a/docs/Author.md b/docs/Author.md index 36add313..19e71533 100644 --- a/docs/Author.md +++ b/docs/Author.md @@ -1,13 +1,26 @@ + # Author +The author of the message. ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**role** | **String** | The role of the individual posting the message. The only accepted value is \"appMaker\". | -**name** | **String** | The display name of the message author. | [optional] -**email** | **String** | The email address of the message author. | [optional] -**avatarUrl** | **String** | The URL of the desired message avatar image. | [optional] +**type** | [**TypeEnum**](#TypeEnum) | The type of the author. | +**userId** | **String** | The id of the user. Only supported when `type` is user. | [optional] +**userExternalId** | **String** | The externalId of the user. Only supported when `type` is user. | [optional] +**displayName** | **String** | The display name of the message author. | [optional] +**avatarUrl** | [**URI**](URI.md) | A custom message icon url. The image must be in either JPG, PNG, or GIF format | [optional] + + + +## Enum: TypeEnum + +Name | Value +---- | ----- +BUSINESS | "business" +USER | "user" diff --git a/docs/AuthorWebhook.md b/docs/AuthorWebhook.md new file mode 100644 index 00000000..fe5ce322 --- /dev/null +++ b/docs/AuthorWebhook.md @@ -0,0 +1,24 @@ + + +# AuthorWebhook + +The author of the activity. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**TypeEnum**](#TypeEnum) | The role of the message or activity. | +**userId** | **String** | The id of the user. Only supported when role is `user`. | [optional] +**user** | [**User**](User.md) | Full profile of the user that authored the message or activity. It is used only in webhook payloads if the `includeFullUser` option is enabled. | [optional] + + + +## Enum: TypeEnum + +Name | Value +---- | ----- +BUSINESS | "business" +USER | "user" + + + diff --git a/docs/BusinessSystemItem.md b/docs/BusinessSystemItem.md deleted file mode 100644 index 121a8d05..00000000 --- a/docs/BusinessSystemItem.md +++ /dev/null @@ -1,14 +0,0 @@ - -# BusinessSystemItem - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **String** | The type of business system. See [**BusinessSystemTypeEnum**](Enums.md#BusinessSystemTypeEnum) for available values. | -**channelId** | **String** | The channel id for a *slack* integration | [optional] -**ticketId** | **String** | The ticket id for a *zendesk* integration | [optional] -**roomId** | **Integer** | The room id for a *hipchat* integration | [optional] -**conversationId** | **String** | The conversation id for a *helpscout* integration | [optional] - - - diff --git a/docs/Buy.md b/docs/Buy.md new file mode 100644 index 00000000..a6fb7bae --- /dev/null +++ b/docs/Buy.md @@ -0,0 +1,21 @@ + + +# Buy + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of action. | +**text** | **String** | The button text. | +**amount** | **Integer** | The amount being charged. It needs to be specified in cents and is an integer (9.99$ -> 999). | +**currency** | **String** | An ISO 4217 standard currency code in lowercase. Used for actions of type buy. | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] + + +## Implemented Interfaces + +* Action +* ActionSubset + + diff --git a/docs/CarouselMessage.md b/docs/CarouselMessage.md new file mode 100644 index 00000000..24c4c887 --- /dev/null +++ b/docs/CarouselMessage.md @@ -0,0 +1,20 @@ + + +# CarouselMessage + +Carousel messages are a horizontally scrollable set of items that may each contain text, an image, and message actions. Not all messaging channels fully support carousel messages; currently only Facebook Messenger, LINE, Telegram, Viber, the Web Messenger, the Android SDK and the iOS SDK cover the full functionality. For all other platforms a carousel message is rendered as raw text. The raw text fallback does not include any images or postback message actions. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of message. | +**text** | **String** | The fallback text message used when carousel messages are not supported by the channel. | [optional] [readonly] +**items** | [**List<Item>**](Item.md) | An array of objects representing the items associated with the message. Only present in carousel and list type messages. | +**displaySettings** | [**CarouselMessageDisplaySettings**](CarouselMessageDisplaySettings.md) | | [optional] + + +## Implemented Interfaces + +* Content + + diff --git a/docs/CarouselMessageDisplaySettings.md b/docs/CarouselMessageDisplaySettings.md new file mode 100644 index 00000000..17404d35 --- /dev/null +++ b/docs/CarouselMessageDisplaySettings.md @@ -0,0 +1,22 @@ + + +# CarouselMessageDisplaySettings + +Settings to adjust the carousel layout. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**imageAspectRatio** | [**ImageAspectRatioEnum**](#ImageAspectRatioEnum) | Specifies how to display all carousel images. Valid values are horizontal (default) and square. Only supported in Facebook Messenger, Web Messenger, Android SDK and iOS SDK carousels. | [optional] + + + +## Enum: ImageAspectRatioEnum + +Name | Value +---- | ----- +HORIZONTAL | "horizontal" +SQUARE | "square" + + + diff --git a/docs/ChannelEntityItem.md b/docs/ChannelEntityItem.md deleted file mode 100644 index b8e2929d..00000000 --- a/docs/ChannelEntityItem.md +++ /dev/null @@ -1,16 +0,0 @@ - -# ChannelEntityItem - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **String** | The type of channel. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values. | -**integrationId** | **String** | The ID of the integration. | [optional] -**phoneNumber** | **String** | The phone number for a *twilio* or *messagebird* integration | [optional] -**userId** | **String** | The userId for a *messenger*, *viber*, *line*, *wechat* or *twitter* integration | [optional] -**address** | **String** | The email address for a *mailgun* integration | [optional] -**username** | **String** | The username for a *whatsapp* integration | [optional] -**chatId** | **String** | The chat id for a *telegram* integration | [optional] - - - diff --git a/docs/Client.md b/docs/Client.md index 3dd15bf1..9bad1d60 100644 --- a/docs/Client.md +++ b/docs/Client.md @@ -1,21 +1,33 @@ + # Client ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **String** | An identifier for the client. Must be globally unique. | -**status** | **String** | The client status. Indicates if the client is able to receive messages or not. See [**ClientStatusEnum**](Enums.md#ClientStatusEnum) for available values. | [optional] -**externalId** | **String** | The ID of the user on an external channel. For example, the user's phone number for Twilio, or their page-scoped user ID for Facebook Messenger. Applies only to non-SDK clients. | [optional] -**active** | **Boolean** | Deprecated - use the status property instead. | [optional] -**lastSeen** | **String** | The date time the client was last seen. | [optional] -**platform** | **String** | The client's platform. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values. | -**integrationId** | **String** | The ID of the integration that the client was created for. | [optional] -**pushNotificationToken** | **String** | The GCM or APN token to be used for sending push notifications to the device. Applies to only *android* and *ios* clients. | [optional] -**appVersion** | **String** | A reserved string field for reporting the app version running on the device. | [optional] -**displayName** | **String** | The client's display name. | [optional] -**info** | [**ClientInfo**](ClientInfo.md) | | [optional] -**raw** | **Object** | An Object with raw properties that vary for each client platform. All keys are optional and not guaranteed to be available. | [optional] +**id** | **String** | The unique ID of the client. | [optional] +**type** | [**ClientType**](ClientType.md) | | [optional] +**status** | [**StatusEnum**](#StatusEnum) | The client status. Indicates if the client is able to receive messages or not. Can be pending, inactive, active, or blocked. | [optional] +**integrationId** | **String** | The ID of the integration that the client was created for. Unused for clients of type sdk, as they incorporate multiple integrations. | [optional] +**externalId** | **String** | The ID of the user on an external channel. For example, the user’s phone number for Twilio, or their page-scoped user ID for Facebook Messenger. Applies only to non-SDK clients. | [optional] +**lastSeen** | **String** | A datetime string with the format `YYYY-MM-DDThh:mm:ss.SSSZ` representing the last time the user interacted with this client. | [optional] +**linkedAt** | **String** | A timestamp signifying when the client was added to the user. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**displayName** | **String** | The user's display name on the channel. | [optional] +**avatarUrl** | [**URI**](URI.md) | The URL for the user's avatar on the channel. | [optional] +**info** | [**Object**](.md) | A flat curated object with properties that vary for each client platform. All keys are optional and not guaranteed to be available. | [optional] +**raw** | [**Object**](.md) | An object with raw properties that vary for each client platform. All keys are optional and not guaranteed to be available. | [optional] + + + +## Enum: StatusEnum + +Name | Value +---- | ----- +ACTIVE | "active" +BLOCKED | "blocked" +INACTIVE | "inactive" +PENDING | "pending" diff --git a/docs/ClientAssociation.md b/docs/ClientAssociation.md new file mode 100644 index 00000000..c8b5a8e0 --- /dev/null +++ b/docs/ClientAssociation.md @@ -0,0 +1,13 @@ + + +# ClientAssociation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**ClientType**](ClientType.md) | | [optional] +**clientId** | **String** | The id of the client being referenced. | [optional] + + + diff --git a/docs/ClientCreate.md b/docs/ClientCreate.md new file mode 100644 index 00000000..66566076 --- /dev/null +++ b/docs/ClientCreate.md @@ -0,0 +1,14 @@ + + +# ClientCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**matchCriteria** | [**MatchCriteria**](MatchCriteria.md) | | +**confirmation** | [**Confirmation**](Confirmation.md) | | +**target** | [**Target**](Target.md) | | + + + diff --git a/docs/ClientInfo.md b/docs/ClientInfo.md deleted file mode 100644 index 363eed06..00000000 --- a/docs/ClientInfo.md +++ /dev/null @@ -1,26 +0,0 @@ - -# ClientInfo - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**appName** | **String** | Name of the app associated with the client. | [optional] -**avatarUrl** | **String** | The client's avatar URL. | [optional] -**carrier** | **String** | The client's carrier. | [optional] -**city** | **String** | The client's city. | [optional] -**country** | **String** | The client's country. | [optional] -**deviceModel** | **String** | The client's device model. | [optional] -**devicePlatform** | **String** | The client's device platform. | [optional] -**gender** | **String** | The client user's gender. | [optional] -**isPaymentEnabled** | **Boolean** | Whether or not payment is enabled for client. | [optional] -**locale** | **String** | The client's locale. | [optional] -**os** | **String** | The client's OS. | [optional] -**osVersion** | **String** | The client's OS version. | [optional] -**phoneNumber** | **String** | The client's phone number. | [optional] -**radioAccessTechnology** | **String** | The client's radioAccessTechnology (Ex. HSDPA). | [optional] -**state** | **String** | The client's state or province. | [optional] -**timezone** | **Double** | The client's timezone offset. | [optional] -**wifi** | **String** | Whether or not the client has wifi. | [optional] - - - diff --git a/docs/ClientListResponse.md b/docs/ClientListResponse.md new file mode 100644 index 00000000..edf090f7 --- /dev/null +++ b/docs/ClientListResponse.md @@ -0,0 +1,14 @@ + + +# ClientListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**clients** | [**List<Client>**](Client.md) | List of returned clients. | [optional] +**meta** | [**Meta**](Meta.md) | | [optional] +**links** | [**Links**](Links.md) | | [optional] + + + diff --git a/docs/ClientResponse.md b/docs/ClientResponse.md new file mode 100644 index 00000000..96388117 --- /dev/null +++ b/docs/ClientResponse.md @@ -0,0 +1,12 @@ + + +# ClientResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | [**Client**](Client.md) | | [optional] + + + diff --git a/docs/ClientType.md b/docs/ClientType.md new file mode 100644 index 00000000..48728f64 --- /dev/null +++ b/docs/ClientType.md @@ -0,0 +1,31 @@ + + +# ClientType + +## Enum + + +* `LINE` (value: `"line"`) + +* `MAILGUN` (value: `"mailgun"`) + +* `MESSAGEBIRD` (value: `"messagebird"`) + +* `MESSENGER` (value: `"messenger"`) + +* `SDK` (value: `"sdk"`) + +* `TELEGRAM` (value: `"telegram"`) + +* `TWILIO` (value: `"twilio"`) + +* `TWITTER` (value: `"twitter"`) + +* `VIBER` (value: `"viber"`) + +* `WECHAT` (value: `"wechat"`) + +* `WHATSAPP` (value: `"whatsapp"`) + + + diff --git a/docs/ClientsApi.md b/docs/ClientsApi.md new file mode 100644 index 00000000..7c9f892c --- /dev/null +++ b/docs/ClientsApi.md @@ -0,0 +1,253 @@ +# ClientsApi + +All URIs are relative to *https://api.smooch.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createClient**](ClientsApi.md#createClient) | **POST** /v2/apps/{appId}/users/{userIdOrExternalId}/clients | Create Client +[**listClients**](ClientsApi.md#listClients) | **GET** /v2/apps/{appId}/users/{userIdOrExternalId}/clients | List Clients +[**removeClient**](ClientsApi.md#removeClient) | **DELETE** /v2/apps/{appId}/users/{userIdOrExternalId}/clients/{clientId} | Remove Client + + + +## createClient + +> ClientResponse createClient(clientCreate, appId, userIdOrExternalId) + +Create Client + +Create a client and link it to a channel specified by the matchCriteria.type. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.ClientsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + ClientsApi apiInstance = new ClientsApi(defaultClient); + ClientCreate clientCreate = {"matchCriteria":{"type":"mailgun","integrationId":"582dedf230e788746891281a","primary":true,"address":"steveb@channel5.com","subject":"New message from {appName}"},"confirmation":{"type":"immediate","message":{"author":{"type":"business","displayName":"Steve","avatarUrl":"https://www.gravatar.com/image.jpg"},"content":{"type":"text","text":"Hello!"},"metadata":{"lang":"en-ca"}}},"target":{"conversationId":"029c31f25a21b47effd7be90"}}; // ClientCreate | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String userIdOrExternalId = "42589ad070d43be9b00ff7e5"; // String | The user's id or externalId. + // Add required body parameters + + try { + ClientResponse result = apiInstance.createClient(clientCreate, appId, userIdOrExternalId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ClientsApi#createClient"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **clientCreate** | [**ClientCreate**](ClientCreate.md)| | + **appId** | **String**| Identifies the app. | + **userIdOrExternalId** | **String**| The user's id or externalId. | + +### Return type + +[**ClientResponse**](ClientResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | + + +## listClients + +> ClientListResponse listClients(appId, userIdOrExternalId, page) + +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 ``` + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.ClientsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + ClientsApi apiInstance = new ClientsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String userIdOrExternalId = "42589ad070d43be9b00ff7e5"; // String | The user's id or externalId. + Page page = new Page(); // Page | Contains parameters for applying cursor pagination. + // Add required body parameters + + try { + ClientListResponse result = apiInstance.listClients(appId, userIdOrExternalId, page); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ClientsApi#listClients"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **userIdOrExternalId** | **String**| The user's id or externalId. | + **page** | [**Page**](.md)| Contains parameters for applying cursor pagination. | [optional] + +### Return type + +[**ClientListResponse**](ClientListResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | + + +## removeClient + +> Object removeClient(appId, userIdOrExternalId, clientId) + +Remove Client + +Remove a particular client and unsubscribe it from all connected conversations. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.ClientsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + ClientsApi apiInstance = new ClientsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String userIdOrExternalId = "42589ad070d43be9b00ff7e5"; // String | The user's id or externalId. + String clientId = "5d8cff3cd55b040010928b5b"; // String | The client's id. + // Add required body parameters + + try { + Object result = apiInstance.removeClient(appId, userIdOrExternalId, clientId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ClientsApi#removeClient"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **userIdOrExternalId** | **String**| The user's id or externalId. | + **clientId** | **String**| The client's id. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **400** | Cannot remove a client of type 'sdk' | - | +| **404** | Client not found | - | + diff --git a/docs/Confirmation.md b/docs/Confirmation.md index 331cfee5..fb30e244 100644 --- a/docs/Confirmation.md +++ b/docs/Confirmation.md @@ -1,11 +1,24 @@ + # Confirmation +The confirmation options of the link request. ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**type** | **String** | The confirmation type. See [**ConfirmationTypeEnum**](Enums.md#ConfirmationTypeEnum) for available values. | -**message** | [**Message**](Message.md) | The message used to reach out to the user. Must be a valid message object as per the post message API. | [optional] +**type** | [**TypeEnum**](#TypeEnum) | The type of confirmation. | +**message** | [**MessagePost**](MessagePost.md) | The message used to reach out to the user, if desired. Messages sent via this method can only be of type text and image. If actions are included they can only be of type link. The confirmation message will not be added to the user’s conversation. | [optional] + + + +## Enum: TypeEnum + +Name | Value +---- | ----- +IMMEDIATE | "immediate" +USERACTIVITY | "userActivity" +PROMPT | "prompt" diff --git a/docs/Content.md b/docs/Content.md new file mode 100644 index 00000000..8a558358 --- /dev/null +++ b/docs/Content.md @@ -0,0 +1,16 @@ + + +# Interface Content + +## Implementing Classes + +* CarouselMessage +* FileMessage +* FormMessage +* FormResponseMessage +* ImageMessage +* ListMessage +* LocationMessage +* TextMessage + + diff --git a/docs/Conversation.md b/docs/Conversation.md index 0b12d864..cbc29a6c 100644 --- a/docs/Conversation.md +++ b/docs/Conversation.md @@ -1,11 +1,22 @@ + # Conversation ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **String** | The conversation ID, generated automatically. | -**unreadCount** | **Integer** | The number of unread messages in the conversation. | +**id** | **String** | The unique ID of the conversation. | [optional] +**type** | [**ConversationType**](ConversationType.md) | | [optional] +**activeSwitchboardIntegration** | [**SwitchboardIntegrationWebhook**](SwitchboardIntegrationWebhook.md) | The current switchboard integration that is in control of the conversation. This field is omitted if no `activeSwitchboardIntegration` exists for the conversation. | [optional] +**pendingSwitchboardIntegration** | [**SwitchboardIntegrationWebhook**](SwitchboardIntegrationWebhook.md) | The switchboard integration that is awaiting control. This field is omitted if no switchboard integration has been previously offered control. | [optional] +**isDefault** | **Boolean** | Whether the conversation is the default conversation for the user. Will be true for the first personal conversation created for the user, and false in all other cases. | [optional] +**displayName** | **String** | A friendly name for the conversation, may be displayed to the business or the user. | [optional] +**description** | **String** | A short text describing the conversation. | [optional] +**iconUrl** | [**URI**](URI.md) | A custom conversation icon url. The image must be in either JPG, PNG, or GIF format | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] +**businessLastRead** | **String** | A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the moment the conversation was last marked as read with role business. | [optional] +**lastUpdatedAt** | **String** | A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the moment the last message was received in the conversation, or the creation time if no messages have been received yet. | [optional] diff --git a/docs/ConversationActivity.md b/docs/ConversationActivity.md deleted file mode 100644 index 2342a8f4..00000000 --- a/docs/ConversationActivity.md +++ /dev/null @@ -1,13 +0,0 @@ - -# ConversationActivity - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**role** | **String** | The role of the actor. Must be *appMaker*. See [**RoleEnum**](Enums.md#RoleEnum) for available values. | -**type** | **String** | The type of activity to trigger. Must be either *typing:start* or *typing:stop*. See [**MessageTypeEnum**](Enums.md#MessageTypeEnum) for available values. | -**name** | **String** | The name of the app maker that starts or stops typing a response. | [optional] -**avatarUrl** | **String** | The avatar URL of the app maker that starts typing a response. | [optional] - - - diff --git a/docs/ConversationAllOf.md b/docs/ConversationAllOf.md new file mode 100644 index 00000000..8d71532b --- /dev/null +++ b/docs/ConversationAllOf.md @@ -0,0 +1,18 @@ + + +# ConversationAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**isDefault** | **Boolean** | Whether the conversation is the default conversation for the user. Will be true for the first personal conversation created for the user, and false in all other cases. | [optional] +**displayName** | **String** | A friendly name for the conversation, may be displayed to the business or the user. | [optional] +**description** | **String** | A short text describing the conversation. | [optional] +**iconUrl** | [**URI**](URI.md) | A custom conversation icon url. The image must be in either JPG, PNG, or GIF format | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] +**businessLastRead** | **String** | A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the moment the conversation was last marked as read with role business. | [optional] +**lastUpdatedAt** | **String** | A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the moment the last message was received in the conversation, or the creation time if no messages have been received yet. | [optional] + + + diff --git a/docs/ConversationApi.md b/docs/ConversationApi.md deleted file mode 100644 index 11d1c823..00000000 --- a/docs/ConversationApi.md +++ /dev/null @@ -1,411 +0,0 @@ -# ConversationApi - -All URIs are relative to *https://api.smooch.io* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**conversationActivity**](ConversationApi.md#conversationActivity) | **POST** /v1.1/apps/{appId}/appusers/{userId}/conversation/activity | -[**deleteMessage**](ConversationApi.md#deleteMessage) | **DELETE** /v1.1/apps/{appId}/appusers/{userId}/messages/{messageId} | -[**deleteMessages**](ConversationApi.md#deleteMessages) | **DELETE** /v1.1/apps/{appId}/appusers/{userId}/messages | -[**getMessages**](ConversationApi.md#getMessages) | **GET** /v1.1/apps/{appId}/appusers/{userId}/messages | -[**postMessage**](ConversationApi.md#postMessage) | **POST** /v1.1/apps/{appId}/appusers/{userId}/messages | -[**resetUnreadCount**](ConversationApi.md#resetUnreadCount) | **POST** /v1.1/apps/{appId}/appusers/{userId}/conversation/read | - - - -# **conversationActivity** -> ActivityResponse conversationActivity(appId, userId, conversationActivityBody) - - - -Notify Smooch when an app maker starts or stops typing a response. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ConversationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ConversationApi apiInstance = new ConversationApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -ConversationActivity conversationActivityBody = new ConversationActivity(); // ConversationActivity | Body for a triggerConversationActivity request. -try { - ActivityResponse result = apiInstance.conversationActivity(appId, userId, conversationActivityBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling ConversationApi#conversationActivity"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - **conversationActivityBody** | [**ConversationActivity**](ConversationActivity.md)| Body for a triggerConversationActivity request. | - -### Return type - -[**ActivityResponse**](ActivityResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **deleteMessage** -> deleteMessage(appId, userId, messageId) - - - -Deletes a single message. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ConversationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ConversationApi apiInstance = new ConversationApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -String messageId = "messageId_example"; // String | Identifies the message. -try { - apiInstance.deleteMessage(appId, userId, messageId); -} catch (ApiException e) { - System.err.println("Exception when calling ConversationApi#deleteMessage"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - **messageId** | **String**| Identifies the message. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **deleteMessages** -> deleteMessages(appId, userId) - - - -Clears the message history for a user, permanently deleting all messages, but leaving any connections to Messaging Channels and Business Systems intact. These connections allow for the conversation to continue in the future, while still being associated to the same appUser. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ConversationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ConversationApi apiInstance = new ConversationApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -try { - apiInstance.deleteMessages(appId, userId); -} catch (ApiException e) { - System.err.println("Exception when calling ConversationApi#deleteMessages"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getMessages** -> GetMessagesResponse getMessages(appId, userId, before, after) - - - -Get the specified app user's messages. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ConversationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ConversationApi apiInstance = new ConversationApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -String before = "before_example"; // String | Timestamp of message. The API will return 100 messages before the specified timestamp (excluding any messages with the provided timestamp). -String after = "after_example"; // String | Timestamp of message. The API will return 100 messages after the specified timestamp (excluding any messages with the provided timestamp). -try { - GetMessagesResponse result = apiInstance.getMessages(appId, userId, before, after); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling ConversationApi#getMessages"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - **before** | **String**| Timestamp of message. The API will return 100 messages before the specified timestamp (excluding any messages with the provided timestamp). | [optional] - **after** | **String**| Timestamp of message. The API will return 100 messages after the specified timestamp (excluding any messages with the provided timestamp). | [optional] - -### Return type - -[**GetMessagesResponse**](GetMessagesResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **postMessage** -> MessageResponse postMessage(appId, userId, messagePostBody) - - - -Post a message to or from the app user. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ConversationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ConversationApi apiInstance = new ConversationApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -MessagePost messagePostBody = new MessagePost(); // MessagePost | Body for a postMessage request. Additional arguments are necessary based on message type ([text](https://docs.smooch.io/rest/#text), [image](https://docs.smooch.io/rest/#image), [carousel](https://docs.smooch.io/rest/#carousel), [list](https://docs.smooch.io/rest/#list), [form](https://docs.smooch.io/rest/#form)) -try { - MessageResponse result = apiInstance.postMessage(appId, userId, messagePostBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling ConversationApi#postMessage"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - **messagePostBody** | [**MessagePost**](MessagePost.md)| Body for a postMessage request. Additional arguments are necessary based on message type ([text](https://docs.smooch.io/rest/#text), [image](https://docs.smooch.io/rest/#image), [carousel](https://docs.smooch.io/rest/#carousel), [list](https://docs.smooch.io/rest/#list), [form](https://docs.smooch.io/rest/#form)) | - -### Return type - -[**MessageResponse**](MessageResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **resetUnreadCount** -> resetUnreadCount(appId, userId) - - - -Reset the unread count of the conversation to 0. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ConversationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ConversationApi apiInstance = new ConversationApi(); -String appId = "appId_example"; // String | Identifies the app. -String userId = "userId_example"; // String | Identifies the user. Can be either the smoochId or the userId. -try { - apiInstance.resetUnreadCount(appId, userId); -} catch (ApiException e) { - System.err.println("Exception when calling ConversationApi#resetUnreadCount"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **userId** | **String**| Identifies the user. Can be either the smoochId or the userId. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - diff --git a/docs/ConversationCreateBody.md b/docs/ConversationCreateBody.md new file mode 100644 index 00000000..407f1194 --- /dev/null +++ b/docs/ConversationCreateBody.md @@ -0,0 +1,17 @@ + + +# ConversationCreateBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**ConversationType**](ConversationType.md) | | +**participants** | [**List<ParticipantSubSchema>**](ParticipantSubSchema.md) | The users participating in the conversation. For `personal` conversations, this field is required with a length of exactly 1. For `sdkGroup` conversations, must have a length less than or equal to 10. Can be omitted to have a conversation with no participants if the type is `sdkGroup`. | [optional] +**displayName** | **String** | A friendly name for the conversation, may be displayed to the business or the user. | [optional] +**description** | **String** | A short text describing the conversation. | [optional] +**iconUrl** | [**URI**](URI.md) | A custom conversation icon url. The image must be in either JPG, PNG, or GIF format | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] + + + diff --git a/docs/ConversationCreateEvent.md b/docs/ConversationCreateEvent.md new file mode 100644 index 00000000..2a8a2c46 --- /dev/null +++ b/docs/ConversationCreateEvent.md @@ -0,0 +1,15 @@ + + +# ConversationCreateEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**payload** | [**ConversationCreateEventAllOfPayload**](ConversationCreateEventAllOfPayload.md) | | [optional] + + + diff --git a/docs/ConversationCreateEventAllOf.md b/docs/ConversationCreateEventAllOf.md new file mode 100644 index 00000000..c12a7654 --- /dev/null +++ b/docs/ConversationCreateEventAllOf.md @@ -0,0 +1,12 @@ + + +# ConversationCreateEventAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payload** | [**ConversationCreateEventAllOfPayload**](ConversationCreateEventAllOfPayload.md) | | [optional] + + + diff --git a/docs/ConversationCreateEventAllOfPayload.md b/docs/ConversationCreateEventAllOfPayload.md new file mode 100644 index 00000000..fbd3cc8e --- /dev/null +++ b/docs/ConversationCreateEventAllOfPayload.md @@ -0,0 +1,30 @@ + + +# ConversationCreateEventAllOfPayload + +The payload of the event. The contents of this object depend on the type of event. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conversation** | [**ConversationTruncated**](ConversationTruncated.md) | The conversation that was created. | [optional] +**creationReason** | [**CreationReasonEnum**](#CreationReasonEnum) | The reason why the conversation was created, if applicable. * `linkRequest` - The conversation was created in order to generate a link request to transfer the user to a different channel. * `message` - The conversation was created because a message was sent. * `none` - The conversation was not created for a specific purpose. Used primarily when a conversation is created via the Create Conversation API. * `notification` - The conversation was created by a call to the Notification API. * `prechatCapture` - The conversation was created because the user completed a prechat capture form in the Web Messenger. * `startConversation` - The conversation was created because of a call to the startConversation API on one of the SDK integrations, or a start conversation event was triggered from a messaging channel. | [optional] +**source** | [**SourceWebhook**](SourceWebhook.md) | The source of the creation. | [optional] +**user** | [**User**](User.md) | The user associated with the conversation. Only present if the created conversation was of type personal. For sdkGroup conversations, the list of participants can be fetched using the List Participants API, if required. | [optional] +**referral** | [**Referral**](Referral.md) | Referral information, if applicable. | [optional] + + + +## Enum: CreationReasonEnum + +Name | Value +---- | ----- +LINKREQUEST | "linkRequest" +MESSAGE | "message" +NONE | "none" +NOTIFICATION | "notification" +PRECHATCAPTURE | "prechatCapture" +STARTCONVERSATION | "startConversation" + + + diff --git a/docs/ConversationListFilter.md b/docs/ConversationListFilter.md new file mode 100644 index 00000000..a3b1e8bc --- /dev/null +++ b/docs/ConversationListFilter.md @@ -0,0 +1,13 @@ + + +# ConversationListFilter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**userId** | **String** | The user's id. One of `userId` or `userExternalId` is required, but not both. | [optional] +**userExternalId** | **String** | The external Id of the user. One of `userId` or `userExternalId` is required, but not both. | [optional] + + + diff --git a/docs/ConversationListResponse.md b/docs/ConversationListResponse.md new file mode 100644 index 00000000..e905b315 --- /dev/null +++ b/docs/ConversationListResponse.md @@ -0,0 +1,14 @@ + + +# ConversationListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conversations** | [**List<Conversation>**](Conversation.md) | List of returned conversations. | [optional] +**meta** | [**Meta**](Meta.md) | | [optional] +**links** | [**Links**](Links.md) | | [optional] + + + diff --git a/docs/ConversationMessageDeliveryChannelEvent.md b/docs/ConversationMessageDeliveryChannelEvent.md new file mode 100644 index 00000000..8d191b01 --- /dev/null +++ b/docs/ConversationMessageDeliveryChannelEvent.md @@ -0,0 +1,15 @@ + + +# ConversationMessageDeliveryChannelEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**payload** | [**ConversationMessageDeliveryPayload**](ConversationMessageDeliveryPayload.md) | | [optional] + + + diff --git a/docs/ConversationMessageDeliveryChannelEventAllOf.md b/docs/ConversationMessageDeliveryChannelEventAllOf.md new file mode 100644 index 00000000..27ef2d16 --- /dev/null +++ b/docs/ConversationMessageDeliveryChannelEventAllOf.md @@ -0,0 +1,12 @@ + + +# ConversationMessageDeliveryChannelEventAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payload** | [**ConversationMessageDeliveryPayload**](ConversationMessageDeliveryPayload.md) | | [optional] + + + diff --git a/docs/ConversationMessageDeliveryFailureEvent.md b/docs/ConversationMessageDeliveryFailureEvent.md new file mode 100644 index 00000000..19bfb07e --- /dev/null +++ b/docs/ConversationMessageDeliveryFailureEvent.md @@ -0,0 +1,15 @@ + + +# ConversationMessageDeliveryFailureEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**payload** | [**ConversationMessageDeliveryPayload**](ConversationMessageDeliveryPayload.md) | | [optional] + + + diff --git a/docs/ConversationMessageDeliveryFailureEventAllOf.md b/docs/ConversationMessageDeliveryFailureEventAllOf.md new file mode 100644 index 00000000..cdaeccdc --- /dev/null +++ b/docs/ConversationMessageDeliveryFailureEventAllOf.md @@ -0,0 +1,12 @@ + + +# ConversationMessageDeliveryFailureEventAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payload** | [**ConversationMessageDeliveryPayload**](ConversationMessageDeliveryPayload.md) | | [optional] + + + diff --git a/docs/ConversationMessageDeliveryPayload.md b/docs/ConversationMessageDeliveryPayload.md new file mode 100644 index 00000000..f12030ba --- /dev/null +++ b/docs/ConversationMessageDeliveryPayload.md @@ -0,0 +1,18 @@ + + +# ConversationMessageDeliveryPayload + +The payload of the event. The contents of this object depend on the type of event. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user** | [**User**](User.md) | The user associated with the conversation. | [optional] +**conversation** | [**ConversationTruncated**](ConversationTruncated.md) | The conversation in which the message was sent. | [optional] +**message** | [**ConversationMessageDeliveryPayloadMessage**](ConversationMessageDeliveryPayloadMessage.md) | | [optional] +**destination** | [**ConversationMessageDeliveryPayloadDestination**](ConversationMessageDeliveryPayloadDestination.md) | | [optional] +**externalMessages** | [**List<ConversationMessageDeliveryPayloadExternalMessages>**](ConversationMessageDeliveryPayloadExternalMessages.md) | An array of objects representing the third-party messages associated with the event. The order of the external messages is not guaranteed to be the same across the different triggers. Note that some channels don’t expose message IDs, in which case this field will be unset. | [optional] +**isFinalEvent** | **Boolean** | A boolean indicating whether the webhook is the final one for the `message.id` and `destination.type` pair. | [optional] + + + diff --git a/docs/ConversationMessageDeliveryPayloadDestination.md b/docs/ConversationMessageDeliveryPayloadDestination.md new file mode 100644 index 00000000..21d266a7 --- /dev/null +++ b/docs/ConversationMessageDeliveryPayloadDestination.md @@ -0,0 +1,14 @@ + + +# ConversationMessageDeliveryPayloadDestination + +A nested object representing the destination of the message. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | An identifier for the channel to which a message was sent to. May include one of \"web\", \"ios\", \"android\", \"messenger\", \"viber\", \"telegram\", \"wechat\", \"line\", \"twilio\", \"api\", \"notification\", or any other channel. | [optional] +**integrationId** | **String** | Identifier indicating which integration the message was sent to. | [optional] + + + diff --git a/docs/ConversationMessageDeliveryPayloadExternalMessages.md b/docs/ConversationMessageDeliveryPayloadExternalMessages.md new file mode 100644 index 00000000..d49d00d6 --- /dev/null +++ b/docs/ConversationMessageDeliveryPayloadExternalMessages.md @@ -0,0 +1,12 @@ + + +# ConversationMessageDeliveryPayloadExternalMessages + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | A string representing the ID of the external message. | [optional] + + + diff --git a/docs/ConversationMessageDeliveryPayloadMessage.md b/docs/ConversationMessageDeliveryPayloadMessage.md new file mode 100644 index 00000000..304295c6 --- /dev/null +++ b/docs/ConversationMessageDeliveryPayloadMessage.md @@ -0,0 +1,13 @@ + + +# ConversationMessageDeliveryPayloadMessage + +The message that was sent. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | A string representing the ID of the message. | [optional] + + + diff --git a/docs/ConversationMessageDeliveryUserEvent.md b/docs/ConversationMessageDeliveryUserEvent.md new file mode 100644 index 00000000..276d8ee8 --- /dev/null +++ b/docs/ConversationMessageDeliveryUserEvent.md @@ -0,0 +1,15 @@ + + +# ConversationMessageDeliveryUserEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**payload** | [**ConversationMessageDeliveryPayload**](ConversationMessageDeliveryPayload.md) | | [optional] + + + diff --git a/docs/ConversationMessageEvent.md b/docs/ConversationMessageEvent.md new file mode 100644 index 00000000..ef584991 --- /dev/null +++ b/docs/ConversationMessageEvent.md @@ -0,0 +1,15 @@ + + +# ConversationMessageEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**payload** | [**ConversationMessageEventAllOfPayload**](ConversationMessageEventAllOfPayload.md) | | [optional] + + + diff --git a/docs/ConversationMessageEventAllOf.md b/docs/ConversationMessageEventAllOf.md new file mode 100644 index 00000000..3757cadb --- /dev/null +++ b/docs/ConversationMessageEventAllOf.md @@ -0,0 +1,12 @@ + + +# ConversationMessageEventAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payload** | [**ConversationMessageEventAllOfPayload**](ConversationMessageEventAllOfPayload.md) | | [optional] + + + diff --git a/docs/ConversationMessageEventAllOfPayload.md b/docs/ConversationMessageEventAllOfPayload.md new file mode 100644 index 00000000..c524afac --- /dev/null +++ b/docs/ConversationMessageEventAllOfPayload.md @@ -0,0 +1,15 @@ + + +# ConversationMessageEventAllOfPayload + +The payload of the event. The contents of this object depend on the type of event. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conversation** | [**ConversationTruncated**](ConversationTruncated.md) | The conversation in which the message was sent. | [optional] +**message** | [**Message**](Message.md) | The message that was sent. | [optional] +**recentNotifications** | [**List<Message>**](Message.md) | Messages sent with the Notification API since the last user message. | [optional] + + + diff --git a/docs/ConversationPostbackEvent.md b/docs/ConversationPostbackEvent.md new file mode 100644 index 00000000..9c2ed1dc --- /dev/null +++ b/docs/ConversationPostbackEvent.md @@ -0,0 +1,15 @@ + + +# ConversationPostbackEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**payload** | [**ConversationPostbackEventAllOfPayload**](ConversationPostbackEventAllOfPayload.md) | | [optional] + + + diff --git a/docs/ConversationPostbackEventAllOf.md b/docs/ConversationPostbackEventAllOf.md new file mode 100644 index 00000000..d52ee622 --- /dev/null +++ b/docs/ConversationPostbackEventAllOf.md @@ -0,0 +1,12 @@ + + +# ConversationPostbackEventAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payload** | [**ConversationPostbackEventAllOfPayload**](ConversationPostbackEventAllOfPayload.md) | | [optional] + + + diff --git a/docs/ConversationPostbackEventAllOfPayload.md b/docs/ConversationPostbackEventAllOfPayload.md new file mode 100644 index 00000000..251ff4ab --- /dev/null +++ b/docs/ConversationPostbackEventAllOfPayload.md @@ -0,0 +1,16 @@ + + +# ConversationPostbackEventAllOfPayload + +The payload of the event. The contents of this object depend on the type of event. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**postback** | [**PostbackWebhook**](PostbackWebhook.md) | The postback associated with the event. | [optional] +**conversation** | [**ConversationTruncated**](ConversationTruncated.md) | The conversation linked to the postback. | [optional] +**user** | [**User**](User.md) | The user that triggered the postback. | [optional] +**source** | [**SourceWebhook**](SourceWebhook.md) | The source of the postback. | [optional] + + + diff --git a/docs/ConversationReadEvent.md b/docs/ConversationReadEvent.md new file mode 100644 index 00000000..4e9f5bbc --- /dev/null +++ b/docs/ConversationReadEvent.md @@ -0,0 +1,15 @@ + + +# ConversationReadEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**payload** | [**ConversationReadEventAllOfPayload**](ConversationReadEventAllOfPayload.md) | | [optional] + + + diff --git a/docs/ConversationReadEventAllOf.md b/docs/ConversationReadEventAllOf.md new file mode 100644 index 00000000..cba16683 --- /dev/null +++ b/docs/ConversationReadEventAllOf.md @@ -0,0 +1,12 @@ + + +# ConversationReadEventAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payload** | [**ConversationReadEventAllOfPayload**](ConversationReadEventAllOfPayload.md) | | [optional] + + + diff --git a/docs/ConversationReadEventAllOfPayload.md b/docs/ConversationReadEventAllOfPayload.md new file mode 100644 index 00000000..ef4f5e91 --- /dev/null +++ b/docs/ConversationReadEventAllOfPayload.md @@ -0,0 +1,14 @@ + + +# ConversationReadEventAllOfPayload + +The payload of the event. The contents of this object depend on the type of event. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conversation** | [**ConversationTruncated**](ConversationTruncated.md) | The conversation in which the message was read. | [optional] +**activity** | [**Activity**](Activity.md) | The activity that was sent. | [optional] + + + diff --git a/docs/ActivityResponse.md b/docs/ConversationResponse.md similarity index 78% rename from docs/ActivityResponse.md rename to docs/ConversationResponse.md index d2d3d21a..66a45f71 100644 --- a/docs/ActivityResponse.md +++ b/docs/ConversationResponse.md @@ -1,10 +1,12 @@ -# ActivityResponse + +# ConversationResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**conversation** | [**Conversation**](Conversation.md) | The conversation. | +**conversation** | [**Conversation**](Conversation.md) | The conversation. | [optional] diff --git a/docs/ConversationTruncated.md b/docs/ConversationTruncated.md new file mode 100644 index 00000000..bd1dc326 --- /dev/null +++ b/docs/ConversationTruncated.md @@ -0,0 +1,15 @@ + + +# ConversationTruncated + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the conversation. | [optional] +**type** | [**ConversationType**](ConversationType.md) | | [optional] +**activeSwitchboardIntegration** | [**SwitchboardIntegrationWebhook**](SwitchboardIntegrationWebhook.md) | The current switchboard integration that is in control of the conversation. This field is omitted if no `activeSwitchboardIntegration` exists for the conversation. | [optional] +**pendingSwitchboardIntegration** | [**SwitchboardIntegrationWebhook**](SwitchboardIntegrationWebhook.md) | The switchboard integration that is awaiting control. This field is omitted if no switchboard integration has been previously offered control. | [optional] + + + diff --git a/docs/ConversationType.md b/docs/ConversationType.md new file mode 100644 index 00000000..ffa40972 --- /dev/null +++ b/docs/ConversationType.md @@ -0,0 +1,13 @@ + + +# ConversationType + +## Enum + + +* `PERSONAL` (value: `"personal"`) + +* `SDKGROUP` (value: `"sdkGroup"`) + + + diff --git a/docs/ConversationTypingEvent.md b/docs/ConversationTypingEvent.md new file mode 100644 index 00000000..40926c08 --- /dev/null +++ b/docs/ConversationTypingEvent.md @@ -0,0 +1,15 @@ + + +# ConversationTypingEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**payload** | [**ConversationTypingEventAllOfPayload**](ConversationTypingEventAllOfPayload.md) | | [optional] + + + diff --git a/docs/ConversationTypingEventAllOf.md b/docs/ConversationTypingEventAllOf.md new file mode 100644 index 00000000..511b2687 --- /dev/null +++ b/docs/ConversationTypingEventAllOf.md @@ -0,0 +1,12 @@ + + +# ConversationTypingEventAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payload** | [**ConversationTypingEventAllOfPayload**](ConversationTypingEventAllOfPayload.md) | | [optional] + + + diff --git a/docs/ConversationTypingEventAllOfPayload.md b/docs/ConversationTypingEventAllOfPayload.md new file mode 100644 index 00000000..e3816145 --- /dev/null +++ b/docs/ConversationTypingEventAllOfPayload.md @@ -0,0 +1,14 @@ + + +# ConversationTypingEventAllOfPayload + +The payload of the event. The contents of this object depend on the type of event. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conversation** | [**ConversationTruncated**](ConversationTruncated.md) | The conversation in which the activity was sent. | [optional] +**activity** | [**Activity**](Activity.md) | The activity that was sent. | [optional] + + + diff --git a/docs/ConversationUpdateBody.md b/docs/ConversationUpdateBody.md new file mode 100644 index 00000000..e26f7c5b --- /dev/null +++ b/docs/ConversationUpdateBody.md @@ -0,0 +1,15 @@ + + +# ConversationUpdateBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**displayName** | **String** | A friendly name for the conversation, may be displayed to the business or the user. | [optional] +**description** | **String** | A short text describing the conversation. | [optional] +**iconUrl** | [**URI**](URI.md) | A custom conversation icon url. The image must be in either JPG, PNG, or GIF format | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] + + + diff --git a/docs/ConversationsApi.md b/docs/ConversationsApi.md new file mode 100644 index 00000000..98e297a6 --- /dev/null +++ b/docs/ConversationsApi.md @@ -0,0 +1,413 @@ +# ConversationsApi + +All URIs are relative to *https://api.smooch.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createConversation**](ConversationsApi.md#createConversation) | **POST** /v2/apps/{appId}/conversations | Create Conversation +[**deleteConversation**](ConversationsApi.md#deleteConversation) | **DELETE** /v2/apps/{appId}/conversations/{conversationId} | Delete Conversation +[**getConversation**](ConversationsApi.md#getConversation) | **GET** /v2/apps/{appId}/conversations/{conversationId} | Get Conversation +[**listConversations**](ConversationsApi.md#listConversations) | **GET** /v2/apps/{appId}/conversations | List Conversations +[**updateConversation**](ConversationsApi.md#updateConversation) | **PATCH** /v2/apps/{appId}/conversations/{conversationId} | Update Conversation + + + +## createConversation + +> ConversationResponse createConversation(conversationCreateBody, appId) + +Create Conversation + +Create a conversation for the specified user(s). + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.ConversationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + ConversationsApi apiInstance = new ConversationsApi(defaultClient); + ConversationCreateBody conversationCreateBody = new ConversationCreateBody(); // ConversationCreateBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + // Add required body parameters + + try { + ConversationResponse result = apiInstance.createConversation(conversationCreateBody, appId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConversationsApi#createConversation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **conversationCreateBody** | [**ConversationCreateBody**](ConversationCreateBody.md)| | + **appId** | **String**| Identifies the app. | + +### Return type + +[**ConversationResponse**](ConversationResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **404** | App not found | - | + + +## deleteConversation + +> Object deleteConversation(appId, conversationId) + +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). + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.ConversationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + ConversationsApi apiInstance = new ConversationsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation. + // Add required body parameters + + try { + Object result = apiInstance.deleteConversation(appId, conversationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConversationsApi#deleteConversation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **conversationId** | **String**| Identifies the conversation. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **400** | Conversation c93bb9c14dde8ffb94564eae cannot be deleted because it is the default. | - | +| **404** | Conversation not found | - | + + +## getConversation + +> ConversationResponse getConversation(appId, conversationId) + +Get Conversation + +Fetches an individual conversation. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.ConversationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + ConversationsApi apiInstance = new ConversationsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation. + // Add required body parameters + + try { + ConversationResponse result = apiInstance.getConversation(appId, conversationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConversationsApi#getConversation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **conversationId** | **String**| Identifies the conversation. | + +### Return type + +[**ConversationResponse**](ConversationResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Conversation not found | - | + + +## listConversations + +> ConversationListResponse listConversations(appId, filter, page) + +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 ``` + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.ConversationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + ConversationsApi apiInstance = new ConversationsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + ConversationListFilter filter = new ConversationListFilter(); // ConversationListFilter | Contains parameters for filtering the results. + Page page = new Page(); // Page | Contains parameters for applying cursor pagination. + // Add required body parameters + + try { + ConversationListResponse result = apiInstance.listConversations(appId, filter, page); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConversationsApi#listConversations"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **filter** | [**ConversationListFilter**](.md)| Contains parameters for filtering the results. | + **page** | [**Page**](.md)| Contains parameters for applying cursor pagination. | [optional] + +### Return type + +[**ConversationListResponse**](ConversationListResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | User not found | - | + + +## updateConversation + +> ConversationResponse updateConversation(conversationUpdateBody, appId, conversationId) + +Update Conversation + +Updates a conversation record. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.ConversationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + ConversationsApi apiInstance = new ConversationsApi(defaultClient); + ConversationUpdateBody conversationUpdateBody = new ConversationUpdateBody(); // ConversationUpdateBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation. + // Add required body parameters + + try { + ConversationResponse result = apiInstance.updateConversation(conversationUpdateBody, appId, conversationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConversationsApi#updateConversation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **conversationUpdateBody** | [**ConversationUpdateBody**](ConversationUpdateBody.md)| | + **appId** | **String**| Identifies the app. | + **conversationId** | **String**| Identifies the conversation. | + +### Return type + +[**ConversationResponse**](ConversationResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Conversation not found | - | + diff --git a/docs/Coordinates.md b/docs/Coordinates.md deleted file mode 100644 index 29c85aeb..00000000 --- a/docs/Coordinates.md +++ /dev/null @@ -1,11 +0,0 @@ - -# Coordinates - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**lat** | **Double** | A floating point value representing the latitude of the location. | -**_long** | **Double** | A floating point value representing the longitude of the location. | - - - diff --git a/docs/Custom.md b/docs/Custom.md new file mode 100644 index 00000000..69942b0f --- /dev/null +++ b/docs/Custom.md @@ -0,0 +1,13 @@ + + +# Custom + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**webhooks** | [**List<Webhook>**](Webhook.md) | An array of webhooks associated with the custom integration. | + + + diff --git a/docs/CustomAllOf.md b/docs/CustomAllOf.md new file mode 100644 index 00000000..3357cefe --- /dev/null +++ b/docs/CustomAllOf.md @@ -0,0 +1,13 @@ + + +# CustomAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**webhooks** | [**List<Webhook>**](Webhook.md) | An array of webhooks associated with the custom integration. | + + + diff --git a/docs/CustomIntegrationApiKeysApi.md b/docs/CustomIntegrationApiKeysApi.md new file mode 100644 index 00000000..309e535f --- /dev/null +++ b/docs/CustomIntegrationApiKeysApi.md @@ -0,0 +1,331 @@ +# CustomIntegrationApiKeysApi + +All URIs are relative to *https://api.smooch.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createCustomIntegrationKey**](CustomIntegrationApiKeysApi.md#createCustomIntegrationKey) | **POST** /v2/apps/{appId}/integrations/{integrationId}/keys | Create Integration Key +[**deleteCustomIntegrationKey**](CustomIntegrationApiKeysApi.md#deleteCustomIntegrationKey) | **DELETE** /v2/apps/{appId}/integrations/{integrationId}/keys/{keyId} | Delete Integration Key +[**getCustomIntegrationKey**](CustomIntegrationApiKeysApi.md#getCustomIntegrationKey) | **GET** /v2/apps/{appId}/integrations/{integrationId}/keys/{keyId} | Get Integration Key +[**listCustomIntegrationKeys**](CustomIntegrationApiKeysApi.md#listCustomIntegrationKeys) | **GET** /v2/apps/{appId}/integrations/{integrationId}/keys | List Integration Keys + + + +## createCustomIntegrationKey + +> IntegrationApiKeyResponse createCustomIntegrationKey(integrationApiKey, appId, integrationId) + +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. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.CustomIntegrationApiKeysApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + CustomIntegrationApiKeysApi apiInstance = new CustomIntegrationApiKeysApi(defaultClient); + IntegrationApiKey integrationApiKey = new IntegrationApiKey(); // IntegrationApiKey | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String integrationId = "029c31f25a21b47effd7be90"; // String | The id of the integration. + // Add required body parameters + + try { + IntegrationApiKeyResponse result = apiInstance.createCustomIntegrationKey(integrationApiKey, appId, integrationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CustomIntegrationApiKeysApi#createCustomIntegrationKey"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integrationApiKey** | [**IntegrationApiKey**](IntegrationApiKey.md)| | + **appId** | **String**| Identifies the app. | + **integrationId** | **String**| The id of the integration. | + +### Return type + +[**IntegrationApiKeyResponse**](IntegrationApiKeyResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | + + +## deleteCustomIntegrationKey + +> Object deleteCustomIntegrationKey(appId, integrationId, keyId) + +Delete Integration Key + +Removes an API key. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.CustomIntegrationApiKeysApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + CustomIntegrationApiKeysApi apiInstance = new CustomIntegrationApiKeysApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String integrationId = "029c31f25a21b47effd7be90"; // String | The id of the integration. + String keyId = "int_5d8cff3cd55b040010928b5b"; // String | The id of the key. + // Add required body parameters + + try { + Object result = apiInstance.deleteCustomIntegrationKey(appId, integrationId, keyId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CustomIntegrationApiKeysApi#deleteCustomIntegrationKey"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **integrationId** | **String**| The id of the integration. | + **keyId** | **String**| The id of the key. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | + + +## getCustomIntegrationKey + +> IntegrationApiKeyResponse getCustomIntegrationKey(appId, integrationId, keyId) + +Get Integration Key + +Get the specified API key. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.CustomIntegrationApiKeysApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + CustomIntegrationApiKeysApi apiInstance = new CustomIntegrationApiKeysApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String integrationId = "029c31f25a21b47effd7be90"; // String | The id of the integration. + String keyId = "int_5d8cff3cd55b040010928b5b"; // String | The id of the key. + // Add required body parameters + + try { + IntegrationApiKeyResponse result = apiInstance.getCustomIntegrationKey(appId, integrationId, keyId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CustomIntegrationApiKeysApi#getCustomIntegrationKey"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **integrationId** | **String**| The id of the integration. | + **keyId** | **String**| The id of the key. | + +### Return type + +[**IntegrationApiKeyResponse**](IntegrationApiKeyResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | + + +## listCustomIntegrationKeys + +> IntegrationApiKeyListResponse listCustomIntegrationKeys(appId, integrationId) + +List Integration Keys + +Lists all API keys for a given integration. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.CustomIntegrationApiKeysApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + CustomIntegrationApiKeysApi apiInstance = new CustomIntegrationApiKeysApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String integrationId = "029c31f25a21b47effd7be90"; // String | The id of the integration. + // Add required body parameters + + try { + IntegrationApiKeyListResponse result = apiInstance.listCustomIntegrationKeys(appId, integrationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CustomIntegrationApiKeysApi#listCustomIntegrationKeys"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **integrationId** | **String**| The id of the integration. | + +### Return type + +[**IntegrationApiKeyListResponse**](IntegrationApiKeyListResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **400** | API keys are available only for custom integrations | - | + diff --git a/docs/CustomUpdate.md b/docs/CustomUpdate.md new file mode 100644 index 00000000..f67d526b --- /dev/null +++ b/docs/CustomUpdate.md @@ -0,0 +1,15 @@ + + +# CustomUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + +## Implemented Interfaces + +* IntegrationUpdate + + diff --git a/docs/Deployment.md b/docs/Deployment.md deleted file mode 100644 index 5025391f..00000000 --- a/docs/Deployment.md +++ /dev/null @@ -1,19 +0,0 @@ - -# Deployment - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **String** | The deployment ID, generated automatically. | -**status** | **String** | The deployment status. See [**DeploymentStatusEnum**](Enums.md#DeploymentStatusEnum) for available values. | -**hosting** | **String** | The deployment hosting. See [**DeploymentHostingEnum**](Enums.md#DeploymentHostingEnum) for available values. | -**baseUrl** | **String** | The baseUrl of the deployment. Only present for `self` hosted deployments. | [optional] -**username** | **String** | The username of the deployment. Only present for `self` hosted deployments. | [optional] -**phoneNumber** | **String** | The phoneNumber of the deployment. Only present once the deployment has been registered. | [optional] -**callbackUrl** | **String** | The URL to be called by Smooch when the status of the deployment changes. | [optional] -**callbackSecret** | **String** | The secret used to secure the callback. | [optional] -**integrationId** | **String** | The integrationId of the integration using this deployment. | [optional] -**appId** | **String** | The appId of the integration using this deployment. | [optional] - - - diff --git a/docs/DeploymentActivatePhoneNumber.md b/docs/DeploymentActivatePhoneNumber.md deleted file mode 100644 index d79a0b3c..00000000 --- a/docs/DeploymentActivatePhoneNumber.md +++ /dev/null @@ -1,12 +0,0 @@ - -# DeploymentActivatePhoneNumber - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**phoneNumber** | **String** | The phone number to send the activation code to. | -**verifiedNameCertificate** | **String** | The verified name certificate for the phone number. | -**method** | **String** | The method desired to receive the activation code. See [**DeploymentActivationMethodEnum**](Enums.md#DeploymentActivationMethodEnum) for available values. | - - - diff --git a/docs/DeploymentApi.md b/docs/DeploymentApi.md deleted file mode 100644 index 9c4c2af0..00000000 --- a/docs/DeploymentApi.md +++ /dev/null @@ -1,391 +0,0 @@ -# DeploymentApi - -All URIs are relative to *https://api.smooch.io* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**activatePhoneNumber**](DeploymentApi.md#activatePhoneNumber) | **POST** /v1.1/whatsapp/deployments/{deploymentId}/activate | -[**confirmCode**](DeploymentApi.md#confirmCode) | **POST** /v1.1/whatsapp/deployments/{deploymentId}/code/confirm | -[**createDeployment**](DeploymentApi.md#createDeployment) | **POST** /v1.1/whatsapp/deployments | -[**deleteDeployment**](DeploymentApi.md#deleteDeployment) | **DELETE** /v1.1/whatsapp/deployments/{deploymentId} | -[**getDeployment**](DeploymentApi.md#getDeployment) | **GET** /v1.1/whatsapp/deployments/{deploymentId} | -[**listDeployments**](DeploymentApi.md#listDeployments) | **GET** /v1.1/whatsapp/deployments | - - - -# **activatePhoneNumber** -> DeploymentResponse activatePhoneNumber(deploymentId, deploymentActivatePhoneNumberBody) - - - -Activate a phone number on the specified deployment. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.DeploymentApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -DeploymentApi apiInstance = new DeploymentApi(); -String deploymentId = "deploymentId_example"; // String | Identifies the deployment. -DeploymentActivatePhoneNumber deploymentActivatePhoneNumberBody = new DeploymentActivatePhoneNumber(); // DeploymentActivatePhoneNumber | Body for an activatePhoneNumber request. -try { - DeploymentResponse result = apiInstance.activatePhoneNumber(deploymentId, deploymentActivatePhoneNumberBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling DeploymentApi#activatePhoneNumber"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **deploymentId** | **String**| Identifies the deployment. | - **deploymentActivatePhoneNumberBody** | [**DeploymentActivatePhoneNumber**](DeploymentActivatePhoneNumber.md)| Body for an activatePhoneNumber request. | - -### Return type - -[**DeploymentResponse**](DeploymentResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **confirmCode** -> DeploymentResponse confirmCode(deploymentId, deploymentConfirmCode) - - - -Confirm code to complete phone number activation. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.DeploymentApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -DeploymentApi apiInstance = new DeploymentApi(); -String deploymentId = "deploymentId_example"; // String | Identifies the deployment. -DeploymentConfirmCode deploymentConfirmCode = new DeploymentConfirmCode(); // DeploymentConfirmCode | Body for a confirmCode request. -try { - DeploymentResponse result = apiInstance.confirmCode(deploymentId, deploymentConfirmCode); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling DeploymentApi#confirmCode"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **deploymentId** | **String**| Identifies the deployment. | - **deploymentConfirmCode** | [**DeploymentConfirmCode**](DeploymentConfirmCode.md)| Body for a confirmCode request. | - -### Return type - -[**DeploymentResponse**](DeploymentResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **createDeployment** -> DeploymentResponse createDeployment(deploymentCreateBody) - - - -Create a WhatsApp deployment. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.DeploymentApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -DeploymentApi apiInstance = new DeploymentApi(); -DeploymentCreate deploymentCreateBody = new DeploymentCreate(); // DeploymentCreate | Body for a createDeployment request. -try { - DeploymentResponse result = apiInstance.createDeployment(deploymentCreateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling DeploymentApi#createDeployment"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **deploymentCreateBody** | [**DeploymentCreate**](DeploymentCreate.md)| Body for a createDeployment request. | - -### Return type - -[**DeploymentResponse**](DeploymentResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **deleteDeployment** -> deleteDeployment(deploymentId) - - - -Delete the specified deployment. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.DeploymentApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -DeploymentApi apiInstance = new DeploymentApi(); -String deploymentId = "deploymentId_example"; // String | Identifies the deployment. -try { - apiInstance.deleteDeployment(deploymentId); -} catch (ApiException e) { - System.err.println("Exception when calling DeploymentApi#deleteDeployment"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **deploymentId** | **String**| Identifies the deployment. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getDeployment** -> DeploymentResponse getDeployment(deploymentId) - - - -Get the specified deployment. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.DeploymentApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -DeploymentApi apiInstance = new DeploymentApi(); -String deploymentId = "deploymentId_example"; // String | Identifies the deployment. -try { - DeploymentResponse result = apiInstance.getDeployment(deploymentId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling DeploymentApi#getDeployment"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **deploymentId** | **String**| Identifies the deployment. | - -### Return type - -[**DeploymentResponse**](DeploymentResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **listDeployments** -> ListDeploymentsResponse listDeployments() - - - -List owned WhatsApp deployments. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.DeploymentApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -DeploymentApi apiInstance = new DeploymentApi(); -try { - ListDeploymentsResponse result = apiInstance.listDeployments(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling DeploymentApi#listDeployments"); - e.printStackTrace(); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**ListDeploymentsResponse**](ListDeploymentsResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - diff --git a/docs/DeploymentCreate.md b/docs/DeploymentCreate.md deleted file mode 100644 index 5aceb619..00000000 --- a/docs/DeploymentCreate.md +++ /dev/null @@ -1,14 +0,0 @@ - -# DeploymentCreate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**hosting** | **String** | The deployment hosting. See [**DeploymentHostingEnum**](Enums.md#DeploymentHostingEnum) for available values. | -**baseUrl** | **String** | The base URL to access your WhatsApp EC. Only provide for `self` hosted deployments. | [optional] -**username** | **String** | The username to access your WhatsApp EC. Only provide for `self` hosted deployments. | [optional] -**password** | **String** | The password to access your WhatsApp EC. Only provide for `self` hosted deployments. | [optional] -**callbackUrl** | **String** | The URL to be called by Smooch when the status of the deployment changes. | [optional] - - - diff --git a/docs/Destination.md b/docs/Destination.md index 290bf7b6..d3f75b2a 100644 --- a/docs/Destination.md +++ b/docs/Destination.md @@ -1,11 +1,11 @@ -# Destination -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**integrationId** | **String** | The ID of the target integration. | -**integrationType** | **String** | The type of the target integration. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values. | +# Interface Destination +The destination of the message, in the case of channel targeting. Only applicable if the author role is `business` and the conversation is of type `personal`. +## Implementing Classes + +* IntegrationId +* IntegrationType diff --git a/docs/Device.md b/docs/Device.md new file mode 100644 index 00000000..02fda304 --- /dev/null +++ b/docs/Device.md @@ -0,0 +1,40 @@ + + +# Device + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the device. | [optional] +**type** | [**TypeEnum**](#TypeEnum) | The type of integration that the device represents. | [optional] +**guid** | **String** | A unique identifier for the device, generated client-side by the SDK. | [optional] +**clientId** | **String** | The id of the client to which this device is associated. | [optional] +**status** | [**StatusEnum**](#StatusEnum) | The device status. Indicates if the device will receive push notifications or not. | [optional] +**integrationId** | **String** | The ID of the integration that the device was created for. | [optional] +**lastSeen** | **String** | A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the last time the user interacted with this device. | [optional] +**pushNotificationToken** | **String** | The token used for push notifications on Android and iOS devices. | [optional] +**info** | [**Object**](.md) | A flat curated object with properties that vary for each SDK platform. All keys are optional and not guaranteed to be available. | [optional] +**appVersion** | **String** | Version of the mobile app in which the SDK is embedded. Not applicable for devices of type web. | [optional] + + + +## Enum: TypeEnum + +Name | Value +---- | ----- +ANDROID | "android" +IOS | "ios" +WEB | "web" + + + +## Enum: StatusEnum + +Name | Value +---- | ----- +ACTIVE | "active" +INACTIVE | "inactive" + + + diff --git a/docs/DisplaySettings.md b/docs/DisplaySettings.md deleted file mode 100644 index bb72ed09..00000000 --- a/docs/DisplaySettings.md +++ /dev/null @@ -1,10 +0,0 @@ - -# DisplaySettings - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**imageAspectRatio** | **String** | Specifies how to display all carousel images. See [**ImageAspectRatioEnum**](Enums.md#ImageAspectRatioEnum) for available values. | [optional] - - - diff --git a/docs/Enums.md b/docs/Enums.md deleted file mode 100644 index 365f9b56..00000000 --- a/docs/Enums.md +++ /dev/null @@ -1,238 +0,0 @@ - -# Enums - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**actionSize** | [**ActionSizeEnum**](#ActionSizeEnum) | | [optional] -**actionType** | [**ActionTypeEnum**](#ActionTypeEnum) | | [optional] -**businessSystemType** | [**BusinessSystemTypeEnum**](#BusinessSystemTypeEnum) | | [optional] -**clientStatus** | [**ClientStatusEnum**](#ClientStatusEnum) | | [optional] -**confirmationType** | [**ConfirmationTypeEnum**](#ConfirmationTypeEnum) | | [optional] -**conversationActivityType** | [**ConversationActivityTypeEnum**](#ConversationActivityTypeEnum) | | [optional] -**deploymentActivationMethod** | [**DeploymentActivationMethodEnum**](#DeploymentActivationMethodEnum) | | [optional] -**deploymentHosting** | [**DeploymentHostingEnum**](#DeploymentHostingEnum) | | [optional] -**deploymentStatus** | [**DeploymentStatusEnum**](#DeploymentStatusEnum) | | [optional] -**imageAspectRatio** | [**ImageAspectRatioEnum**](#ImageAspectRatioEnum) | | [optional] -**integrationStatus** | [**IntegrationStatusEnum**](#IntegrationStatusEnum) | | [optional] -**integrationType** | [**IntegrationTypeEnum**](#IntegrationTypeEnum) | | [optional] -**menuItemType** | [**MenuItemTypeEnum**](#MenuItemTypeEnum) | | [optional] -**messageItemSize** | [**MessageItemSizeEnum**](#MessageItemSizeEnum) | | [optional] -**messageType** | [**MessageTypeEnum**](#MessageTypeEnum) | | [optional] -**fieldType** | [**FieldTypeEnum**](#FieldTypeEnum) | | [optional] -**quotedMessageType** | [**QuotedMessageTypeEnum**](#QuotedMessageTypeEnum) | | [optional] -**role** | [**RoleEnum**](#RoleEnum) | | [optional] -**webhookTriggers** | [**WebhookTriggersEnum**](#WebhookTriggersEnum) | | [optional] - - - -## Enum: ActionSizeEnum -Name | Value ----- | ----- -COMPACT | "compact" -FULL | "full" -TALL | "tall" - - - -## Enum: ActionTypeEnum -Name | Value ----- | ----- -BUY | "buy" -LINK | "link" -LOCATIONREQUEST | "locationRequest" -POSTBACK | "postback" -REPLY | "reply" -SHARE | "share" -WEBVIEW | "webview" - - - -## Enum: BusinessSystemTypeEnum -Name | Value ----- | ----- -HELPSCOUT | "helpscout" -SLACK | "slack" -ZENDESK | "zendesk" - - - -## Enum: ClientStatusEnum -Name | Value ----- | ----- -ACTIVE | "active" -BLOCKED | "blocked" -INACTIVE | "inactive" -PENDING | "pending" - - - -## Enum: ConfirmationTypeEnum -Name | Value ----- | ----- -IMMEDIATE | "immediate" -USERACTIVITY | "userActivity" -PROMPT | "prompt" - - - -## Enum: ConversationActivityTypeEnum -Name | Value ----- | ----- -CONVERSATION_READ | "conversation:read" -TYPING_START | "typing:start" -TYPING_STOP | "typing:stop" - - - -## Enum: DeploymentActivationMethodEnum -Name | Value ----- | ----- -SMS | "sms" -VOICE | "voice" - - - -## Enum: DeploymentHostingEnum -Name | Value ----- | ----- -SELF | "self" -SMOOCH | "smooch" - - - -## Enum: DeploymentStatusEnum -Name | Value ----- | ----- -DELETING | "deleting" -ERROR | "error" -INTEGRATED | "integrated" -PENDING | "pending" -REGISTERED | "registered" -STARTING | "starting" -UNREGISTERED | "unregistered" - - - -## Enum: ImageAspectRatioEnum -Name | Value ----- | ----- -HORIZONTAL | "horizontal" -SQUARE | "square" - - - -## Enum: IntegrationStatusEnum -Name | Value ----- | ----- -ACTIVE | "active" -INACTIVE | "inactive" -ERROR | "error" - - - -## Enum: IntegrationTypeEnum -Name | Value ----- | ----- -ANDROID | "android" -API | "api" -APN | "apn" -FCM | "fcm" -IOS | "ios" -LINE | "line" -MAILGUN | "mailgun" -MESSAGEBIRD | "messagebird" -MESSENGER | "messenger" -TELEGRAM | "telegram" -TWILIO | "twilio" -TWITTER | "twitter" -VIBER | "viber" -WEB | "web" -WECHAT | "wechat" -WHATSAPP | "whatsapp" - - - -## Enum: MenuItemTypeEnum -Name | Value ----- | ----- -LINK | "link" -POSTBACK | "postback" -SUBMENU | "submenu" - - - -## Enum: MessageItemSizeEnum -Name | Value ----- | ----- -COMPACT | "compact" -LARGE | "large" - - - -## Enum: MessageTypeEnum -Name | Value ----- | ----- -CAROUSEL | "carousel" -FILE | "file" -IMAGE | "image" -LIST | "list" -LOCATION | "location" -TEXT | "text" -FORM | "form" -FORMRESPONSE | "formResponse" - - - -## Enum: FieldTypeEnum -Name | Value ----- | ----- -TEXT | "text" -EMAIL | "email" -SELECT | "select" - - - -## Enum: QuotedMessageTypeEnum -Name | Value ----- | ----- -MESSAGE | "message" -EXTERNALMESSAGEID | "externalMessageId" - - - -## Enum: RoleEnum -Name | Value ----- | ----- -APPMAKER | "appMaker" -APPUSER | "appUser" - - - -## Enum: WebhookTriggersEnum -Name | Value ----- | ----- -APPUSER_DELETE | "appUser:delete" -CLIENT_ADD | "client:add" -CLIENT_REMOVE | "client:remove" -CONVERSATION_READ | "conversation:read" -CONVERSATION_REFERRAL | "conversation:referral" -CONVERSATION_START | "conversation:start" -LINK_FAILURE | "link:failure" -LINK_MATCH | "link:match" -LINK_SUCCESS | "link:success" -MERGE_APPUSER | "merge:appUser" -MESSAGE_APPMAKER | "message:appMaker" -MESSAGE_APPUSER | "message:appUser" -MESSAGE_DELIVERY_CHANNEL | "message:delivery:channel" -MESSAGE_DELIVERY_FAILURE | "message:delivery:failure" -MESSAGE_DELIVERY_USER | "message:delivery:user" -NOTIFICATION_DELIVERY_CHANNEL | "notification:delivery:channel" -NOTIFICATION_DELIVERY_FAILURE | "notification:delivery:failure" -NOTIFICATION_DELIVERY_USER | "notification:delivery:user" -PAYMENT_SUCCESS | "payment:success" -POSTBACK | "postback" -TYPING_APPUSER | "typing:appUser" - - - diff --git a/docs/EventSubSchema.md b/docs/EventSubSchema.md new file mode 100644 index 00000000..d34c1bca --- /dev/null +++ b/docs/EventSubSchema.md @@ -0,0 +1,14 @@ + + +# EventSubSchema + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] + + + diff --git a/docs/ExtraChannelOptions.md b/docs/ExtraChannelOptions.md new file mode 100644 index 00000000..a6937ba8 --- /dev/null +++ b/docs/ExtraChannelOptions.md @@ -0,0 +1,13 @@ + + +# ExtraChannelOptions + +Extra options to pass directly to the channel API. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**messenger** | [**ExtraChannelOptionsMessenger**](ExtraChannelOptionsMessenger.md) | | [optional] + + + diff --git a/docs/ExtraChannelOptionsMessenger.md b/docs/ExtraChannelOptionsMessenger.md new file mode 100644 index 00000000..a0014f65 --- /dev/null +++ b/docs/ExtraChannelOptionsMessenger.md @@ -0,0 +1,22 @@ + + +# ExtraChannelOptionsMessenger + +Messenger channel options. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**messengerExtensions** | **Boolean** | For webview type actions, a boolean value indicating whether the URL should be loaded with Messenger Extensions enabled. [More info](https://developers.facebook.com/docs/messenger-platform/send-api-reference/url-button). | [optional] +**webviewShareButton** | [**WebviewShareButtonEnum**](#WebviewShareButtonEnum) | For webview type actions, a string value indicating if the share button should be hidden. [More Info](https://developers.facebook.com/docs/messenger-platform/reference/buttons/url). | [optional] + + + +## Enum: WebviewShareButtonEnum + +Name | Value +---- | ----- +HIDE | "hide" + + + diff --git a/docs/Field.md b/docs/Field.md index 066b01f1..ebfb1beb 100644 --- a/docs/Field.md +++ b/docs/Field.md @@ -1,21 +1,32 @@ + # Field +Properties that can be expected to receive inside a form or formResponse message field. ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **String** | The field ID, generated automatically. | [optional] -**type** | **String** | The field type. See [**FieldTypeEnum**](Enums.md#FieldTypeEnum) for available values. | -**name** | **String** | The name of the field. Each field name must be unique per form. | -**label** | **String** | The label to be displayed with the field. | -**placeholder** | **String** | The placeholder text of the field that will be rendered. Only for form messages | [optional] -**minSize** | **Integer** | The minimum possible length of the response. Defaults to 1 if not specified. Only for text fields in form messages. | [optional] -**maxSize** | **Integer** | The maximum possible length of the response. Defaults to 128 if not specified. Only for text fields in form messages. | [optional] -**options** | [**List<Option>**](Option.md) | The field options that can be selected. The array is limited to 20 options. Only for select fields in form messages. | [optional] -**selectSize** | **Integer** | The select size, generated automatically. Only for select fields in form messages. | [optional] -**text** | **String** | The text response to a text field. Required for text fields in form response messages. | [optional] -**email** | **String** | The email response to an email field. Required for email fields in form response messages. | [optional] -**select** | [**List<Select>**](Select.md) | The options selected as a response to a select field. Required for select fields in form response messages. | [optional] +**type** | [**TypeEnum**](#TypeEnum) | The field type. | +**name** | **String** | The name of the field. Must be unique per form or formResponse. | +**label** | **String** | The label of the field. What the field is displayed as on Web Messenger. | +**placeholder** | **String** | Placeholder text for the field. form message only. | [optional] +**minSize** | **Integer** | The minimum allowed length for the response for a field of type text. form message only. | [optional] +**maxSize** | **Integer** | The maximum allowed length for the response for a field of type text. form message only. | [optional] +**text** | **String** | Specifies the response for a text field. | [optional] +**email** | **String** | Specifies the response for a email field. | [optional] +**select** | **List<Object>** | Array of objects representing the response for a field of type select. form and formResponse messages only. | [optional] +**options** | **List<Object>** | Array of objects representing options for a field of type select. | [optional] + + + +## Enum: TypeEnum + +Name | Value +---- | ----- +EMAIL | "email" +SELECT | "select" +TEXT | "text" diff --git a/docs/FieldPost.md b/docs/FieldPost.md deleted file mode 100644 index a445eaf4..00000000 --- a/docs/FieldPost.md +++ /dev/null @@ -1,16 +0,0 @@ - -# FieldPost - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **String** | The field type. See [**FieldTypeEnum**](Enums.md#FieldTypeEnum) for available values. | -**name** | **String** | The name of the field. Each field name must be unique per form. | -**label** | **String** | The label to be displayed with the field. | -**placeholder** | **String** | The placeholder text of the field that will be rendered. Only for form messages | [optional] -**minSize** | **Integer** | The minimum possible length of the response. Defaults to 1 if not specified. Only for text fields in form messages. | [optional] -**maxSize** | **Integer** | The maximum possible length of the response. Defaults to 128 if not specified. Only for text fields in form messages. | [optional] -**options** | [**List<Option>**](Option.md) | The field options that can be selected. The array is limited to 20 options. Only for select fields in form messages. | [optional] - - - diff --git a/docs/FileMessage.md b/docs/FileMessage.md new file mode 100644 index 00000000..3bd02b3c --- /dev/null +++ b/docs/FileMessage.md @@ -0,0 +1,20 @@ + + +# FileMessage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of message. | +**text** | **String** | The text content of the message. | [optional] +**mediaUrl** | [**URI**](URI.md) | The URL for media, such as an image, attached to the message. | [optional] +**mediaSize** | [**BigDecimal**](BigDecimal.md) | The size of the media. | [optional] [readonly] +**mediaType** | **String** | The media type of the file. | [optional] [readonly] + + +## Implemented Interfaces + +* Content + + diff --git a/docs/FormMessage.md b/docs/FormMessage.md new file mode 100644 index 00000000..3f236877 --- /dev/null +++ b/docs/FormMessage.md @@ -0,0 +1,19 @@ + + +# FormMessage + +A form type message without text or actions. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of message. | +**blockChatInput** | **Boolean** | true if the message should block the chat input on Web Messenger. form message only. | [optional] +**fields** | [**List<Field>**](Field.md) | An array of objects representing fields associated with the message. Only present in form and formResponse messages. | + + +## Implemented Interfaces + +* Content + + diff --git a/docs/FormResponseMessage.md b/docs/FormResponseMessage.md new file mode 100644 index 00000000..0a0192bf --- /dev/null +++ b/docs/FormResponseMessage.md @@ -0,0 +1,19 @@ + + +# FormResponseMessage + +A formResponse type message is a response to a form type message. formResponse type messages are only supported as responses to form messages on Web Messenger and cannot be sent via the API. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of message. | +**fields** | [**List<Field>**](Field.md) | Array of field objects that contain the submitted fields. | +**textFallback** | **String** | A string containing the `label: value` of all fields, each separated by a newline character. | [optional] [readonly] + + +## Implemented Interfaces + +* Content + + diff --git a/docs/GetIntegrationProfileResponse.md b/docs/GetIntegrationProfileResponse.md deleted file mode 100644 index 474a3590..00000000 --- a/docs/GetIntegrationProfileResponse.md +++ /dev/null @@ -1,10 +0,0 @@ - -# GetIntegrationProfileResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**profile** | **Object** | JSON object containing the integration profile. [More info](https://docs.smooch.io/rest/#get-integration-profile) | [optional] - - - diff --git a/docs/GetMessagesResponse.md b/docs/GetMessagesResponse.md deleted file mode 100644 index 976dc038..00000000 --- a/docs/GetMessagesResponse.md +++ /dev/null @@ -1,12 +0,0 @@ - -# GetMessagesResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**conversation** | [**Conversation**](Conversation.md) | The conversation. | [optional] -**messages** | [**List<Message>**](Message.md) | The messages. | [optional] -**next** | **String** | The URI for the next set of messages in the conversation. | [optional] - - - diff --git a/docs/GetSdkIdsResponse.md b/docs/GetSdkIdsResponse.md deleted file mode 100644 index 3afe778d..00000000 --- a/docs/GetSdkIdsResponse.md +++ /dev/null @@ -1,12 +0,0 @@ - -# GetSdkIdsResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**androidIntegrationId** | **String** | The ID of the `android` integration, used when initializing the Android SDK. | -**iosIntegrationId** | **String** | The ID of the `ios` integration, used when initializing the iOS SDK. | -**webIntegrationId** | **String** | The ID of the `web` integration, used when initializing the Web Messenger SDK. | - - - diff --git a/docs/ImageMessage.md b/docs/ImageMessage.md new file mode 100644 index 00000000..ef5cc1e0 --- /dev/null +++ b/docs/ImageMessage.md @@ -0,0 +1,19 @@ + + +# ImageMessage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of message. | +**text** | **String** | The text content of the message. Optional only if actions are provided. | [optional] +**actions** | [**List<Action>**](Action.md) | Array of message actions. | [optional] +**mediaUrl** | [**URI**](URI.md) | The URL for media, such as an image, attached to the message. | [optional] + + +## Implemented Interfaces + +* Content + + diff --git a/docs/Integration.md b/docs/Integration.md index 6f037cea..4cf9e6d7 100644 --- a/docs/Integration.md +++ b/docs/Integration.md @@ -1,77 +1,16 @@ + # Integration +The integration. ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **String** | The integration ID, generated automatically. | -**type** | **String** | The integration type. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values. | -**displayName** | **String** | The integration display name. Used to map a human-friendly name to an integration. | [optional] -**pageAccessToken** | **String** | Facebook Page Access Token. Required for *messenger* integrations. | [optional] -**appId** | **String** | Facebook App ID OR WeChat App ID. Required for *messenger* and *wechat* integrations. | [optional] -**appSecret** | **String** | Facebook Page App Secret OR WeChat App Secret. Required for *messenger* and *wechat* integrations. | [optional] -**accessTokenUrl** | **String** | Optional endpoint to generate access tokens for WeChat. Used to coordinate API access with third party systems. | [optional] -**webhookSecret** | **String** | Secret to verify webhooks. Returned on successful *wechat* and *messagebird* integrations. | [optional] -**pageId** | **String** | Facebook Page App ID. Returned on successful *messenger* integrations. | [optional] -**accountSid** | **String** | Twilio Account SID. Required for *twilio* integrations. | [optional] -**authToken** | **String** | Twilio Auth Token. Required for *twilio* integrations. | [optional] -**phoneNumberSid** | **String** | SID for specific phone number. Required for *twilio* integrations. | [optional] -**phoneNumber** | **String** | Smooch will receive all messages sent to this phone number. Returned on successful *twilio* integrations. | [optional] -**name** | **String** | Name on the account. Returned on successful *twilio* integrations. | [optional] -**token** | **String** | Telegram Bot Token OR Viber Public Account token. Required for *twilio* and *viber* integrations. | [optional] -**uri** | **String** | The viber URI to find the account. Returned on successful *viber* integrations. | [optional] -**channelId** | **String** | LINE Channel ID. Required for *line* integrations. | [optional] -**channelSecret** | **String** | LINE Channel Secret. Required for *line* integrations. | [optional] -**channelAccessToken** | **String** | LINE Channel Access Token. Required for *line* integrations. | [optional] -**serviceCode** | **String** | LINE Service Code. | [optional] -**switcherSecret** | **String** | LINE Switcher Secret. | [optional] -**qrCodeUrl** | **String** | URL provided by LINE in the [Developer Console](https://developers.line.biz/console/). | [optional] -**lineId** | **String** | LINE Basic ID. Generated automatically when a `qrCodeUrl` is updated. | [optional] -**botName** | **String** | The bot's name. Returned on successful *line* integrations. | [optional] -**encodingAesKey** | **String** | AES Encoding Key. (Optional) Used for *wechat* integrations. | [optional] -**fromAddress** | **String** | Email address to use as the `From` and `Reply-To` address if it must be different from `incomingAddress`. Only use this option if the address that you supply is configured to forward emails to the `incomingAddress`, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user's email client. (Optional) Used for *mailgun* integrations. | [optional] -**certificate** | **String** | The binary of your APN certificate base64 encoded. Required for *apn* integrations. | [optional] -**deploymentId** | **String** | Your WhatsApp deployment ID. Required for *WhatsApp* integrations. | [optional] -**baseUrl** | **String** | Your WhatsApp API client's URL. Required for *WhatsApp* integrations. (this usage is deprecated) | [optional] -**hsmFallbackLanguage** | **String** | Specification of a fallback language. (Optional) Used for *WhatsApp* integrations. | [optional] -**password** | **String** | The password for your APN certificate or WhatsApp API client. Required for *WhatsApp* integrations. (this usage is deprecated) (Optional) Used for *apn* integrations. | [optional] -**autoUpdateBadge** | **Boolean** | Use the unread count of the conversation as the application badge. (Optional) Used for *apn* integrations. | [optional] -**production** | **Boolean** | Flag specifying the APN environment to connect to (`production` if true, `sandbox` otherwise). Defaults to value inferred from certificate if not specified. (Optional) Used for *apn* integrations. | [optional] -**serverKey** | **String** | Your server key from the fcm console. Required for *fcm* integrations. | [optional] -**senderId** | **String** | Your sender id from the fcm console. Required for *fcm* integrations. | [optional] -**tier** | **String** | Your Twitter app’s tier. Accepted values are enterprise or premium. | [optional] -**envName** | **String** | The Twitter environment name, e.g.: env-beta. Required for *twitter* integrations with *premium* tier. | [optional] -**consumerKey** | **String** | The consumer key for your Twitter app. Required for *twitter* integrations. | [optional] -**consumerSecret** | **String** | The consumer secret for your Twitter app. Required for *twitter* integrations. | [optional] -**accessTokenKey** | **String** | The access token key obtained from your user via oauth. Required for *twitter* integrations. | [optional] -**accessTokenSecret** | **String** | The access token secret obtained from your user via oauth. Required for *twitter* integrations. | [optional] -**userId** | **String** | The twitter userId. Returned on successful *twitter* integrations. | [optional] -**username** | **String** | The username for the account. Returned on successful *twitter* and *telegram* integrations. Required for *WhatsApp* integrations. (this usage is deprecated) | [optional] -**apiKey** | **String** | The public API key of your Mailgun account. Required for *mailgun* integrations. | [optional] -**domain** | **String** | The domain used to relay email. Required for *mailgun* integrations. | [optional] -**incomingAddress** | **String** | Smooch will receive all emails sent to this address. Required for *mailgun* integrations. | [optional] -**accessKey** | **String** | The public API key of your MessageBird account. Required for *messagebird* integrations. | [optional] -**originator** | **String** | Smooch will receive all messages sent to this phone number. Required for *messagebird* integrations. | [optional] -**signingKey** | **String** | The signing key of your MessageBird account. Used to validate the webhooks' origin. (Optional) Used for *messagebird* integrations. | [optional] -**brandColor** | **String** | This color will be used in the messenger header and the button or tab in idle state. (Optional) Used for *Web Messenger* integrations. | [optional] -**fixedIntroPane** | **Boolean** | When `true`, the introduction pane will be pinned at the top of the conversation instead of scrolling with it. The default value is `false`. (Optional) Used for *Web Messenger* integrations. | [optional] -**conversationColor** | **String** | This color will be used for customer messages, quick replies and actions in the footer. (Optional) Used for *Web Messenger* integrations. | [optional] -**actionColor** | **String** | This color will be used for call-to-actions inside your messages. (Optional) Used for *Web Messenger* integrations. | [optional] -**displayStyle** | **String** | Choose how the messenger will appear on your website. Must be either button or tab. (Optional) Used for *Web Messenger* integrations. | [optional] -**buttonIconUrl** | **String** | With the button style Web Messenger, you have the option of selecting your own button icon. (Optional) Used for *Web Messenger* integrations. | [optional] -**buttonWidth** | **String** | With the button style Web Messenger, you have the option of specifying its width. (Optional) Used for *Web Messenger* integrations. | [optional] -**buttonHeight** | **String** | With the button style Web Messenger, you have the option of specifying its height. (Optional) Used for *Web Messenger* integrations. | [optional] -**integrationOrder** | **List<String>** | Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed (Optional) Used for *Web Messenger* integrations. | [optional] -**businessName** | **String** | A custom business name for the Web Messenger. (Optional) Used for *Web Messenger* integrations. | [optional] -**businessIconUrl** | **String** | A custom business icon url for the Web Messenger. (Optional) Used for *Web Messenger* integrations. | [optional] -**backgroundImageUrl** | **String** | A custom background url for the Web Messenger. (Optional) Used for *Web Messenger* integrations. | [optional] -**originWhitelist** | **List<String>** | A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454 `scheme \"://\" host [ \":\" port ]`, where scheme is `http` or `https`. (Optional) Used for *Web Messenger* integrations. | [optional] -**hideUnsubscribeLink** | **Boolean** | When `true`, unsubscribe links will not be included in outbound emails. If this setting is enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. (Optional) Used for *mailgun* integrations. | [optional] -**status** | **String** | The integration status. See [**IntegrationStatusEnum**](Enums.md#IntegrationStatusEnum) for available values. [More info](https://docs.smooch.io/#integration-status). | [optional] -**error** | **String** | The error causing the integration to fail. Will be present when `status` is 'error'. | [optional] -**apiSecret** | **String** | A key tied to Apple Business Chat Messaging Service Provider | [optional] -**businessId** | **String** | A unique ID tied to the brand using Apple Business Chat | [optional] -**mspId** | **String** | A unique identifier for an Apple Business Chat partner registered as a Messaging Service Provider through Apple Business Register | [optional] +**id** | **String** | The unique ID of the integration. | [optional] [readonly] +**type** | **String** | The type of integration. | +**status** | [**Status**](Status.md) | | [optional] +**displayName** | **String** | A human-friendly name used to identify the integration. | [optional] diff --git a/docs/IntegrationApi.md b/docs/IntegrationApi.md deleted file mode 100644 index 57522751..00000000 --- a/docs/IntegrationApi.md +++ /dev/null @@ -1,811 +0,0 @@ -# IntegrationApi - -All URIs are relative to *https://api.smooch.io* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createIntegration**](IntegrationApi.md#createIntegration) | **POST** /v1.1/apps/{appId}/integrations | -[**createIntegrationMenu**](IntegrationApi.md#createIntegrationMenu) | **POST** /v1.1/apps/{appId}/integrations/{integrationId}/menu | -[**deleteIntegration**](IntegrationApi.md#deleteIntegration) | **DELETE** /v1.1/apps/{appId}/integrations/{integrationId} | -[**deleteIntegrationMenu**](IntegrationApi.md#deleteIntegrationMenu) | **DELETE** /v1.1/apps/{appId}/integrations/{integrationId}/menu | -[**getIntegration**](IntegrationApi.md#getIntegration) | **GET** /v1.1/apps/{appId}/integrations/{integrationId} | -[**getIntegrationMenu**](IntegrationApi.md#getIntegrationMenu) | **GET** /v1.1/apps/{appId}/integrations/{integrationId}/menu | -[**getIntegrationProfile**](IntegrationApi.md#getIntegrationProfile) | **GET** /v1.1/apps/{appId}/integrations/{integrationId}/profile | -[**listIntegrations**](IntegrationApi.md#listIntegrations) | **GET** /v1.1/apps/{appId}/integrations | -[**updateIntegration**](IntegrationApi.md#updateIntegration) | **PUT** /v1.1/apps/{appId}/integrations/{integrationId} | -[**updateIntegrationMenu**](IntegrationApi.md#updateIntegrationMenu) | **PUT** /v1.1/apps/{appId}/integrations/{integrationId}/menu | -[**updateIntegrationProfile**](IntegrationApi.md#updateIntegrationProfile) | **PUT** /v1.1/apps/{appId}/integrations/{integrationId}/profile | -[**uploadIntegrationProfilePhoto**](IntegrationApi.md#uploadIntegrationProfilePhoto) | **PUT** /v1.1/apps/{appId}/integrations/{integrationId}/profile/photo | - - - -# **createIntegration** -> IntegrationResponse createIntegration(appId, integrationCreateBody) - - - -Create an integration for the specified app. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.IntegrationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -IntegrationApi apiInstance = new IntegrationApi(); -String appId = "appId_example"; // String | Identifies the app. -IntegrationCreate integrationCreateBody = new IntegrationCreate(); // IntegrationCreate | Body for a createIntegration request. Additional arguments are necessary based on integration type. For detailed instructions, visit our [official docs](https://docs.smooch.io/rest/#create-integration) -try { - IntegrationResponse result = apiInstance.createIntegration(appId, integrationCreateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling IntegrationApi#createIntegration"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **integrationCreateBody** | [**IntegrationCreate**](IntegrationCreate.md)| Body for a createIntegration request. Additional arguments are necessary based on integration type. For detailed instructions, visit our [official docs](https://docs.smooch.io/rest/#create-integration) | - -### Return type - -[**IntegrationResponse**](IntegrationResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **createIntegrationMenu** -> MenuResponse createIntegrationMenu(appId, integrationId, menuCreateBody) - - - -Create the specified integration’s menu, overriding the app menu if configured. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.IntegrationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -IntegrationApi apiInstance = new IntegrationApi(); -String appId = "appId_example"; // String | Identifies the app. -String integrationId = "integrationId_example"; // String | Identifies the integration. -Menu menuCreateBody = new Menu(); // Menu | Body for a createMenu request. -try { - MenuResponse result = apiInstance.createIntegrationMenu(appId, integrationId, menuCreateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling IntegrationApi#createIntegrationMenu"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **integrationId** | **String**| Identifies the integration. | - **menuCreateBody** | [**Menu**](Menu.md)| Body for a createMenu request. | - -### Return type - -[**MenuResponse**](MenuResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **deleteIntegration** -> deleteIntegration(appId, integrationId) - - - -Delete the specified integration. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.IntegrationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -IntegrationApi apiInstance = new IntegrationApi(); -String appId = "appId_example"; // String | Identifies the app. -String integrationId = "integrationId_example"; // String | Identifies the integration. -try { - apiInstance.deleteIntegration(appId, integrationId); -} catch (ApiException e) { - System.err.println("Exception when calling IntegrationApi#deleteIntegration"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **integrationId** | **String**| Identifies the integration. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **deleteIntegrationMenu** -> deleteIntegrationMenu(appId, integrationId) - - - -Delete the specified integration’s menu. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.IntegrationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -IntegrationApi apiInstance = new IntegrationApi(); -String appId = "appId_example"; // String | Identifies the app. -String integrationId = "integrationId_example"; // String | Identifies the integration. -try { - apiInstance.deleteIntegrationMenu(appId, integrationId); -} catch (ApiException e) { - System.err.println("Exception when calling IntegrationApi#deleteIntegrationMenu"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **integrationId** | **String**| Identifies the integration. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getIntegration** -> IntegrationResponse getIntegration(appId, integrationId) - - - -Get the specified integration. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.IntegrationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -IntegrationApi apiInstance = new IntegrationApi(); -String appId = "appId_example"; // String | Identifies the app. -String integrationId = "integrationId_example"; // String | Identifies the integration. -try { - IntegrationResponse result = apiInstance.getIntegration(appId, integrationId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling IntegrationApi#getIntegration"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **integrationId** | **String**| Identifies the integration. | - -### Return type - -[**IntegrationResponse**](IntegrationResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getIntegrationMenu** -> MenuResponse getIntegrationMenu(appId, integrationId) - - - -Get the specified integration's menu. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.IntegrationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -IntegrationApi apiInstance = new IntegrationApi(); -String appId = "appId_example"; // String | Identifies the app. -String integrationId = "integrationId_example"; // String | Identifies the integration. -try { - MenuResponse result = apiInstance.getIntegrationMenu(appId, integrationId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling IntegrationApi#getIntegrationMenu"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **integrationId** | **String**| Identifies the integration. | - -### Return type - -[**MenuResponse**](MenuResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getIntegrationProfile** -> GetIntegrationProfileResponse getIntegrationProfile(appId, integrationId) - - - -Get the specified integration’s profile. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.IntegrationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -IntegrationApi apiInstance = new IntegrationApi(); -String appId = "appId_example"; // String | Identifies the app. -String integrationId = "integrationId_example"; // String | Identifies the integration. -try { - GetIntegrationProfileResponse result = apiInstance.getIntegrationProfile(appId, integrationId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling IntegrationApi#getIntegrationProfile"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **integrationId** | **String**| Identifies the integration. | - -### Return type - -[**GetIntegrationProfileResponse**](GetIntegrationProfileResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **listIntegrations** -> ListIntegrationsResponse listIntegrations(appId, types, limit, offset) - - - -List integrations for the specified app. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.IntegrationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -IntegrationApi apiInstance = new IntegrationApi(); -String appId = "appId_example"; // String | Identifies the app. -String types = "types_example"; // String | List of types to filter the query by. More than one value can be specified through comma separation e.g. ?types=*twilio*,*line*. -Integer limit = 25; // Integer | The number of records to return. -Integer offset = 0; // Integer | The number of initial records to skip before picking records to return. -try { - ListIntegrationsResponse result = apiInstance.listIntegrations(appId, types, limit, offset); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling IntegrationApi#listIntegrations"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **types** | **String**| List of types to filter the query by. More than one value can be specified through comma separation e.g. ?types=*twilio*,*line*. | [optional] - **limit** | **Integer**| The number of records to return. | [optional] [default to 25] - **offset** | **Integer**| The number of initial records to skip before picking records to return. | [optional] [default to 0] - -### Return type - -[**ListIntegrationsResponse**](ListIntegrationsResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **updateIntegration** -> IntegrationResponse updateIntegration(appId, integrationId, integrationUpdateBody) - - - -Update the specified integration. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.IntegrationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -IntegrationApi apiInstance = new IntegrationApi(); -String appId = "appId_example"; // String | Identifies the app. -String integrationId = "integrationId_example"; // String | Identifies the integration. -IntegrationUpdate integrationUpdateBody = new IntegrationUpdate(); // IntegrationUpdate | Body for a updateIntegration request. Additional arguments are necessary based on integration type. For detailed instructions, visit our [official docs](https://docs.smooch.io/rest/#update-integration) -try { - IntegrationResponse result = apiInstance.updateIntegration(appId, integrationId, integrationUpdateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling IntegrationApi#updateIntegration"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **integrationId** | **String**| Identifies the integration. | - **integrationUpdateBody** | [**IntegrationUpdate**](IntegrationUpdate.md)| Body for a updateIntegration request. Additional arguments are necessary based on integration type. For detailed instructions, visit our [official docs](https://docs.smooch.io/rest/#update-integration) | - -### Return type - -[**IntegrationResponse**](IntegrationResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **updateIntegrationMenu** -> MenuResponse updateIntegrationMenu(appId, integrationId, menuUpdateBody) - - - -Update the specified integration’s menu. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.IntegrationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -IntegrationApi apiInstance = new IntegrationApi(); -String appId = "appId_example"; // String | Identifies the app. -String integrationId = "integrationId_example"; // String | Identifies the integration. -Menu menuUpdateBody = new Menu(); // Menu | Body for a updateMenu request. -try { - MenuResponse result = apiInstance.updateIntegrationMenu(appId, integrationId, menuUpdateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling IntegrationApi#updateIntegrationMenu"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **integrationId** | **String**| Identifies the integration. | - **menuUpdateBody** | [**Menu**](Menu.md)| Body for a updateMenu request. | - -### Return type - -[**MenuResponse**](MenuResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **updateIntegrationProfile** -> updateIntegrationProfile(appId, integrationId, integrationProfileBody) - - - -Update the specified integration’s profile. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.IntegrationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -IntegrationApi apiInstance = new IntegrationApi(); -String appId = "appId_example"; // String | Identifies the app. -String integrationId = "integrationId_example"; // String | Identifies the integration. -IntegrationProfileUpdate integrationProfileBody = new IntegrationProfileUpdate(); // IntegrationProfileUpdate | Body for a profileUpdate request. -try { - apiInstance.updateIntegrationProfile(appId, integrationId, integrationProfileBody); -} catch (ApiException e) { - System.err.println("Exception when calling IntegrationApi#updateIntegrationProfile"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **integrationId** | **String**| Identifies the integration. | - **integrationProfileBody** | [**IntegrationProfileUpdate**](IntegrationProfileUpdate.md)| Body for a profileUpdate request. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **uploadIntegrationProfilePhoto** -> UploadIntegrationProfilePhotoResponse uploadIntegrationProfilePhoto(appId, integrationId, source) - - - -Upload a photo to be used for the the specified integration’s profile. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.IntegrationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -IntegrationApi apiInstance = new IntegrationApi(); -String appId = "appId_example"; // String | Identifies the app. -String integrationId = "integrationId_example"; // String | Identifies the integration. -File source = new File("/path/to/file.txt"); // File | Photo to be uploaded -try { - UploadIntegrationProfilePhotoResponse result = apiInstance.uploadIntegrationProfilePhoto(appId, integrationId, source); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling IntegrationApi#uploadIntegrationProfilePhoto"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **integrationId** | **String**| Identifies the integration. | - **source** | **File**| Photo to be uploaded | - -### Return type - -[**UploadIntegrationProfilePhotoResponse**](UploadIntegrationProfilePhotoResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: multipart/form-data - - **Accept**: application/json - diff --git a/docs/IntegrationApiKey.md b/docs/IntegrationApiKey.md new file mode 100644 index 00000000..4e3094b8 --- /dev/null +++ b/docs/IntegrationApiKey.md @@ -0,0 +1,12 @@ + + +# IntegrationApiKey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**displayName** | **String** | The name of the API key. | + + + diff --git a/docs/IntegrationApiKeyListResponse.md b/docs/IntegrationApiKeyListResponse.md new file mode 100644 index 00000000..27f61f8c --- /dev/null +++ b/docs/IntegrationApiKeyListResponse.md @@ -0,0 +1,12 @@ + + +# IntegrationApiKeyListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**keys** | [**List<ApiKey>**](ApiKey.md) | Integration keys of the supplied integration. | [optional] + + + diff --git a/docs/IntegrationApiKeyResponse.md b/docs/IntegrationApiKeyResponse.md new file mode 100644 index 00000000..149220cb --- /dev/null +++ b/docs/IntegrationApiKeyResponse.md @@ -0,0 +1,12 @@ + + +# IntegrationApiKeyResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | [**ApiKey**](ApiKey.md) | | [optional] + + + diff --git a/docs/IntegrationCreate.md b/docs/IntegrationCreate.md deleted file mode 100644 index d7df722d..00000000 --- a/docs/IntegrationCreate.md +++ /dev/null @@ -1,66 +0,0 @@ - -# IntegrationCreate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **String** | The integration type. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values. | -**displayName** | **String** | The integration display name. Used to map a human-friendly name to an integration. | [optional] -**pageAccessToken** | **String** | Facebook Page Access Token. Required for *messenger* integrations. | [optional] -**appId** | **String** | Facebook App ID OR WeChat App ID. Required for *messenger* and *wechat* integrations. | [optional] -**appSecret** | **String** | Facebook Page App Secret OR WeChat App Secret. Required for *messenger* and *wechat* integrations. | [optional] -**accountSid** | **String** | Twilio Account SID. Required for *twilio* integrations. | [optional] -**authToken** | **String** | Twilio Auth Token. Required for *twilio* integrations. | [optional] -**baseUrl** | **String** | Your WhatsApp API client's URL. Required for *WhatsApp* integrations. (this usage is deprecated) | [optional] -**hsmFallbackLanguage** | **String** | Specification of a fallback language. (Optional) Used for *WhatsApp* integrations. | [optional] -**phoneNumberSid** | **String** | SID for specific phone number. Required for *twilio* integrations. | [optional] -**token** | **String** | Telegram Bot Token OR Viber Public Account token. Required for *twilio* and *viber* integrations. | [optional] -**channelId** | **String** | LINE Channel ID. Required for *line* integrations. | [optional] -**channelSecret** | **String** | LINE Channel Secret. Required for *line* integrations. | [optional] -**channelAccessToken** | **String** | LINE Channel Access Token. Required for *line* integrations. | [optional] -**deploymentId** | **String** | Your WhatsApp deployment ID. Required for *WhatsApp* integrations. | [optional] -**serviceCode** | **String** | LINE Service Code. | [optional] -**switcherSecret** | **String** | LINE Switcher Secret. | [optional] -**encodingAesKey** | **String** | AES Encoding Key. (Optional) Used for *wechat* integrations. | [optional] -**fromAddress** | **String** | Email address to use as the `From` and `Reply-To` address if it must be different from `incomingAddress`. Only use this option if the address that you supply is configured to forward emails to the `incomingAddress`, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user's email client. (Optional) Used for *mailgun* integrations. | [optional] -**certificate** | **String** | The binary of your APN certificate base64 encoded. Required for *apn* integrations. | [optional] -**password** | **String** | The password for your APN certificate or WhatsApp API client. Required for *WhatsApp* integrations. (this usage is deprecated) (Optional) Used for *apn* integrations. | [optional] -**username** | **String** | The username for the account. Returned on successful *twitter* and *telegram* integrations. Required for *WhatsApp* integrations. (this usage is deprecated) | [optional] -**autoUpdateBadge** | **Boolean** | Use the unread count of the conversation as the application badge. (Optional) Used for *apn* integrations. | [optional] -**production** | **Boolean** | Flag specifying the APN environment to connect to (`production` if true, `sandbox` otherwise). Defaults to value inferred from certificate if not specified. (Optional) Used for *apn* integrations. | [optional] -**serverKey** | **String** | Your server key from the fcm console. Required for *fcm* integrations. | [optional] -**senderId** | **String** | Your sender id from the fcm console. Required for *fcm* integrations. | [optional] -**tier** | **String** | Your Twitter app’s tier. Accepted values are enterprise or premium. | [optional] -**envName** | **String** | The Twitter environment name, e.g.: env-beta. Required for *twitter* integrations with *premium* tier. | [optional] -**consumerKey** | **String** | The consumer key for your Twitter app. Required for *twitter* integrations. | [optional] -**consumerSecret** | **String** | The consumer secret for your Twitter app. Required for *twitter* integrations. | [optional] -**accessTokenKey** | **String** | The access token key obtained from your user via oauth. Required for *twitter* integrations. | [optional] -**accessTokenSecret** | **String** | The access token secret obtained from your user via oauth. Required for *twitter* integrations. | [optional] -**accessTokenUrl** | **String** | Optional endpoint to generate access tokens for WeChat. Used to coordinate API access with third party systems. | [optional] -**accessKey** | **String** | The public API key of your MessageBird account. Required for *messagebird* integrations. | [optional] -**originator** | **String** | Smooch will receive all messages sent to this phone number. Required for *messagebird* integrations. | [optional] -**brandColor** | **String** | This color will be used in the messenger header and the button or tab in idle state. (Optional) Used for *Web Messenger* integrations. | [optional] -**fixedIntroPane** | **Boolean** | When `true`, the introduction pane will be pinned at the top of the conversation instead of scrolling with it. The default value is `false`. (Optional) Used for *Web Messenger* integrations. | [optional] -**conversationColor** | **String** | This color will be used for customer messages, quick replies and actions in the footer. (Optional) Used for *Web Messenger* integrations. | [optional] -**actionColor** | **String** | This color will be used for call-to-actions inside your messages. (Optional) Used for *Web Messenger* integrations. | [optional] -**displayStyle** | **String** | Choose how the messenger will appear on your website. Must be either button or tab. (Optional) Used for *Web Messenger* integrations. | [optional] -**buttonIconUrl** | **String** | With the button style Web Messenger, you have the option of selecting your own button icon. (Optional) Used for *Web Messenger* integrations. | [optional] -**buttonWidth** | **String** | With the button style Web Messenger, you have the option of specifying its width. (Optional) Used for *Web Messenger* integrations. | [optional] -**buttonHeight** | **String** | With the button style Web Messenger, you have the option of specifying its height. (Optional) Used for *Web Messenger* integrations. | [optional] -**integrationOrder** | **List<String>** | Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed (Optional) Used for *Web Messenger* integrations. | [optional] -**businessName** | **String** | A custom business name for the Web Messenger. (Optional) Used for *Web Messenger* integrations. | [optional] -**businessIconUrl** | **String** | A custom business icon url for the Web Messenger. (Optional) Used for *Web Messenger* integrations. | [optional] -**backgroundImageUrl** | **String** | A custom background url for the Web Messenger. (Optional) Used for *Web Messenger* integrations. | [optional] -**originWhitelist** | **List<String>** | A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454 `scheme \"://\" host [ \":\" port ]`, where scheme is `http` or `https`. (Optional) Used for *Web Messenger* integrations. | [optional] -**qrCodeUrl** | **String** | URL provided by LINE in the [Developer Console](https://developers.line.biz/console/). | [optional] -**hideUnsubscribeLink** | **Boolean** | When `true`, unsubscribe links will not be included in outbound emails. If this setting is enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. (Optional) Used for *mailgun* integrations. | [optional] -**signingKey** | **String** | The signing key of your MessageBird account. Used to validate the webhooks' origin. (Optional) Used for *messagebird* integrations. | [optional] -**apiKey** | **String** | The public API key of your Mailgun account. Required for *mailgun* integrations. | [optional] -**domain** | **String** | The domain used to relay email. Required for *mailgun* integrations. | [optional] -**incomingAddress** | **String** | Smooch will receive all emails sent to this address. Required for *mailgun* integrations. | [optional] -**apiSecret** | **String** | A key tied to Apple Business Chat Messaging Service Provider | [optional] -**businessId** | **String** | A unique ID tied to the brand using Apple Business Chat | [optional] -**mspId** | **String** | A unique identifier for an Apple Business Chat partner registered as a Messaging Service Provider through Apple Business Register | [optional] - - - diff --git a/docs/IntegrationId.md b/docs/IntegrationId.md new file mode 100644 index 00000000..cc840435 --- /dev/null +++ b/docs/IntegrationId.md @@ -0,0 +1,16 @@ + + +# IntegrationId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integrationId** | **String** | The id of the integration to deliver the message to. Will return an error if the integration does not exist or if the user does not have a client for the integration attached to the conversation. | [optional] + + +## Implemented Interfaces + +* Destination + + diff --git a/docs/IntegrationListFilter.md b/docs/IntegrationListFilter.md new file mode 100644 index 00000000..0ed5a41e --- /dev/null +++ b/docs/IntegrationListFilter.md @@ -0,0 +1,12 @@ + + +# IntegrationListFilter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**types** | **String** | Comma-separated list of types to return. If omitted, all types are returned. | [optional] + + + diff --git a/docs/IntegrationListResponse.md b/docs/IntegrationListResponse.md new file mode 100644 index 00000000..4749a805 --- /dev/null +++ b/docs/IntegrationListResponse.md @@ -0,0 +1,14 @@ + + +# IntegrationListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integrations** | [**List<Integration>**](Integration.md) | List of returned integrations. | [optional] +**meta** | [**Meta**](Meta.md) | | [optional] +**links** | [**Links**](Links.md) | | [optional] + + + diff --git a/docs/IntegrationProfileUpdate.md b/docs/IntegrationProfileUpdate.md deleted file mode 100644 index fa631b4a..00000000 --- a/docs/IntegrationProfileUpdate.md +++ /dev/null @@ -1,16 +0,0 @@ - -# IntegrationProfileUpdate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**about** | **String** | Text to display in your profile's About section. Can be used as a status update. Maximum of 139 characters. | [optional] -**address** | **String** | Address of the business. Maximum of 256 characters. | [optional] -**description** | **String** | Description of the business. Maximum of 256 characters. | [optional] -**email** | **String** | Email address to contact the business. Maximum of 128 characters. | [optional] -**photoUrl** | **String** | URL where the business' profile photo is hosted. WhatsApp recommends an image with dimensions of 640x640 and max size of 63KB. | [optional] -**vertical** | **String** | Industry of the business. Maximum of 128 characters. | [optional] -**websites** | **List<String>** | URLs associated with the business. Maximum of 2 websites. | [optional] - - - diff --git a/docs/IntegrationResponse.md b/docs/IntegrationResponse.md index c1fe1104..1d6b2f0a 100644 --- a/docs/IntegrationResponse.md +++ b/docs/IntegrationResponse.md @@ -1,10 +1,12 @@ + # IntegrationResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**integration** | [**Integration**](Integration.md) | The integration. | [optional] +**integration** | [**Integration**](Integration.md) | | [optional] diff --git a/docs/IntegrationType.md b/docs/IntegrationType.md new file mode 100644 index 00000000..a77a199e --- /dev/null +++ b/docs/IntegrationType.md @@ -0,0 +1,16 @@ + + +# IntegrationType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integrationType** | **String** | The type of the integration to deliver the message to. Will return an error if the user does not have a client of that type attached to the conversation. | [optional] + + +## Implemented Interfaces + +* Destination + + diff --git a/docs/IntegrationUpdate.md b/docs/IntegrationUpdate.md index 7d35ab77..67458ab6 100644 --- a/docs/IntegrationUpdate.md +++ b/docs/IntegrationUpdate.md @@ -1,32 +1,22 @@ -# IntegrationUpdate -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**displayName** | **String** | The integration display name. Used to map a human-friendly name to an integration. | [optional] -**brandColor** | **String** | This color will be used in the messenger header and the button or tab in idle state. (Optional) Used for *Web Messenger* integrations. | [optional] -**fixedIntroPane** | **Boolean** | When `true`, the introduction pane will be pinned at the top of the conversation instead of scrolling with it. The default value is `false`. (Optional) Used for *Web Messenger* integrations. | [optional] -**conversationColor** | **String** | This color will be used for customer messages, quick replies and actions in the footer. (Optional) Used for *Web Messenger* integrations. | [optional] -**actionColor** | **String** | This color will be used for call-to-actions inside your messages. (Optional) Used for *Web Messenger* integrations. | [optional] -**displayStyle** | **String** | Choose how the messenger will appear on your website. Must be either button or tab. (Optional) Used for *Web Messenger* integrations. | [optional] -**buttonIconUrl** | **String** | With the button style Web Messenger, you have the option of selecting your own button icon. (Optional) Used for *Web Messenger* integrations. | [optional] -**buttonWidth** | **String** | With the button style Web Messenger, you have the option of specifying its width. (Optional) Used for *Web Messenger* integrations. | [optional] -**buttonHeight** | **String** | With the button style Web Messenger, you have the option of specifying its height. (Optional) Used for *Web Messenger* integrations. | [optional] -**integrationOrder** | **List<String>** | Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed (Optional) Used for *Web Messenger* integrations. | [optional] -**businessName** | **String** | A custom business name for the Web Messenger. (Optional) Used for *Web Messenger* integrations. | [optional] -**businessIconUrl** | **String** | A custom business icon url for the Web Messenger. (Optional) Used for *Web Messenger* integrations. | [optional] -**backgroundImageUrl** | **String** | A custom background url for the Web Messenger. (Optional) Used for *Web Messenger* integrations. | [optional] -**originWhitelist** | **List<String>** | A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454 `scheme \"://\" host [ \":\" port ]`, where scheme is `http` or `https`. (Optional) Used for *Web Messenger* integrations. | [optional] -**channelId** | **String** | LINE Channel ID. Required for *line* integrations. | [optional] -**channelSecret** | **String** | LINE Channel Secret. Required for *line* integrations. | [optional] -**serviceCode** | **String** | LINE Service Code. | [optional] -**switcherSecret** | **String** | LINE Switcher Secret. | [optional] -**hsmFallbackLanguage** | **String** | Specification of a fallback language. (Optional) Used for *WhatsApp* integrations. | [optional] -**qrCodeUrl** | **String** | URL provided by LINE in the [Developer Console](https://developers.line.biz/console/). | [optional] -**hideUnsubscribeLink** | **Boolean** | When `true`, unsubscribe links will not be included in outbound emails. If this setting is enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. (Optional) Used for *mailgun* integrations. | [optional] -**fromAddress** | **String** | Email address to use as the `From` and `Reply-To` address if it must be different from `incomingAddress`. Only use this option if the address that you supply is configured to forward emails to the `incomingAddress`, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user's email client. (Optional) Used for *mailgun* integrations. | [optional] -**production** | **Boolean** | Flag specifying the APN environment to connect to (`production` if true, `sandbox` otherwise). Defaults to value inferred from certificate if not specified. (Optional) Used for *apn* integrations. | [optional] +# Interface IntegrationUpdate +## Implementing Classes + +* AndroidUpdate +* AppleUpdate +* CustomUpdate +* IosUpdate +* LineUpdate +* MailgunUpdate +* MessageBirdUpdate +* MessengerUpdate +* TelegramUpdate +* TwilioUpdate +* TwitterUpdate +* ViberUpdate +* WebUpdate +* WhatsAppUpdate diff --git a/docs/IntegrationUpdateBase.md b/docs/IntegrationUpdateBase.md new file mode 100644 index 00000000..11d5b18a --- /dev/null +++ b/docs/IntegrationUpdateBase.md @@ -0,0 +1,12 @@ + + +# IntegrationUpdateBase + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**displayName** | **String** | A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`. | [optional] + + + diff --git a/docs/IntegrationsApi.md b/docs/IntegrationsApi.md new file mode 100644 index 00000000..63f51452 --- /dev/null +++ b/docs/IntegrationsApi.md @@ -0,0 +1,411 @@ +# IntegrationsApi + +All URIs are relative to *https://api.smooch.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createIntegration**](IntegrationsApi.md#createIntegration) | **POST** /v2/apps/{appId}/integrations | Create Integration +[**deleteIntegration**](IntegrationsApi.md#deleteIntegration) | **DELETE** /v2/apps/{appId}/integrations/{integrationId} | Delete Integration +[**getIntegration**](IntegrationsApi.md#getIntegration) | **GET** /v2/apps/{appId}/integrations/{integrationId} | Get Integration +[**listIntegrations**](IntegrationsApi.md#listIntegrations) | **GET** /v2/apps/{appId}/integrations | List Integrations +[**updateIntegration**](IntegrationsApi.md#updateIntegration) | **PATCH** /v2/apps/{appId}/integrations/{integrationId} | Update Integration + + + +## createIntegration + +> IntegrationResponse createIntegration(integration, appId) + +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. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.IntegrationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + IntegrationsApi apiInstance = new IntegrationsApi(defaultClient); + Integration integration = new Integration(); // Integration | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + // Add required body parameters + + try { + IntegrationResponse result = apiInstance.createIntegration(integration, appId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IntegrationsApi#createIntegration"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integration** | [**Integration**](Integration.md)| | + **appId** | **String**| Identifies the app. | + +### Return type + +[**IntegrationResponse**](IntegrationResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **400** | Invalid integration type | - | + + +## deleteIntegration + +> Object deleteIntegration(appId, integrationId) + +Delete Integration + +Delete the specified integration. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.IntegrationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + IntegrationsApi apiInstance = new IntegrationsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String integrationId = "029c31f25a21b47effd7be90"; // String | The id of the integration. + // Add required body parameters + + try { + Object result = apiInstance.deleteIntegration(appId, integrationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IntegrationsApi#deleteIntegration"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **integrationId** | **String**| The id of the integration. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Integration not found | - | + + +## getIntegration + +> IntegrationResponse getIntegration(appId, integrationId) + +Get Integration + +Get integration. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.IntegrationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + IntegrationsApi apiInstance = new IntegrationsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String integrationId = "029c31f25a21b47effd7be90"; // String | The id of the integration. + // Add required body parameters + + try { + IntegrationResponse result = apiInstance.getIntegration(appId, integrationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IntegrationsApi#getIntegration"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **integrationId** | **String**| The id of the integration. | + +### Return type + +[**IntegrationResponse**](IntegrationResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Integration not found | - | + + +## listIntegrations + +> IntegrationListResponse listIntegrations(appId, page, filter) + +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 ``` + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.IntegrationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + IntegrationsApi apiInstance = new IntegrationsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + Page page = new Page(); // Page | Contains parameters for applying cursor pagination. + IntegrationListFilter filter = new IntegrationListFilter(); // IntegrationListFilter | Contains parameters for filtering the results. + // Add required body parameters + + try { + IntegrationListResponse result = apiInstance.listIntegrations(appId, page, filter); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IntegrationsApi#listIntegrations"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **page** | [**Page**](.md)| Contains parameters for applying cursor pagination. | [optional] + **filter** | [**IntegrationListFilter**](.md)| Contains parameters for filtering the results. | [optional] + +### Return type + +[**IntegrationListResponse**](IntegrationListResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | + + +## updateIntegration + +> IntegrationResponse updateIntegration(integrationUpdate, appId, integrationId) + +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. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.IntegrationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + IntegrationsApi apiInstance = new IntegrationsApi(defaultClient); + IntegrationUpdate integrationUpdate = new IntegrationUpdate(); // IntegrationUpdate | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String integrationId = "029c31f25a21b47effd7be90"; // String | The id of the integration. + // Add required body parameters + + try { + IntegrationResponse result = apiInstance.updateIntegration(integrationUpdate, appId, integrationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IntegrationsApi#updateIntegration"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integrationUpdate** | [**IntegrationUpdate**](IntegrationUpdate.md)| | + **appId** | **String**| Identifies the app. | + **integrationId** | **String**| The id of the integration. | + +### Return type + +[**IntegrationResponse**](IntegrationResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Integration not found | - | + diff --git a/docs/Ios.md b/docs/Ios.md new file mode 100644 index 00000000..f51672fa --- /dev/null +++ b/docs/Ios.md @@ -0,0 +1,17 @@ + + +# Ios + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**certificate** | **String** | The binary of your APN certificate base64 encoded. | [optional] +**password** | **String** | The password for your APN certificate. | [optional] +**production** | **Boolean** | The APN environment to connect to (Production, if true, or Sandbox). Defaults to value inferred from certificate if not specified. | [optional] +**autoUpdateBadge** | **Boolean** | Use the unread count of the conversation as the application badge. | [optional] +**canUserCreateMoreConversations** | **Boolean** | Allows users to create more than one conversation on the iOS integration. | [optional] + + + diff --git a/docs/IosAllOf.md b/docs/IosAllOf.md new file mode 100644 index 00000000..99ba5fbf --- /dev/null +++ b/docs/IosAllOf.md @@ -0,0 +1,17 @@ + + +# IosAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**certificate** | **String** | The binary of your APN certificate base64 encoded. | [optional] +**password** | **String** | The password for your APN certificate. | [optional] +**production** | **Boolean** | The APN environment to connect to (Production, if true, or Sandbox). Defaults to value inferred from certificate if not specified. | [optional] +**autoUpdateBadge** | **Boolean** | Use the unread count of the conversation as the application badge. | [optional] +**canUserCreateMoreConversations** | **Boolean** | Allows users to create more than one conversation on the iOS integration. | [optional] + + + diff --git a/docs/IosUpdate.md b/docs/IosUpdate.md new file mode 100644 index 00000000..dcf09fd5 --- /dev/null +++ b/docs/IosUpdate.md @@ -0,0 +1,21 @@ + + +# IosUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**displayName** | **String** | A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`. | [optional] +**certificate** | **String** | The binary of your APN certificate base64 encoded. | [optional] +**password** | **String** | The password for your APN certificate. | [optional] +**production** | **Boolean** | The APN environment to connect to (Production, if true, or Sandbox). Defaults to value inferred from certificate if not specified. | [optional] +**autoUpdateBadge** | **Boolean** | Use the unread count of the conversation as the application badge. | [optional] +**canUserCreateConversation** | **Boolean** | Allows users to create more than one conversation on the iOS integration. | [optional] + + +## Implemented Interfaces + +* IntegrationUpdate + + diff --git a/docs/IosUpdateAllOf.md b/docs/IosUpdateAllOf.md new file mode 100644 index 00000000..92bb3b73 --- /dev/null +++ b/docs/IosUpdateAllOf.md @@ -0,0 +1,16 @@ + + +# IosUpdateAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**certificate** | **String** | The binary of your APN certificate base64 encoded. | [optional] +**password** | **String** | The password for your APN certificate. | [optional] +**production** | **Boolean** | The APN environment to connect to (Production, if true, or Sandbox). Defaults to value inferred from certificate if not specified. | [optional] +**autoUpdateBadge** | **Boolean** | Use the unread count of the conversation as the application badge. | [optional] +**canUserCreateConversation** | **Boolean** | Allows users to create more than one conversation on the iOS integration. | [optional] + + + diff --git a/docs/Item.md b/docs/Item.md new file mode 100644 index 00000000..e61f0697 --- /dev/null +++ b/docs/Item.md @@ -0,0 +1,27 @@ + + +# Item + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **String** | The title of the item. | +**description** | **String** | The description of the item. | [optional] +**mediaUrl** | [**URI**](URI.md) | The image url attached to the item. | [optional] +**mediaType** | **String** | The MIME type for any image attached in the mediaUrl. | [optional] +**size** | [**SizeEnum**](#SizeEnum) | The size of the image. | [optional] +**actions** | [**List<ActionSubset>**](ActionSubset.md) | An array of objects representing the actions associated with the item. | +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] + + + +## Enum: SizeEnum + +Name | Value +---- | ----- +COMPACT | "compact" +LARGE | "large" + + + diff --git a/docs/Line.md b/docs/Line.md new file mode 100644 index 00000000..3ec139df --- /dev/null +++ b/docs/Line.md @@ -0,0 +1,19 @@ + + +# Line + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**channelId** | **String** | LINE Channel ID. | +**channelSecret** | **String** | LINE Channel Secret. | +**channelAccessToken** | **String** | LINE Channel Access Token. | [optional] +**serviceCode** | **String** | LINE Service Code. | [optional] +**switcherSecret** | **String** | LINE Switcher Secret. | [optional] +**qrCodeUrl** | **String** | URL provided by LINE in the [Developer Console](https://developers.line.biz/console/). | [optional] +**lineId** | **String** | LINE Basic ID. Is automatically set when qrCodeUrl is updated. | [optional] [readonly] + + + diff --git a/docs/LineAllOf.md b/docs/LineAllOf.md new file mode 100644 index 00000000..30c79b95 --- /dev/null +++ b/docs/LineAllOf.md @@ -0,0 +1,20 @@ + + +# LineAllOf + +For LINE, each of your customers will need to manually configure a webhook in their LINE configuration page that will point to Sunshine Conversations servers. You must instruct your customers how to configure this manually on their LINE bot page. Once you’ve acquired all the required information, call the Create Integration endpoint. Then, using the returned integration _id, your customer must set the Callback URL field in their LINE Business Center page. The URL should look like the following: `https://app.smooch.io:443/api/line/webhooks/{appId}/{integrationId}`. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**channelId** | **String** | LINE Channel ID. | +**channelSecret** | **String** | LINE Channel Secret. | +**channelAccessToken** | **String** | LINE Channel Access Token. | [optional] +**serviceCode** | **String** | LINE Service Code. | [optional] +**switcherSecret** | **String** | LINE Switcher Secret. | [optional] +**qrCodeUrl** | **String** | URL provided by LINE in the [Developer Console](https://developers.line.biz/console/). | [optional] +**lineId** | **String** | LINE Basic ID. Is automatically set when qrCodeUrl is updated. | [optional] [readonly] + + + diff --git a/docs/LineUpdate.md b/docs/LineUpdate.md new file mode 100644 index 00000000..1b7b6994 --- /dev/null +++ b/docs/LineUpdate.md @@ -0,0 +1,15 @@ + + +# LineUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + +## Implemented Interfaces + +* IntegrationUpdate + + diff --git a/docs/Link.md b/docs/Link.md new file mode 100644 index 00000000..c916caed --- /dev/null +++ b/docs/Link.md @@ -0,0 +1,23 @@ + + +# Link + +A link action will open the provided URI when tapped. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of action. | +**uri** | [**URI**](URI.md) | The action URI. This is the link that will be used in the clients when clicking the button. | +**text** | **String** | The button text. | +**_default** | **Boolean** | Boolean value indicating whether the action is the default action for a message item in Facebook Messenger. | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] +**extraChannelOptions** | [**ExtraChannelOptions**](ExtraChannelOptions.md) | | [optional] + + +## Implemented Interfaces + +* Action +* ActionSubset + + diff --git a/docs/LinkRequestResponse.md b/docs/LinkRequestResponse.md deleted file mode 100644 index fe7a0de4..00000000 --- a/docs/LinkRequestResponse.md +++ /dev/null @@ -1,10 +0,0 @@ - -# LinkRequestResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**linkRequests** | [**List<LinkRequestResponseLinkRequests>**](LinkRequestResponseLinkRequests.md) | The list of link requests. | [optional] - - - diff --git a/docs/LinkRequestResponseLinkRequests.md b/docs/LinkRequestResponseLinkRequests.md deleted file mode 100644 index c76460a1..00000000 --- a/docs/LinkRequestResponseLinkRequests.md +++ /dev/null @@ -1,13 +0,0 @@ - -# LinkRequestResponseLinkRequests - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**integrationId** | **String** | The integration ID. | -**type** | **String** | The integration type. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values. | -**code** | **String** | The link request code. | -**url** | **String** | The link request url. | - - - diff --git a/docs/Links.md b/docs/Links.md new file mode 100644 index 00000000..d2e13e5a --- /dev/null +++ b/docs/Links.md @@ -0,0 +1,14 @@ + + +# Links + +Previous and next page links, if they exist. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**prev** | **String** | A link to the previous page. Not specified if there are no previous pages. | [optional] +**next** | **String** | A link to the next page. Not specified if there are no subsequent pages. | [optional] + + + diff --git a/docs/ListAppsResponse.md b/docs/ListAppsResponse.md deleted file mode 100644 index bbdc7d56..00000000 --- a/docs/ListAppsResponse.md +++ /dev/null @@ -1,12 +0,0 @@ - -# ListAppsResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**apps** | [**List<App>**](App.md) | The list of apps. | [optional] -**hasMore** | **Boolean** | Flag indicating if there are more apps that are not present in the response. | [optional] -**offset** | **Integer** | The number of app records skipped in the returned list. | [optional] - - - diff --git a/docs/ListDeploymentsResponse.md b/docs/ListDeploymentsResponse.md deleted file mode 100644 index b75df4b9..00000000 --- a/docs/ListDeploymentsResponse.md +++ /dev/null @@ -1,10 +0,0 @@ - -# ListDeploymentsResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**deployments** | [**List<Deployment>**](Deployment.md) | The list of deployments. | - - - diff --git a/docs/ListIntegrationsResponse.md b/docs/ListIntegrationsResponse.md deleted file mode 100644 index 9f3fc670..00000000 --- a/docs/ListIntegrationsResponse.md +++ /dev/null @@ -1,12 +0,0 @@ - -# ListIntegrationsResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**integrations** | [**List<Integration>**](Integration.md) | The list of integrations. | [optional] -**hasMore** | **Boolean** | Flag indicating if there are more integrations that are not present in the response. | [optional] -**offset** | **Integer** | The number of integration records skipped in the returned list. | [optional] - - - diff --git a/docs/ListMessage.md b/docs/ListMessage.md new file mode 100644 index 00000000..d6c62ecd --- /dev/null +++ b/docs/ListMessage.md @@ -0,0 +1,19 @@ + + +# ListMessage + +List messages are a vertically scrollable set of items that may each contain text, an image, and message actions. Not all messaging channels fully support list messages. * Facebook Messenger and WeChat have native support. * For LINE and our Android, iOS and Web SDK, Sunshine Conversations converts list messages to carousel. * On WhatsApp, Telegram and Twitter, Sunshine Conversations converts list messages to multiple rich messages. * On all other platforms, Sunshine Conversations converts list messages to raw text. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of message. | +**items** | [**List<Item>**](Item.md) | An array of objects representing the items associated with the message. Only present in carousel and list type messages. | +**actions** | [**List<ActionSubset>**](ActionSubset.md) | An array of objects representing the actions associated with the message. The array length is limited by the third party channel. | [optional] + + +## Implemented Interfaces + +* Content + + diff --git a/docs/ListSecretKeysResponse.md b/docs/ListSecretKeysResponse.md deleted file mode 100644 index 0baab62c..00000000 --- a/docs/ListSecretKeysResponse.md +++ /dev/null @@ -1,10 +0,0 @@ - -# ListSecretKeysResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**keys** | [**List<SecretKey>**](SecretKey.md) | The list of secret keys. | [optional] - - - diff --git a/docs/ListServiceAccountsResponse.md b/docs/ListServiceAccountsResponse.md deleted file mode 100644 index b21fe95d..00000000 --- a/docs/ListServiceAccountsResponse.md +++ /dev/null @@ -1,12 +0,0 @@ - -# ListServiceAccountsResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**serviceAccounts** | [**List<ServiceAccount>**](ServiceAccount.md) | The list of service accounts. | [optional] -**hasMore** | **Boolean** | Flag indicating if there are more service accounts that are not present in the response. | [optional] -**offset** | **Integer** | The number of service account records skipped in the returned list. | [optional] - - - diff --git a/docs/ListTemplatesResponse.md b/docs/ListTemplatesResponse.md deleted file mode 100644 index 36fc6460..00000000 --- a/docs/ListTemplatesResponse.md +++ /dev/null @@ -1,12 +0,0 @@ - -# ListTemplatesResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**templates** | [**List<Template>**](Template.md) | The list of templates. | -**hasMore** | **Boolean** | Flag indicating if there are more templates that are not present in the response. | [optional] -**offset** | **Integer** | The number of template records skipped in the returned list. | [optional] - - - diff --git a/docs/ListWebhooksResponse.md b/docs/ListWebhooksResponse.md deleted file mode 100644 index c3c6acd8..00000000 --- a/docs/ListWebhooksResponse.md +++ /dev/null @@ -1,10 +0,0 @@ - -# ListWebhooksResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**webhooks** | [**List<Webhook>**](Webhook.md) | The list of webhooks. | - - - diff --git a/docs/Location.md b/docs/Location.md deleted file mode 100644 index 4c111906..00000000 --- a/docs/Location.md +++ /dev/null @@ -1,11 +0,0 @@ - -# Location - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**address** | **String** | The location's street address. | [optional] -**name** | **String** | A name for the location. | [optional] - - - diff --git a/docs/LocationMessage.md b/docs/LocationMessage.md new file mode 100644 index 00000000..2f437015 --- /dev/null +++ b/docs/LocationMessage.md @@ -0,0 +1,20 @@ + + +# LocationMessage + +A location type message includes the coordinates (latitude and longitude) of a location and an optional location object which can include the name and address of the location. Typically sent in response to a Location Request. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of message. | +**text** | **String** | The fallback text message used when location messages are not supported by the channel. | [optional] [readonly] +**coordinates** | [**LocationMessageCoordinates**](LocationMessageCoordinates.md) | | [optional] +**location** | [**LocationMessageLocation**](LocationMessageLocation.md) | | [optional] + + +## Implemented Interfaces + +* Content + + diff --git a/docs/LocationMessageCoordinates.md b/docs/LocationMessageCoordinates.md new file mode 100644 index 00000000..0b015b45 --- /dev/null +++ b/docs/LocationMessageCoordinates.md @@ -0,0 +1,14 @@ + + +# LocationMessageCoordinates + +The coordinates of the location. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**lat** | [**BigDecimal**](BigDecimal.md) | Global latitude. | [optional] +**_long** | [**BigDecimal**](BigDecimal.md) | Global longitude. | [optional] + + + diff --git a/docs/LocationMessageLocation.md b/docs/LocationMessageLocation.md new file mode 100644 index 00000000..c135a052 --- /dev/null +++ b/docs/LocationMessageLocation.md @@ -0,0 +1,14 @@ + + +# LocationMessageLocation + +Information about the location. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | **String** | A string representing the address of the location. | [optional] +**name** | **String** | A string representing the name of the location. | [optional] + + + diff --git a/docs/LocationRequest.md b/docs/LocationRequest.md new file mode 100644 index 00000000..227a2e16 --- /dev/null +++ b/docs/LocationRequest.md @@ -0,0 +1,19 @@ + + +# LocationRequest + +A location request action will prompt the user to share their location. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of action. | +**text** | **String** | The button text. | +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] + + +## Implemented Interfaces + +* Action + + diff --git a/docs/Mailgun.md b/docs/Mailgun.md new file mode 100644 index 00000000..341e1a74 --- /dev/null +++ b/docs/Mailgun.md @@ -0,0 +1,17 @@ + + +# Mailgun + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**apiKey** | **String** | The public API key of your Mailgun account. | +**domain** | **String** | The domain used to relay email. This domain must be configured and verified in your Mailgun account. | +**incomingAddress** | **String** | Sunshine Conversations will receive all emails sent to this address. It will also be used as the Reply-To address. | +**hideUnsubscribeLink** | **Boolean** | A boolean value indicating whether the unsubscribe link should be omitted from outgoing emails. When enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. By default, the unsubscribe link will be included in all outgoing emails. | [optional] +**fromAddress** | **String** | Email address to use as the From and Reply-To address if it must be different from incomingAddress. Only use this option if the address that you supply is configured to forward emails to the incomingAddress, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user’s email client. May be unset with null. | [optional] + + + diff --git a/docs/MailgunAllOf.md b/docs/MailgunAllOf.md new file mode 100644 index 00000000..eb98193b --- /dev/null +++ b/docs/MailgunAllOf.md @@ -0,0 +1,18 @@ + + +# MailgunAllOf + +To configure a Mailgun integration, visit the API Keys tab in the settings page of the Mailgun dashboard and copy your active API key. Call the Create Integration endpoint with your API Key, a domain you have configured in Mailgun, and the incoming address you would like to use. Must have the same domain as the one specified in the domain parameter. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**apiKey** | **String** | The public API key of your Mailgun account. | +**domain** | **String** | The domain used to relay email. This domain must be configured and verified in your Mailgun account. | +**incomingAddress** | **String** | Sunshine Conversations will receive all emails sent to this address. It will also be used as the Reply-To address. | +**hideUnsubscribeLink** | **Boolean** | A boolean value indicating whether the unsubscribe link should be omitted from outgoing emails. When enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. By default, the unsubscribe link will be included in all outgoing emails. | [optional] +**fromAddress** | **String** | Email address to use as the From and Reply-To address if it must be different from incomingAddress. Only use this option if the address that you supply is configured to forward emails to the incomingAddress, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user’s email client. May be unset with null. | [optional] + + + diff --git a/docs/MailgunUpdate.md b/docs/MailgunUpdate.md new file mode 100644 index 00000000..1e25870e --- /dev/null +++ b/docs/MailgunUpdate.md @@ -0,0 +1,18 @@ + + +# MailgunUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**displayName** | **String** | A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`. | [optional] +**hideUnsubscribeLink** | **Boolean** | A boolean value indicating whether the unsubscribe link should be omitted from outgoing emails. When enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. By default, the unsubscribe link will be included in all outgoing emails. | [optional] +**fromAddress** | **String** | Email address to use as the From and Reply-To address if it must be different from incomingAddress. Only use this option if the address that you supply is configured to forward emails to the incomingAddress, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user’s email client. May be unset with null. | [optional] + + +## Implemented Interfaces + +* IntegrationUpdate + + diff --git a/docs/MailgunUpdateAllOf.md b/docs/MailgunUpdateAllOf.md new file mode 100644 index 00000000..a0391185 --- /dev/null +++ b/docs/MailgunUpdateAllOf.md @@ -0,0 +1,13 @@ + + +# MailgunUpdateAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hideUnsubscribeLink** | **Boolean** | A boolean value indicating whether the unsubscribe link should be omitted from outgoing emails. When enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. By default, the unsubscribe link will be included in all outgoing emails. | [optional] +**fromAddress** | **String** | Email address to use as the From and Reply-To address if it must be different from incomingAddress. Only use this option if the address that you supply is configured to forward emails to the incomingAddress, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user’s email client. May be unset with null. | [optional] + + + diff --git a/docs/MatchCriteria.md b/docs/MatchCriteria.md new file mode 100644 index 00000000..18540259 --- /dev/null +++ b/docs/MatchCriteria.md @@ -0,0 +1,13 @@ + + +# Interface MatchCriteria + +The set of criteria used to determine the user's identity on a third-party channel. +## Implementing Classes + +* MatchCriteriaMailgun +* MatchCriteriaMessagebird +* MatchCriteriaTwilio +* MatchCriteriaWhatsapp + + diff --git a/docs/MatchCriteriaBase.md b/docs/MatchCriteriaBase.md new file mode 100644 index 00000000..ec4cb8c1 --- /dev/null +++ b/docs/MatchCriteriaBase.md @@ -0,0 +1,15 @@ + + +# MatchCriteriaBase + +The set of criteria used to determine the user's identity on a third-party channel. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The channel type. | +**integrationId** | **String** | The ID of the integration to link. Must match the provided type. | +**primary** | **Boolean** | Flag indicating whether the client will become the primary for the target conversation once linking is complete. | [optional] + + + diff --git a/docs/MatchCriteriaMailgun.md b/docs/MatchCriteriaMailgun.md new file mode 100644 index 00000000..d6982bf6 --- /dev/null +++ b/docs/MatchCriteriaMailgun.md @@ -0,0 +1,20 @@ + + +# MatchCriteriaMailgun + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The channel type. | +**integrationId** | **String** | The ID of the integration to link. Must match the provided type. | +**primary** | **Boolean** | Flag indicating whether the client will become the primary for the target conversation once linking is complete. | [optional] +**address** | **String** | The user’s email address. | +**subject** | **String** | May be specified to set the subject for the outgoing email. | [optional] + + +## Implemented Interfaces + +* MatchCriteria + + diff --git a/docs/MatchCriteriaMailgunAllOf.md b/docs/MatchCriteriaMailgunAllOf.md new file mode 100644 index 00000000..bdd3e820 --- /dev/null +++ b/docs/MatchCriteriaMailgunAllOf.md @@ -0,0 +1,15 @@ + + +# MatchCriteriaMailgunAllOf + +The set of criteria used to determine the user's identity on a third-party channel. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The channel type. | [optional] +**address** | **String** | The user’s email address. | +**subject** | **String** | May be specified to set the subject for the outgoing email. | [optional] + + + diff --git a/docs/MatchCriteriaMessagebird.md b/docs/MatchCriteriaMessagebird.md new file mode 100644 index 00000000..8d330310 --- /dev/null +++ b/docs/MatchCriteriaMessagebird.md @@ -0,0 +1,19 @@ + + +# MatchCriteriaMessagebird + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The channel type. | +**integrationId** | **String** | The ID of the integration to link. Must match the provided type. | +**primary** | **Boolean** | Flag indicating whether the client will become the primary for the target conversation once linking is complete. | [optional] +**phoneNumber** | **String** | The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. | + + +## Implemented Interfaces + +* MatchCriteria + + diff --git a/docs/MatchCriteriaMessagebirdAllOf.md b/docs/MatchCriteriaMessagebirdAllOf.md new file mode 100644 index 00000000..2cc568b8 --- /dev/null +++ b/docs/MatchCriteriaMessagebirdAllOf.md @@ -0,0 +1,14 @@ + + +# MatchCriteriaMessagebirdAllOf + +The set of criteria used to determine the user's identity on a third-party channel. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The channel type. | [optional] +**phoneNumber** | **String** | The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. | + + + diff --git a/docs/MatchCriteriaTwilio.md b/docs/MatchCriteriaTwilio.md new file mode 100644 index 00000000..938e1883 --- /dev/null +++ b/docs/MatchCriteriaTwilio.md @@ -0,0 +1,19 @@ + + +# MatchCriteriaTwilio + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The channel type. | +**integrationId** | **String** | The ID of the integration to link. Must match the provided type. | +**primary** | **Boolean** | Flag indicating whether the client will become the primary for the target conversation once linking is complete. | [optional] +**phoneNumber** | **String** | The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. | + + +## Implemented Interfaces + +* MatchCriteria + + diff --git a/docs/MatchCriteriaTwilioAllOf.md b/docs/MatchCriteriaTwilioAllOf.md new file mode 100644 index 00000000..e11c9302 --- /dev/null +++ b/docs/MatchCriteriaTwilioAllOf.md @@ -0,0 +1,14 @@ + + +# MatchCriteriaTwilioAllOf + +The set of criteria used to determine the user's identity on a third-party channel. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The channel type. | [optional] +**phoneNumber** | **String** | The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. | + + + diff --git a/docs/MatchCriteriaWhatsapp.md b/docs/MatchCriteriaWhatsapp.md new file mode 100644 index 00000000..9d885eac --- /dev/null +++ b/docs/MatchCriteriaWhatsapp.md @@ -0,0 +1,19 @@ + + +# MatchCriteriaWhatsapp + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The channel type. | +**integrationId** | **String** | The ID of the integration to link. Must match the provided type. | +**primary** | **Boolean** | Flag indicating whether the client will become the primary for the target conversation once linking is complete. | [optional] +**phoneNumber** | **String** | The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. | + + +## Implemented Interfaces + +* MatchCriteria + + diff --git a/docs/MatchCriteriaWhatsappAllOf.md b/docs/MatchCriteriaWhatsappAllOf.md new file mode 100644 index 00000000..02e3cf8d --- /dev/null +++ b/docs/MatchCriteriaWhatsappAllOf.md @@ -0,0 +1,14 @@ + + +# MatchCriteriaWhatsappAllOf + +The set of criteria used to determine the user's identity on a third-party channel. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The channel type. | [optional] +**phoneNumber** | **String** | The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. | + + + diff --git a/docs/Menu.md b/docs/Menu.md deleted file mode 100644 index 8c5fd7d4..00000000 --- a/docs/Menu.md +++ /dev/null @@ -1,10 +0,0 @@ - -# Menu - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**items** | [**List<MenuItem>**](MenuItem.md) | A list of menu items. | - - - diff --git a/docs/MenuApi.md b/docs/MenuApi.md deleted file mode 100644 index 33c38189..00000000 --- a/docs/MenuApi.md +++ /dev/null @@ -1,202 +0,0 @@ -# MenuApi - -All URIs are relative to *https://api.smooch.io* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**deleteMenu**](MenuApi.md#deleteMenu) | **DELETE** /v1.1/apps/{appId}/menu | -[**getMenu**](MenuApi.md#getMenu) | **GET** /v1.1/apps/{appId}/menu | -[**updateMenu**](MenuApi.md#updateMenu) | **PUT** /v1.1/apps/{appId}/menu | - - - -# **deleteMenu** -> MenuResponse deleteMenu(appId) - - - -Remove the specified app’s menu. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.MenuApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -MenuApi apiInstance = new MenuApi(); -String appId = "appId_example"; // String | Identifies the app. -try { - MenuResponse result = apiInstance.deleteMenu(appId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling MenuApi#deleteMenu"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - -### Return type - -[**MenuResponse**](MenuResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getMenu** -> MenuResponse getMenu(appId) - - - -Get the specified app’s menu. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.MenuApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -MenuApi apiInstance = new MenuApi(); -String appId = "appId_example"; // String | Identifies the app. -try { - MenuResponse result = apiInstance.getMenu(appId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling MenuApi#getMenu"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - -### Return type - -[**MenuResponse**](MenuResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **updateMenu** -> MenuResponse updateMenu(appId, menuUpdateBody) - - - -Configure the specified app’s menu. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.MenuApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -MenuApi apiInstance = new MenuApi(); -String appId = "appId_example"; // String | Identifies the app. -Menu menuUpdateBody = new Menu(); // Menu | Body for a updateMenu request. -try { - MenuResponse result = apiInstance.updateMenu(appId, menuUpdateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling MenuApi#updateMenu"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **menuUpdateBody** | [**Menu**](Menu.md)| Body for a updateMenu request. | - -### Return type - -[**MenuResponse**](MenuResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - diff --git a/docs/MenuItem.md b/docs/MenuItem.md deleted file mode 100644 index 7ab7a245..00000000 --- a/docs/MenuItem.md +++ /dev/null @@ -1,14 +0,0 @@ - -# MenuItem - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**text** | **String** | The button text of the menu item. | -**uri** | **String** | A valid address, like http://smooch.io. Required for a link type item. | [optional] -**type** | **String** | Can either be link, postback, which correspond to Smooch’s link and postback actions, or submenu for nested menus. See [**MenuItemTypeEnum**](Enums.md#MenuItemTypeEnum) for available values. | -**payload** | **String** | A payload for a postback. Required for a postback type item. | [optional] -**items** | [**List<SubMenuItem>**](SubMenuItem.md) | A list of menu items for a submenu. | [optional] - - - diff --git a/docs/MergedUser.md b/docs/MergedUser.md deleted file mode 100644 index bbbf8667..00000000 --- a/docs/MergedUser.md +++ /dev/null @@ -1,10 +0,0 @@ - -# MergedUser - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **String** | The `_id` of the user to merge. | [optional] - - - diff --git a/docs/Message.md b/docs/Message.md index 77720fd6..0146cb88 100644 --- a/docs/Message.md +++ b/docs/Message.md @@ -1,33 +1,19 @@ + # Message ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **String** | The message ID, generated automatically. | -**authorId** | **String** | The ID of the message's author. | -**role** | **String** | The role of the individual posting the message. See [**RoleEnum**](Enums.md#RoleEnum) for available values. | -**type** | **String** | The message type. See [**MessageTypeEnum**](Enums.md#MessageTypeEnum) for available values. | -**source** | [**Source**](Source.md) | The source of the message. | [optional] -**name** | **String** | The display name of the message author. | -**text** | **String** | The message text. Required for text messages. | -**email** | **String** | The email address of the message author. | [optional] -**avatarUrl** | **String** | The URL of the desired message avatar image. | -**received** | **Double** | The unix timestamp of the moment the message was received. | -**mediaUrl** | **String** | The mediaUrl for the message. Required for image/file messages. | [optional] -**mediaType** | **String** | The mediaType for the message. Required for image/file messages. | [optional] -**metadata** | **Object** | Flat JSON object containing any custom properties associated with the message. | [optional] -**items** | [**List<MessageItem>**](MessageItem.md) | The items in the message list. Required for carousel and list messages. | [optional] -**actions** | [**List<Action>**](Action.md) | The actions in the message. | [optional] -**payload** | **String** | The payload of a reply action, if applicable. | [optional] -**displaySettings** | [**DisplaySettings**](DisplaySettings.md) | Settings to adjust the carousel layout. See [Display Settings](https://docs.smooch.io/rest/#display-settings). | [optional] -**blockChatInput** | **Boolean** | Indicates if the Web SDK chat input should be blocked. Defaults to false. Only for form messages. | [optional] -**fields** | [**List<Field>**](Field.md) | The fields in the form. Required for form and formResponse messages. | [optional] -**submitted** | **Boolean** | Indicates if the form was submitted. Generated automatically. | [optional] -**quotedMessage** | [**QuotedMessage**](QuotedMessage.md) | The form message a formResponse message responds to. Required for formResponse messages. | [optional] -**textFallback** | **String** | The text fallback displayed in channels that do not support form messages. Only for formResponse messages. Generated automatically. | [optional] -**coordinates** | [**Coordinates**](Coordinates.md) | Data representing the location being sent in the message. | [optional] -**location** | [**Location**](Location.md) | Additional information about the location being sent in the message. | [optional] +**id** | **String** | The unique ID of the message. | [optional] +**received** | **String** | A datetime string with the format `YYYY-MM-DDThh:mm:ss.SSSZ` representing when Sunshine Conversations received the message. | [optional] +**author** | [**Author**](Author.md) | | [optional] +**content** | [**Content**](Content.md) | The content of the message. | [optional] +**source** | [**Source**](Source.md) | | [optional] +**quotedMessage** | [**QuotedMessage**](QuotedMessage.md) | The quoted message is currently only available for WhatsApp and Web Messenger `formResponse` messages. | [optional] +**metadata** | **Object** | | [optional] +**deleted** | **Boolean** | true if the message serves as a placeholder for one that has been deleted. | [optional] diff --git a/docs/MessageBird.md b/docs/MessageBird.md new file mode 100644 index 00000000..915de16f --- /dev/null +++ b/docs/MessageBird.md @@ -0,0 +1,16 @@ + + +# MessageBird + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**accessKey** | **String** | The public API key of your MessageBird account. | +**signingKey** | **String** | The signing key of your MessageBird account. Used to validate the webhooks' origin. | +**originator** | **String** | Sunshine Conversations will receive all messages sent to this phone number. | +**webhookSecret** | **String** | The secret that is used to configure webhooks in MessageBird. | [optional] [readonly] + + + diff --git a/docs/MessageBirdAllOf.md b/docs/MessageBirdAllOf.md new file mode 100644 index 00000000..9e5c2604 --- /dev/null +++ b/docs/MessageBirdAllOf.md @@ -0,0 +1,17 @@ + + +# MessageBirdAllOf + +To configure a MessageBird integration, acquire the accessKey, the signingKey and the MessageBird number you would like to use, then call the Create Integration endpoint. The response will include the integration’s _id and webhookSecret, which must be used to configure the webhook in MessageBird. In the Flow Builder for the MessageBird number you’ve used to integrate, add a new step with the following settings: * Create a new Call HTTP endpoint with SMS flow. * Select your desired SMS number for Incoming SMS. * Click on Forward to URL and set its method to POST. * Then, using the integration _id and webhookSecret returned from the create integration call, enter the following into the URL field: `https://app.smooch.io/api/messagebird/webhooks/{appId}/{integrationId}/{webhookSecret}` * Select application/json for the Set Content-Type header field. * Save and publish your changes. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**accessKey** | **String** | The public API key of your MessageBird account. | +**signingKey** | **String** | The signing key of your MessageBird account. Used to validate the webhooks' origin. | +**originator** | **String** | Sunshine Conversations will receive all messages sent to this phone number. | +**webhookSecret** | **String** | The secret that is used to configure webhooks in MessageBird. | [optional] [readonly] + + + diff --git a/docs/MessageBirdUpdate.md b/docs/MessageBirdUpdate.md new file mode 100644 index 00000000..37c23bf0 --- /dev/null +++ b/docs/MessageBirdUpdate.md @@ -0,0 +1,15 @@ + + +# MessageBirdUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + +## Implemented Interfaces + +* IntegrationUpdate + + diff --git a/docs/MessageItem.md b/docs/MessageItem.md deleted file mode 100644 index e27266ec..00000000 --- a/docs/MessageItem.md +++ /dev/null @@ -1,15 +0,0 @@ - -# MessageItem - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**title** | **String** | The title of the message item. | -**description** | **String** | The text description, or subtitle. | [optional] -**mediaUrl** | **String** | The image URL to be shown in the carousel/list item. | [optional] -**size** | **String** | The size of the image to be shown in the carousel/list item. Only top item of Facebook Messenger carousel supported. See [**MessageItemSizeEnum**](Enums.md#MessageItemSizeEnum) for available values. | [optional] -**mediaType** | **String** | If a *mediaUrl* was specified, the media type is defined here, for example *image/jpeg*. | [optional] -**actions** | [**List<Action>**](Action.md) | Array of [action buttons](https://docs.smooch.io/rest/#action-buttons). At least 1 is required, a maximum of 3 are allowed. | - - - diff --git a/docs/MessageListResponse.md b/docs/MessageListResponse.md new file mode 100644 index 00000000..a4178dfa --- /dev/null +++ b/docs/MessageListResponse.md @@ -0,0 +1,14 @@ + + +# MessageListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**messages** | [**List<Message>**](Message.md) | List of returned messages. | [optional] +**meta** | [**Meta**](Meta.md) | | [optional] +**links** | [**Links**](Links.md) | | [optional] + + + diff --git a/docs/MessageOverride.md b/docs/MessageOverride.md index 1a1a60f7..bb444189 100644 --- a/docs/MessageOverride.md +++ b/docs/MessageOverride.md @@ -1,12 +1,16 @@ + # MessageOverride +A raw payload containing a message that is sent directly to a channel. Messages for [Apple Business Chat](https://docs.smooch.io/guide/apple-business-chat/#passthrough-api), [Line](https://docs.smooch.io/guide/line/#passthrough-api), [Messenger](https://docs.smooch.io/guide/facebook-messenger/#passthrough-api), [Whatsapp](https://docs.smooch.io/guide/whatsapp/#passthrough-api) channels are supported. ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**whatsapp** | [**MessageOverrideWhatsapp**](MessageOverrideWhatsapp.md) | | [optional] -**line** | [**MessageOverrideLine**](MessageOverrideLine.md) | | [optional] -**messenger** | [**MessageOverrideMessenger**](MessageOverrideMessenger.md) | | [optional] +**apple** | [**MessageOverridePayload**](MessageOverridePayload.md) | | [optional] +**line** | [**MessageOverridePayload**](MessageOverridePayload.md) | | [optional] +**messenger** | [**MessageOverridePayload**](MessageOverridePayload.md) | | [optional] +**whatsapp** | [**MessageOverridePayload**](MessageOverridePayload.md) | | [optional] diff --git a/docs/MessageOverrideApple.md b/docs/MessageOverrideApple.md new file mode 100644 index 00000000..88e4c403 --- /dev/null +++ b/docs/MessageOverrideApple.md @@ -0,0 +1,12 @@ + + +# MessageOverrideApple + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**apple** | [**MessageOverridePayload**](MessageOverridePayload.md) | | [optional] + + + diff --git a/docs/MessageOverrideLine.md b/docs/MessageOverrideLine.md index d9d0eb28..75996254 100644 --- a/docs/MessageOverrideLine.md +++ b/docs/MessageOverrideLine.md @@ -1,10 +1,12 @@ + # MessageOverrideLine ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**payload** | **Object** | The exact payload to send to LINE. | [optional] +**line** | [**MessageOverridePayload**](MessageOverridePayload.md) | | [optional] diff --git a/docs/MessageOverrideMessenger.md b/docs/MessageOverrideMessenger.md index 52bb23e9..4a8abbca 100644 --- a/docs/MessageOverrideMessenger.md +++ b/docs/MessageOverrideMessenger.md @@ -1,10 +1,12 @@ + # MessageOverrideMessenger ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**payload** | **Object** | The exact payload to send to Facebook Messenger. | [optional] +**messenger** | [**MessageOverridePayload**](MessageOverridePayload.md) | | [optional] diff --git a/docs/MessageOverridePayload.md b/docs/MessageOverridePayload.md new file mode 100644 index 00000000..9ff4e7a3 --- /dev/null +++ b/docs/MessageOverridePayload.md @@ -0,0 +1,13 @@ + + +# MessageOverridePayload + +The exact payload to send to the channel. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payload** | [**Object**](.md) | | [optional] + + + diff --git a/docs/MessageOverrideWhatsapp.md b/docs/MessageOverrideWhatsapp.md index 932bac0c..e9301bc0 100644 --- a/docs/MessageOverrideWhatsapp.md +++ b/docs/MessageOverrideWhatsapp.md @@ -1,10 +1,12 @@ + # MessageOverrideWhatsapp ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**payload** | **Object** | The exact payload to send to WhatsApp. | [optional] +**whatsapp** | [**MessageOverridePayload**](MessageOverridePayload.md) | | [optional] diff --git a/docs/MessagePost.md b/docs/MessagePost.md index 86b20e72..2022d3b4 100644 --- a/docs/MessagePost.md +++ b/docs/MessagePost.md @@ -1,28 +1,16 @@ + # MessagePost ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**role** | **String** | The role of the individual posting the message. See [**RoleEnum**](Enums.md#RoleEnum) for available values. | -**type** | **String** | The message type. See [**MessageTypeEnum**](Enums.md#MessageTypeEnum) for available values. | -**name** | **String** | The display name of the message author. | [optional] -**email** | **String** | The email address of the message author. | [optional] -**avatarUrl** | **String** | The URL of the desired message avatar image. | [optional] -**metadata** | **Object** | Flat JSON object containing any custom properties associated with the message. | [optional] -**payload** | **String** | The payload of a reply action, if applicable. | [optional] -**text** | **String** | The message text. Required for text messages. | [optional] -**mediaUrl** | **String** | The mediaUrl for the message. Required for image/file messages. | [optional] -**mediaType** | **String** | The mediaType for the message. Required for image/file messages. | [optional] -**items** | [**List<MessageItem>**](MessageItem.md) | The items in the message list. Required for carousel and list messages. | [optional] -**actions** | [**List<Action>**](Action.md) | The actions in the message. | [optional] -**blockChatInput** | **Boolean** | Indicates if the Web SDK chat input should be blocked. Defaults to false. Only for form messages. | [optional] -**displaySettings** | [**DisplaySettings**](DisplaySettings.md) | Settings to adjust the carousel layout. See [Display Settings](https://docs.smooch.io/rest/#display-settings). | [optional] -**fields** | [**List<FieldPost>**](FieldPost.md) | The fields in the form. Required for form messages. | [optional] -**destination** | [**Destination**](Destination.md) | Specifies which channel to deliver a message to. See [list integrations](https://docs.smooch.io/rest/#list-integrations) to get integration ID and type. | [optional] -**override** | [**MessageOverride**](MessageOverride.md) | Specifies channel-specific overrides to use in order to bypass Smooch's message translation logic. | [optional] -**coordinates** | [**Coordinates**](Coordinates.md) | Data representing the location being sent in the message. | [optional] -**location** | [**Location**](Location.md) | Additional information about the location being sent in the message. | [optional] +**author** | [**Author**](Author.md) | The author of the message. | +**content** | [**Content**](Content.md) | The content of the message. | +**destination** | [**Destination**](Destination.md) | | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] +**override** | [**MessageOverride**](MessageOverride.md) | | [optional] diff --git a/docs/MessagePostResponse.md b/docs/MessagePostResponse.md new file mode 100644 index 00000000..3b66f311 --- /dev/null +++ b/docs/MessagePostResponse.md @@ -0,0 +1,13 @@ + + +# MessagePostResponse + +The created messages. A single request may produce multiple messages when the shorthand syntax is used to send a template message with leading text. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**messages** | [**List<Message>**](Message.md) | | [optional] + + + diff --git a/docs/MessageResponse.md b/docs/MessageResponse.md deleted file mode 100644 index eabc7916..00000000 --- a/docs/MessageResponse.md +++ /dev/null @@ -1,12 +0,0 @@ - -# MessageResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**message** | [**Message**](Message.md) | The message. | -**extraMessages** | [**List<Message>**](Message.md) | List of extra messages created. | [optional] -**conversation** | [**Conversation**](Conversation.md) | The conversation. | - - - diff --git a/docs/MessagesApi.md b/docs/MessagesApi.md new file mode 100644 index 00000000..de6b5fbb --- /dev/null +++ b/docs/MessagesApi.md @@ -0,0 +1,333 @@ +# MessagesApi + +All URIs are relative to *https://api.smooch.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteAllMessages**](MessagesApi.md#deleteAllMessages) | **DELETE** /v2/apps/{appId}/conversations/{conversationId}/messages | Delete All Messages +[**deleteMessage**](MessagesApi.md#deleteMessage) | **DELETE** /v2/apps/{appId}/conversations/{conversationId}/messages/{messageId} | Delete Message +[**listMessages**](MessagesApi.md#listMessages) | **GET** /v2/apps/{appId}/conversations/{conversationId}/messages | List Messages +[**postMessage**](MessagesApi.md#postMessage) | **POST** /v2/apps/{appId}/conversations/{conversationId}/messages | Post Message + + + +## deleteAllMessages + +> Object deleteAllMessages(appId, conversationId) + +Delete All Messages + +Delete all messages of a particular conversation. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.MessagesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + MessagesApi apiInstance = new MessagesApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation. + // Add required body parameters + + try { + Object result = apiInstance.deleteAllMessages(appId, conversationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MessagesApi#deleteAllMessages"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **conversationId** | **String**| Identifies the conversation. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Not found | - | + + +## deleteMessage + +> Object deleteMessage(appId, conversationId, messageId) + +Delete Message + +Delete a single message of a particular conversation. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.MessagesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + MessagesApi apiInstance = new MessagesApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation. + String messageId = "029c31f25a21b47effd7be90"; // String | The id of the message. + // Add required body parameters + + try { + Object result = apiInstance.deleteMessage(appId, conversationId, messageId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MessagesApi#deleteMessage"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **conversationId** | **String**| Identifies the conversation. | + **messageId** | **String**| The id of the message. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Not found | - | + + +## listMessages + +> MessageListResponse listMessages(appId, conversationId, page) + +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 ``` + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.MessagesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + MessagesApi apiInstance = new MessagesApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation. + Page page = new Page(); // Page | Contains parameters for applying cursor pagination. + // Add required body parameters + + try { + MessageListResponse result = apiInstance.listMessages(appId, conversationId, page); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MessagesApi#listMessages"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **conversationId** | **String**| Identifies the conversation. | + **page** | [**Page**](.md)| Contains parameters for applying cursor pagination. | [optional] + +### Return type + +[**MessageListResponse**](MessageListResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Message not found | - | + + +## postMessage + +> MessagePostResponse postMessage(messagePost, appId, conversationId) + +Post Message + +Send a message in a particular conversation. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.MessagesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + MessagesApi apiInstance = new MessagesApi(defaultClient); + MessagePost messagePost = {"author":{"type":"business","displayName":"Steve","avatarUrl":"https://www.gravatar.com/image.jpg"},"content":{"type":"text","text":"Hello!"},"metadata":{"lang":"en-ca"}}; // MessagePost | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation. + // Add required body parameters + + try { + MessagePostResponse result = apiInstance.postMessage(messagePost, appId, conversationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MessagesApi#postMessage"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **messagePost** | [**MessagePost**](MessagePost.md)| | + **appId** | **String**| Identifies the app. | + **conversationId** | **String**| Identifies the conversation. | + +### Return type + +[**MessagePostResponse**](MessagePostResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | + diff --git a/docs/Messenger.md b/docs/Messenger.md new file mode 100644 index 00000000..aa46b998 --- /dev/null +++ b/docs/Messenger.md @@ -0,0 +1,15 @@ + + +# Messenger + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**pageAccessToken** | **String** | A Facebook Page Access Token. | +**appId** | **String** | A Facebook App ID. | +**appSecret** | **String** | A Facebook App Secret. | + + + diff --git a/docs/MessengerAllOf.md b/docs/MessengerAllOf.md new file mode 100644 index 00000000..77cec189 --- /dev/null +++ b/docs/MessengerAllOf.md @@ -0,0 +1,16 @@ + + +# MessengerAllOf + +Facebook Messenger Setup steps: Take note of your Facebook app ID and secret (apps can be created at developer.facebook.com); The Facebook app must have been submitted to Facebook for approval with the “manage_pages” (to receive messages through webhook) and “pages_messaging” (to send messages) permissions. In order to integrate a Facebook Messenger app you must acquire a Page Access Token from your user. Once you have acquired a page access token from your user, call the Create Integration endpoint with your app secret and ID and the user’s page access token. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**pageAccessToken** | **String** | A Facebook Page Access Token. | +**appId** | **String** | A Facebook App ID. | +**appSecret** | **String** | A Facebook App Secret. | + + + diff --git a/docs/MessengerUpdate.md b/docs/MessengerUpdate.md new file mode 100644 index 00000000..a6f28c7e --- /dev/null +++ b/docs/MessengerUpdate.md @@ -0,0 +1,17 @@ + + +# MessengerUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**displayName** | **String** | A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`. | [optional] +**pageAccessToken** | **String** | A Facebook Page Access Token. | [optional] + + +## Implemented Interfaces + +* IntegrationUpdate + + diff --git a/docs/MessengerUpdateAllOf.md b/docs/MessengerUpdateAllOf.md new file mode 100644 index 00000000..64d8dce3 --- /dev/null +++ b/docs/MessengerUpdateAllOf.md @@ -0,0 +1,12 @@ + + +# MessengerUpdateAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pageAccessToken** | **String** | A Facebook Page Access Token. | [optional] + + + diff --git a/docs/Meta.md b/docs/Meta.md new file mode 100644 index 00000000..9a75dfd4 --- /dev/null +++ b/docs/Meta.md @@ -0,0 +1,15 @@ + + +# Meta + +Response metadata. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hasMore** | **Boolean** | A flag that indicates if there are more records that can be fetched. | [optional] +**afterCursor** | **String** | A record id that can be used as a `page[after]` parameter in a new request to get the next page. Not specified if there are no subsequent pages. | [optional] +**beforeCursor** | **String** | A record id that can be used as a `page[before]` parameter in a new request to get the previous page. Not specified if there are no previous pages. | [optional] + + + diff --git a/docs/NotificationApi.md b/docs/NotificationApi.md deleted file mode 100644 index 5921d447..00000000 --- a/docs/NotificationApi.md +++ /dev/null @@ -1,74 +0,0 @@ -# NotificationApi - -All URIs are relative to *https://api.smooch.io* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**postNotification**](NotificationApi.md#postNotification) | **POST** /v1/apps/{appId}/notifications | - - - -# **postNotification** -> NotificationResponse postNotification(appId, notificationPostBody) - - - -Post a notification to an externalId. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.NotificationApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -NotificationApi apiInstance = new NotificationApi(); -String appId = "appId_example"; // String | Identifies the app. -NotificationPost notificationPostBody = new NotificationPost(); // NotificationPost | Body for a postNotification request. -try { - NotificationResponse result = apiInstance.postNotification(appId, notificationPostBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling NotificationApi#postNotification"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **notificationPostBody** | [**NotificationPost**](NotificationPost.md)| Body for a postNotification request. | - -### Return type - -[**NotificationResponse**](NotificationResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - diff --git a/docs/NotificationPost.md b/docs/NotificationPost.md deleted file mode 100644 index d55dd763..00000000 --- a/docs/NotificationPost.md +++ /dev/null @@ -1,13 +0,0 @@ - -# NotificationPost - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**destination** | [**NotificationPostDestination**](NotificationPostDestination.md) | The destination of the notification. | -**messageSchema** | **String** | If specified, the only accepted value is `whatsapp`. To be included when sending WhatsApp message templates. | [optional] -**author** | [**Author**](Author.md) | An object containing role, email, name and avatarUrl. | -**message** | **Object** | The notification message to send. | - - - diff --git a/docs/NotificationPostDestination.md b/docs/NotificationPostDestination.md deleted file mode 100644 index fa06fd78..00000000 --- a/docs/NotificationPostDestination.md +++ /dev/null @@ -1,11 +0,0 @@ - -# NotificationPostDestination - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**integrationId** | **String** | The ID of the target integration. | -**destinationId** | **String** | The external ID (channel specific) of the target user. | - - - diff --git a/docs/NotificationResponse.md b/docs/NotificationResponse.md deleted file mode 100644 index cf88408b..00000000 --- a/docs/NotificationResponse.md +++ /dev/null @@ -1,10 +0,0 @@ - -# NotificationResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**notification** | [**NotificationResponseNotification**](NotificationResponseNotification.md) | | [optional] - - - diff --git a/docs/NotificationResponseNotification.md b/docs/NotificationResponseNotification.md deleted file mode 100644 index a5da116f..00000000 --- a/docs/NotificationResponseNotification.md +++ /dev/null @@ -1,10 +0,0 @@ - -# NotificationResponseNotification - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **String** | Automatically generated UUID used to identify the notification in Webhooks. | - - - diff --git a/docs/OfferControlBody.md b/docs/OfferControlBody.md new file mode 100644 index 00000000..7a809f82 --- /dev/null +++ b/docs/OfferControlBody.md @@ -0,0 +1,13 @@ + + +# OfferControlBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**switchboardIntegration** | **String** | The id or the name of the switchboard integration that will become pending. Also supports the `next` keyword to offer control to the next switchboard integration designated in the switchboard hierarchy configuration. This cannot match the active switchboard integration. | +**metadata** | **Object** | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. The metadata object will be included in the `switchboard:offerControl` and `switchboard:offerControl:failure` webhooks. | [optional] + + + diff --git a/docs/Option.md b/docs/Option.md deleted file mode 100644 index 75d51133..00000000 --- a/docs/Option.md +++ /dev/null @@ -1,11 +0,0 @@ - -# Option - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **String** | The name of the option. It must be unique per field. | -**label** | **String** | The label the option will be displayed with on Web Messenger. | - - - diff --git a/docs/Page.md b/docs/Page.md new file mode 100644 index 00000000..2fd75571 --- /dev/null +++ b/docs/Page.md @@ -0,0 +1,14 @@ + + +# Page + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**after** | **String** | A record id. Results will only contain the records that come after the specified record. Only one of `after` or `before` can be provided, not both. | [optional] +**before** | **String** | A record id. Results will only contain the records that come before the specified record. Only one of `after` or `before` can be provided, not both. | [optional] +**size** | **Integer** | The number of records to return. | [optional] + + + diff --git a/docs/Participant.md b/docs/Participant.md new file mode 100644 index 00000000..81f84cc7 --- /dev/null +++ b/docs/Participant.md @@ -0,0 +1,17 @@ + + +# Participant + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the participant. | [optional] +**userId** | **String** | The id of the associated user. | [optional] +**unreadCount** | **Integer** | Number of messages the user has not yet read. | [optional] +**clientAssociations** | [**List<ClientAssociation>**](ClientAssociation.md) | Represents the clients that are active in the conversation for a particular user. A participant can have multiple clientAssociations in the case of channel transfer, business initiated conversations, or identified users. The order of the array indicates how recently a client has interacted with the conversation, with the most recent client first. The first item in the array is considered to be the user's primary client for that conversation, and will be selected first for message delivery. | [optional] +**userExternalId** | **String** | The externalId of the associated user. | [optional] +**lastRead** | **String** | A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the latest message the user has read. | [optional] + + + diff --git a/docs/MenuResponse.md b/docs/ParticipantJoinBody.md similarity index 65% rename from docs/MenuResponse.md rename to docs/ParticipantJoinBody.md index 24d3aa81..6a50a907 100644 --- a/docs/MenuResponse.md +++ b/docs/ParticipantJoinBody.md @@ -1,10 +1,11 @@ -# MenuResponse + +# ParticipantJoinBody ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**menu** | [**Menu**](Menu.md) | The menu. | diff --git a/docs/ParticipantLeaveBody.md b/docs/ParticipantLeaveBody.md new file mode 100644 index 00000000..c96d734e --- /dev/null +++ b/docs/ParticipantLeaveBody.md @@ -0,0 +1,11 @@ + + +# Interface ParticipantLeaveBody + +## Implementing Classes + +* ParticipantLeaveBodyParticipantId +* ParticipantLeaveBodyUserExternalId +* ParticipantLeaveBodyUserId + + diff --git a/docs/ParticipantLeaveBodyParticipantId.md b/docs/ParticipantLeaveBodyParticipantId.md new file mode 100644 index 00000000..440806a1 --- /dev/null +++ b/docs/ParticipantLeaveBodyParticipantId.md @@ -0,0 +1,16 @@ + + +# ParticipantLeaveBodyParticipantId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**participantId** | **String** | The participantId of the user that will be removed from the conversation. It will return 404 if the user can’t be found. | [optional] + + +## Implemented Interfaces + +* ParticipantLeaveBody + + diff --git a/docs/ParticipantLeaveBodyUserExternalId.md b/docs/ParticipantLeaveBodyUserExternalId.md new file mode 100644 index 00000000..6b01d0ad --- /dev/null +++ b/docs/ParticipantLeaveBodyUserExternalId.md @@ -0,0 +1,16 @@ + + +# ParticipantLeaveBodyUserExternalId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**userExternalId** | **String** | The externalId of the user that will be removed from the conversation. It will return 404 if the user can’t be found. | [optional] + + +## Implemented Interfaces + +* ParticipantLeaveBody + + diff --git a/docs/ParticipantLeaveBodyUserId.md b/docs/ParticipantLeaveBodyUserId.md new file mode 100644 index 00000000..1223eecf --- /dev/null +++ b/docs/ParticipantLeaveBodyUserId.md @@ -0,0 +1,16 @@ + + +# ParticipantLeaveBodyUserId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**userId** | **String** | The id of the user that will be removed from the conversation. It will return 404 if the user can’t be found. | [optional] + + +## Implemented Interfaces + +* ParticipantLeaveBody + + diff --git a/docs/ParticipantListResponse.md b/docs/ParticipantListResponse.md new file mode 100644 index 00000000..e601df4a --- /dev/null +++ b/docs/ParticipantListResponse.md @@ -0,0 +1,15 @@ + + +# ParticipantListResponse + +List of returned participants. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**participants** | [**List<Participant>**](Participant.md) | | [optional] +**meta** | [**Meta**](Meta.md) | | [optional] +**links** | [**Links**](Links.md) | | [optional] + + + diff --git a/docs/ParticipantResponse.md b/docs/ParticipantResponse.md new file mode 100644 index 00000000..a6be2d99 --- /dev/null +++ b/docs/ParticipantResponse.md @@ -0,0 +1,13 @@ + + +# ParticipantResponse + +The created participant. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**participant** | [**Participant**](Participant.md) | | [optional] + + + diff --git a/docs/ParticipantSubSchema.md b/docs/ParticipantSubSchema.md new file mode 100644 index 00000000..6e87d02f --- /dev/null +++ b/docs/ParticipantSubSchema.md @@ -0,0 +1,14 @@ + + +# ParticipantSubSchema + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**userId** | **String** | The id of the user that will be participating in the conversation. It will return `404` if the user can’t be found. One of `userId` or `userExternalId` is required, but not both. | [optional] +**subscribeSDKClient** | **Boolean** | When passed as true, the SDK client of the concerned participant will be subscribed to the conversation. The user will start receiving push notifications for this conversation right away, without having to view the conversation on the SDK beforehand. An SDK client will be created for users that don’t already have one. This field is required if the conversation is of type `sdkGroup`. | [optional] +**userExternalId** | **String** | The `externalId` of the user that will be participating in the conversation. It will return `404` if the user can’t be found. One of `userId` or `userExternalId` is required, but not both. | [optional] + + + diff --git a/docs/ParticipantWithUserExternalId.md b/docs/ParticipantWithUserExternalId.md new file mode 100644 index 00000000..079e25f9 --- /dev/null +++ b/docs/ParticipantWithUserExternalId.md @@ -0,0 +1,13 @@ + + +# ParticipantWithUserExternalId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**userExternalId** | **String** | The `externalId` of the user that will be participating in the conversation. It will return `404` if the user can’t be found. One of `userId` or `userExternalId` is required, but not both. | [optional] +**subscribeSDKClient** | **Boolean** | When passed as true, the SDK client of the concerned participant will be subscribed to the conversation. The user will start receiving push notifications for this conversation right away, without having to view the conversation on the SDK beforehand. An SDK client will be created for users that don’t already have one. This field is required if the conversation is of type `sdkGroup`. | [optional] + + + diff --git a/docs/ParticipantWithUserId.md b/docs/ParticipantWithUserId.md new file mode 100644 index 00000000..d2f3369d --- /dev/null +++ b/docs/ParticipantWithUserId.md @@ -0,0 +1,13 @@ + + +# ParticipantWithUserId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**userId** | **String** | The id of the user that will be participating in the conversation. It will return `404` if the user can’t be found. One of `userId` or `userExternalId` is required, but not both. | [optional] +**subscribeSDKClient** | **Boolean** | When passed as true, the SDK client of the concerned participant will be subscribed to the conversation. The user will start receiving push notifications for this conversation right away, without having to view the conversation on the SDK beforehand. An SDK client will be created for users that don’t already have one. This field is required if the conversation is of type `sdkGroup`. | [optional] + + + diff --git a/docs/ParticipantsApi.md b/docs/ParticipantsApi.md new file mode 100644 index 00000000..7ede3378 --- /dev/null +++ b/docs/ParticipantsApi.md @@ -0,0 +1,255 @@ +# ParticipantsApi + +All URIs are relative to *https://api.smooch.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**joinConversation**](ParticipantsApi.md#joinConversation) | **POST** /v2/apps/{appId}/conversations/{conversationId}/join | Join Conversation +[**leaveConversation**](ParticipantsApi.md#leaveConversation) | **POST** /v2/apps/{appId}/conversations/{conversationId}/leave | Leave Conversation +[**listParticipants**](ParticipantsApi.md#listParticipants) | **GET** /v2/apps/{appId}/conversations/{conversationId}/participants | List Participants + + + +## joinConversation + +> ParticipantResponse joinConversation(participantJoinBody, appId, conversationId) + +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. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.ParticipantsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + ParticipantsApi apiInstance = new ParticipantsApi(defaultClient); + ParticipantJoinBody participantJoinBody = new ParticipantJoinBody(); // ParticipantJoinBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation. + // Add required body parameters + + try { + ParticipantResponse result = apiInstance.joinConversation(participantJoinBody, appId, conversationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ParticipantsApi#joinConversation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **participantJoinBody** | [**ParticipantJoinBody**](ParticipantJoinBody.md)| | + **appId** | **String**| Identifies the app. | + **conversationId** | **String**| Identifies the conversation. | + +### Return type + +[**ParticipantResponse**](ParticipantResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **400** | Too many participants | - | +| **404** | Conversation not found | - | + + +## leaveConversation + +> Object leaveConversation(participantLeaveBody, appId, conversationId) + +Leave Conversation + +Removes a user from a conversation using either their userId, userExternalId, or participantId. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.ParticipantsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + ParticipantsApi apiInstance = new ParticipantsApi(defaultClient); + ParticipantLeaveBody participantLeaveBody = new ParticipantLeaveBody(); // ParticipantLeaveBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation. + // Add required body parameters + + try { + Object result = apiInstance.leaveConversation(participantLeaveBody, appId, conversationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ParticipantsApi#leaveConversation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **participantLeaveBody** | [**ParticipantLeaveBody**](ParticipantLeaveBody.md)| | + **appId** | **String**| Identifies the app. | + **conversationId** | **String**| Identifies the conversation. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | User is not a member of the conversation | - | + + +## listParticipants + +> ParticipantListResponse listParticipants(appId, conversationId, page) + +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 ``` + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.ParticipantsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + ParticipantsApi apiInstance = new ParticipantsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation. + Page page = new Page(); // Page | Contains parameters for applying cursor pagination. + // Add required body parameters + + try { + ParticipantListResponse result = apiInstance.listParticipants(appId, conversationId, page); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ParticipantsApi#listParticipants"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **conversationId** | **String**| Identifies the conversation. | + **page** | [**Page**](.md)| Contains parameters for applying cursor pagination. | [optional] + +### Return type + +[**ParticipantListResponse**](ParticipantListResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Not found | - | + diff --git a/docs/PassControlBody.md b/docs/PassControlBody.md new file mode 100644 index 00000000..5a6f10a6 --- /dev/null +++ b/docs/PassControlBody.md @@ -0,0 +1,13 @@ + + +# PassControlBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**switchboardIntegration** | **String** | The id or the name of the switchboard integration that will become active. May also use the `next` keyword to transfer control to the next switchboard integration designated in the switchboard hierarchy configuration | +**metadata** | **Object** | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. The metadata object will be included in the `switchboard:passControl` webhook. | [optional] + + + diff --git a/docs/Postback.md b/docs/Postback.md new file mode 100644 index 00000000..02909c8d --- /dev/null +++ b/docs/Postback.md @@ -0,0 +1,20 @@ + + +# Postback + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of action. | +**text** | **String** | The button text. | +**payload** | [**Object**](.md) | The payload of a postback or reply button. | +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] + + +## Implemented Interfaces + +* Action +* ActionSubset + + diff --git a/docs/PostbackWebhook.md b/docs/PostbackWebhook.md new file mode 100644 index 00000000..ca80fc38 --- /dev/null +++ b/docs/PostbackWebhook.md @@ -0,0 +1,13 @@ + + +# PostbackWebhook + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payload** | **String** | The payload associated with the postback. | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] + + + diff --git a/docs/PrechatCapture.md b/docs/PrechatCapture.md new file mode 100644 index 00000000..2d6c0eea --- /dev/null +++ b/docs/PrechatCapture.md @@ -0,0 +1,15 @@ + + +# PrechatCapture + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**avatarUrl** | **String** | Sets the URL of the avatar to use for the automatic reply to the prechat capture messages. | [optional] +**enabled** | **Boolean** | If true, enables the Prechat Capture add-on when the Web Messenger is initialized. | [optional] +**enableEmailLinking** | **Boolean** | f true and Mailgun is integrated, will automatically link submitted emails. | [optional] +**fields** | [**List<Field>**](Field.md) | Array of Fields. Overrides the default Prechat Capture fields to define a custom form. | [optional] + + + diff --git a/docs/Profile.md b/docs/Profile.md new file mode 100644 index 00000000..f92e1016 --- /dev/null +++ b/docs/Profile.md @@ -0,0 +1,16 @@ + + +# Profile + +Object hosting user profile information. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**givenName** | **String** | The user's given name (first name). | [optional] +**surname** | **String** | The user's surname (last name). | [optional] +**email** | **String** | The user's email address. | [optional] +**avatarUrl** | [**URI**](URI.md) | The user's avatar. | [optional] + + + diff --git a/docs/QuotedMessage.md b/docs/QuotedMessage.md index b46f6848..40ec247d 100644 --- a/docs/QuotedMessage.md +++ b/docs/QuotedMessage.md @@ -1,12 +1,10 @@ -# QuotedMessage -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **String** | The quoted message type. See [**QuotedMessageTypeEnum**](Enums.md#QuotedMessageTypeEnum) for available values. | -**externalMessageId** | **String** | The external message Id of the quoted message. Only for quoted messages with type set to externalMessageId. | [optional] -**content** | [**Message**](Message.md) | | [optional] +# Interface QuotedMessage +## Implementing Classes + +* QuotedMessageExternalMessageId +* QuotedMessageMessage diff --git a/docs/QuotedMessageExternalMessageId.md b/docs/QuotedMessageExternalMessageId.md new file mode 100644 index 00000000..eb15777d --- /dev/null +++ b/docs/QuotedMessageExternalMessageId.md @@ -0,0 +1,17 @@ + + +# QuotedMessageExternalMessageId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of quotedMessage - `externalMessageId` if no Sunshine Conversations message matched the quoted message. | [optional] +**externalMessageId** | **String** | The external message Id of the quoted message. | [optional] + + +## Implemented Interfaces + +* QuotedMessage + + diff --git a/docs/QuotedMessageMessage.md b/docs/QuotedMessageMessage.md new file mode 100644 index 00000000..e7af0511 --- /dev/null +++ b/docs/QuotedMessageMessage.md @@ -0,0 +1,17 @@ + + +# QuotedMessageMessage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of quotedMessage - a complete Sunshine Conversations message is provided. | [optional] +**message** | [**Message**](Message.md) | | [optional] + + +## Implemented Interfaces + +* QuotedMessage + + diff --git a/docs/Referral.md b/docs/Referral.md new file mode 100644 index 00000000..3b085f5a --- /dev/null +++ b/docs/Referral.md @@ -0,0 +1,13 @@ + + +# Referral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **String** | The referral’s identifier. | [optional] +**details** | [**ReferralDetails**](ReferralDetails.md) | | [optional] + + + diff --git a/docs/ReferralDetails.md b/docs/ReferralDetails.md new file mode 100644 index 00000000..4cf4b1c9 --- /dev/null +++ b/docs/ReferralDetails.md @@ -0,0 +1,15 @@ + + +# ReferralDetails + +Nested object containing additional information. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source** | **String** | The source of the referral - MESSENGER_CODE, ADS etc… | [optional] +**type** | **String** | The type of referral, typically OPEN-THREAD. | [optional] +**adId** | **String** | If the referral came from an ad, this field will be present with the ad’s Id. | [optional] + + + diff --git a/docs/Reply.md b/docs/Reply.md new file mode 100644 index 00000000..b5236c44 --- /dev/null +++ b/docs/Reply.md @@ -0,0 +1,20 @@ + + +# Reply + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of action. | +**text** | **String** | The button text. Text longer than 20 characters will be truncated on Facebook Messenger, and longer than 40 characters will be truncated on Web Messenger, iOS, and Android. | +**payload** | **String** | A string payload to help you identify the action context. Used when posting the reply. You can also use metadata for more complex needs. | +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] +**iconUrl** | **String** | An icon to render next to the reply option. | [optional] + + +## Implemented Interfaces + +* Action + + diff --git a/docs/SecretKey.md b/docs/SecretKey.md deleted file mode 100644 index 5b8d012a..00000000 --- a/docs/SecretKey.md +++ /dev/null @@ -1,12 +0,0 @@ - -# SecretKey - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **String** | The secret key ID, generated automatically. | -**secret** | **String** | The secret itself. | -**name** | **String** | A friendly identifier for the secret key. | - - - diff --git a/docs/SecretKeyCreate.md b/docs/SecretKeyCreate.md deleted file mode 100644 index f22651dc..00000000 --- a/docs/SecretKeyCreate.md +++ /dev/null @@ -1,10 +0,0 @@ - -# SecretKeyCreate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **String** | A friendly identifier for the secret key. | - - - diff --git a/docs/SecretKeyResponse.md b/docs/SecretKeyResponse.md deleted file mode 100644 index b84c65a4..00000000 --- a/docs/SecretKeyResponse.md +++ /dev/null @@ -1,10 +0,0 @@ - -# SecretKeyResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**key** | [**SecretKey**](SecretKey.md) | The secret key. | [optional] - - - diff --git a/docs/Select.md b/docs/Select.md deleted file mode 100644 index 05336f8d..00000000 --- a/docs/Select.md +++ /dev/null @@ -1,12 +0,0 @@ - -# Select - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **String** | The select ID, generated automatically. | [optional] -**name** | **String** | The name of the selected option. | -**label** | **String** | The label of the selected option. | - - - diff --git a/docs/ServiceAccount.md b/docs/ServiceAccount.md deleted file mode 100644 index b7550ad2..00000000 --- a/docs/ServiceAccount.md +++ /dev/null @@ -1,11 +0,0 @@ - -# ServiceAccount - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **String** | The service account's ID. | -**name** | **String** | The service account's name. | - - - diff --git a/docs/ServiceAccountApi.md b/docs/ServiceAccountApi.md deleted file mode 100644 index cafd66ac..00000000 --- a/docs/ServiceAccountApi.md +++ /dev/null @@ -1,658 +0,0 @@ -# ServiceAccountApi - -All URIs are relative to *https://api.smooch.io* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createSecretKey**](ServiceAccountApi.md#createSecretKey) | **POST** /v1.1/serviceaccounts/{serviceAccountId}/keys | -[**createServiceAccount**](ServiceAccountApi.md#createServiceAccount) | **POST** /v1.1/serviceaccounts | -[**deleteSecretKey**](ServiceAccountApi.md#deleteSecretKey) | **DELETE** /v1.1/serviceaccounts/{serviceAccountId}/keys/{keyId} | -[**deleteServiceAccount**](ServiceAccountApi.md#deleteServiceAccount) | **DELETE** /v1.1/serviceaccounts/{serviceAccountId} | -[**getJwt**](ServiceAccountApi.md#getJwt) | **GET** /v1.1/serviceaccounts/{serviceAccountId}/keys/{keyId}/jwt | -[**getSecretKey**](ServiceAccountApi.md#getSecretKey) | **GET** /v1.1/serviceaccounts/{serviceAccountId}/keys/{keyId} | -[**getServiceAccount**](ServiceAccountApi.md#getServiceAccount) | **GET** /v1.1/serviceaccounts/{serviceAccountId} | -[**listSecretKeys**](ServiceAccountApi.md#listSecretKeys) | **GET** /v1.1/serviceaccounts/{serviceAccountId}/keys | -[**listServiceAccounts**](ServiceAccountApi.md#listServiceAccounts) | **GET** /v1.1/serviceaccounts | -[**updateServiceAccount**](ServiceAccountApi.md#updateServiceAccount) | **PUT** /v1.1/serviceaccounts/{serviceAccountId} | - - - -# **createSecretKey** -> SecretKeyResponse createSecretKey(serviceAccountId, secretKeyCreateBody) - - - -Create a secret key for the specified service account. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ServiceAccountApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ServiceAccountApi apiInstance = new ServiceAccountApi(); -String serviceAccountId = "serviceAccountId_example"; // String | Identifies the service account. -SecretKeyCreate secretKeyCreateBody = new SecretKeyCreate(); // SecretKeyCreate | Body for a createSecretKey request. -try { - SecretKeyResponse result = apiInstance.createSecretKey(serviceAccountId, secretKeyCreateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling ServiceAccountApi#createSecretKey"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **serviceAccountId** | **String**| Identifies the service account. | - **secretKeyCreateBody** | [**SecretKeyCreate**](SecretKeyCreate.md)| Body for a createSecretKey request. | - -### Return type - -[**SecretKeyResponse**](SecretKeyResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **createServiceAccount** -> ServiceAccountResponse createServiceAccount(serviceAccountCreateBody) - - - -Create a new service account. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ServiceAccountApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ServiceAccountApi apiInstance = new ServiceAccountApi(); -ServiceAccountCreate serviceAccountCreateBody = new ServiceAccountCreate(); // ServiceAccountCreate | Body for a createServiceAccount request. -try { - ServiceAccountResponse result = apiInstance.createServiceAccount(serviceAccountCreateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling ServiceAccountApi#createServiceAccount"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **serviceAccountCreateBody** | [**ServiceAccountCreate**](ServiceAccountCreate.md)| Body for a createServiceAccount request. | - -### Return type - -[**ServiceAccountResponse**](ServiceAccountResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **deleteSecretKey** -> deleteSecretKey(serviceAccountId, keyId) - - - -Delete the specified service account secret key. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ServiceAccountApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ServiceAccountApi apiInstance = new ServiceAccountApi(); -String serviceAccountId = "serviceAccountId_example"; // String | Identifies the service account. -String keyId = "keyId_example"; // String | Identifies the secret key. -try { - apiInstance.deleteSecretKey(serviceAccountId, keyId); -} catch (ApiException e) { - System.err.println("Exception when calling ServiceAccountApi#deleteSecretKey"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **serviceAccountId** | **String**| Identifies the service account. | - **keyId** | **String**| Identifies the secret key. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **deleteServiceAccount** -> deleteServiceAccount(serviceAccountId) - - - -Delete the specified service account. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ServiceAccountApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ServiceAccountApi apiInstance = new ServiceAccountApi(); -String serviceAccountId = "serviceAccountId_example"; // String | Identifies the service account. -try { - apiInstance.deleteServiceAccount(serviceAccountId); -} catch (ApiException e) { - System.err.println("Exception when calling ServiceAccountApi#deleteServiceAccount"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **serviceAccountId** | **String**| Identifies the service account. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getJwt** -> JwtResponse getJwt(serviceAccountId, keyId) - - - -Get an account-scoped JWT for the specified service account secret key. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ServiceAccountApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ServiceAccountApi apiInstance = new ServiceAccountApi(); -String serviceAccountId = "serviceAccountId_example"; // String | Identifies the service account. -String keyId = "keyId_example"; // String | Identifies the secret key. -try { - JwtResponse result = apiInstance.getJwt(serviceAccountId, keyId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling ServiceAccountApi#getJwt"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **serviceAccountId** | **String**| Identifies the service account. | - **keyId** | **String**| Identifies the secret key. | - -### Return type - -[**JwtResponse**](JwtResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getSecretKey** -> SecretKeyResponse getSecretKey(serviceAccountId, keyId) - - - -Get the specified service account secret key. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ServiceAccountApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ServiceAccountApi apiInstance = new ServiceAccountApi(); -String serviceAccountId = "serviceAccountId_example"; // String | Identifies the service account. -String keyId = "keyId_example"; // String | Identifies the secret key. -try { - SecretKeyResponse result = apiInstance.getSecretKey(serviceAccountId, keyId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling ServiceAccountApi#getSecretKey"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **serviceAccountId** | **String**| Identifies the service account. | - **keyId** | **String**| Identifies the secret key. | - -### Return type - -[**SecretKeyResponse**](SecretKeyResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getServiceAccount** -> ServiceAccountResponse getServiceAccount(serviceAccountId) - - - -Get the specified service account. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ServiceAccountApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ServiceAccountApi apiInstance = new ServiceAccountApi(); -String serviceAccountId = "serviceAccountId_example"; // String | Identifies the service account. -try { - ServiceAccountResponse result = apiInstance.getServiceAccount(serviceAccountId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling ServiceAccountApi#getServiceAccount"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **serviceAccountId** | **String**| Identifies the service account. | - -### Return type - -[**ServiceAccountResponse**](ServiceAccountResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **listSecretKeys** -> ListSecretKeysResponse listSecretKeys(serviceAccountId) - - - -List the secret keys for the specified service account. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ServiceAccountApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ServiceAccountApi apiInstance = new ServiceAccountApi(); -String serviceAccountId = "serviceAccountId_example"; // String | Identifies the service account. -try { - ListSecretKeysResponse result = apiInstance.listSecretKeys(serviceAccountId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling ServiceAccountApi#listSecretKeys"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **serviceAccountId** | **String**| Identifies the service account. | - -### Return type - -[**ListSecretKeysResponse**](ListSecretKeysResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **listServiceAccounts** -> ListServiceAccountsResponse listServiceAccounts(limit, offset) - - - -List all service accounts configured. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ServiceAccountApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ServiceAccountApi apiInstance = new ServiceAccountApi(); -Integer limit = 25; // Integer | The number of records to return. -Integer offset = 0; // Integer | The number of initial records to skip before picking records to return. -try { - ListServiceAccountsResponse result = apiInstance.listServiceAccounts(limit, offset); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling ServiceAccountApi#listServiceAccounts"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **Integer**| The number of records to return. | [optional] [default to 25] - **offset** | **Integer**| The number of initial records to skip before picking records to return. | [optional] [default to 0] - -### Return type - -[**ListServiceAccountsResponse**](ListServiceAccountsResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **updateServiceAccount** -> ServiceAccountResponse updateServiceAccount(serviceAccountId, serviceAccountUpdateBody) - - - -Update the specified service account. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.ServiceAccountApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -ServiceAccountApi apiInstance = new ServiceAccountApi(); -String serviceAccountId = "serviceAccountId_example"; // String | Identifies the service account. -ServiceAccountUpdate serviceAccountUpdateBody = new ServiceAccountUpdate(); // ServiceAccountUpdate | Body for an updateServiceAccount request. -try { - ServiceAccountResponse result = apiInstance.updateServiceAccount(serviceAccountId, serviceAccountUpdateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling ServiceAccountApi#updateServiceAccount"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **serviceAccountId** | **String**| Identifies the service account. | - **serviceAccountUpdateBody** | [**ServiceAccountUpdate**](ServiceAccountUpdate.md)| Body for an updateServiceAccount request. | - -### Return type - -[**ServiceAccountResponse**](ServiceAccountResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - diff --git a/docs/ServiceAccountCreate.md b/docs/ServiceAccountCreate.md deleted file mode 100644 index 03b5e944..00000000 --- a/docs/ServiceAccountCreate.md +++ /dev/null @@ -1,10 +0,0 @@ - -# ServiceAccountCreate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **String** | The service account's name. | - - - diff --git a/docs/ServiceAccountResponse.md b/docs/ServiceAccountResponse.md deleted file mode 100644 index ceba1be3..00000000 --- a/docs/ServiceAccountResponse.md +++ /dev/null @@ -1,10 +0,0 @@ - -# ServiceAccountResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**serviceAccount** | [**ServiceAccount**](ServiceAccount.md) | The service account. | [optional] - - - diff --git a/docs/ServiceAccountUpdate.md b/docs/ServiceAccountUpdate.md deleted file mode 100644 index 1f537d67..00000000 --- a/docs/ServiceAccountUpdate.md +++ /dev/null @@ -1,10 +0,0 @@ - -# ServiceAccountUpdate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **String** | The service account's name. | - - - diff --git a/docs/Source.md b/docs/Source.md index 80de9738..a0321aa2 100644 --- a/docs/Source.md +++ b/docs/Source.md @@ -1,13 +1,18 @@ + # Source +The source of the message. ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **String** | An identifier used by Smooch for internal purposes. | [optional] -**type** | **String** | An identifier for the channel from which a message originated. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values. | [optional] +**type** | **String** | An identifier for the channel from which a message originated. May include one of api, sdk, messenger, or any number of other channels. | +**integrationId** | **String** | Identifier indicating which integration the message was sent from. For user messages only. | [optional] **originalMessageId** | **String** | Message identifier assigned by the originating channel. | [optional] -**originalMessageTimestamp** | **Double** | Message timestamp assigned by the originating channel. | [optional] +**originalMessageTimestamp** | **String** | A datetime string with the format `YYYY-MM-DDThh:mm:ss.SSSZ` representing when the third party channel received the message. | [optional] +**client** | [**Client**](Client.md) | The client from which the user authored the message or activity, if applicable. This field is not applicable in API responses, it is used only in webhook payloads if the `includeFullSource` option is enabled. | [optional] +**device** | [**Device**](Device.md) | The device from which the user authored the message or activity, if applicable. This field is not applicable in API responses, it is used only in webhook payloads if the `includeFullSource` option is enabled. | [optional] diff --git a/docs/SourceWebhook.md b/docs/SourceWebhook.md new file mode 100644 index 00000000..d520eab0 --- /dev/null +++ b/docs/SourceWebhook.md @@ -0,0 +1,17 @@ + + +# SourceWebhook + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | An identifier for the channel from which a message originated. May include one of api, sdk, messenger, or any number of other channels. | [optional] +**integrationId** | **String** | Identifier indicating which integration the message was sent from. For user messages only. | [optional] +**originalMessageId** | **String** | Message identifier assigned by the originating channel. | [optional] +**originalMessageTimestamp** | **String** | A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing when the third-party channel received the message. | [optional] +**client** | [**Client**](Client.md) | The client from which the user authored the message or activity, if applicable. This field will only be present if the `includeFullSource` option is enabled for the webhook. | [optional] +**device** | [**Device**](Device.md) | The device from which the user authored the message or activity, if applicable. This field will only be present if the `includeFullSource` option is enabled for the webhook | [optional] + + + diff --git a/docs/Status.md b/docs/Status.md new file mode 100644 index 00000000..ba0f8ce1 --- /dev/null +++ b/docs/Status.md @@ -0,0 +1,15 @@ + + +# Status + +## Enum + + +* `INACTIVE` (value: `"inactive"`) + +* `ACTIVE` (value: `"active"`) + +* `ERROR` (value: `"error"`) + + + diff --git a/docs/SubMenuItem.md b/docs/SubMenuItem.md deleted file mode 100644 index d529a9a6..00000000 --- a/docs/SubMenuItem.md +++ /dev/null @@ -1,13 +0,0 @@ - -# SubMenuItem - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**text** | **String** | The button text of the menu item. | -**uri** | **String** | A valid address, like http://smooch.io. Required for a link type item. | [optional] -**type** | **String** | Can either be link, postback, which correspond to Smooch’s link and postback actions, or submenu for nested menus. See [**MenuItemTypeEnum**](Enums.md#MenuItemTypeEnum) for available values. | -**payload** | **String** | A payload for a postback. Required for a postback type item. | [optional] - - - diff --git a/docs/Switchboard.md b/docs/Switchboard.md new file mode 100644 index 00000000..2f8cc024 --- /dev/null +++ b/docs/Switchboard.md @@ -0,0 +1,14 @@ + + +# Switchboard + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the switchboard. | +**enabled** | **Boolean** | Whether the switchboard is enabled. Allows creating the switchboard in a disabled state so that messages don't get lost or misrouted during switchboard configuration. When a switchboard is disabled, integrations linked to the switchboard will receive all events. | +**defaultSwitchboardIntegrationId** | **String** | The id of the switchboard integration that will be given control when a new conversation begins. It will also be used for conversations that existed before the switchboard was enabled. | [optional] + + + diff --git a/docs/SwitchboardAcceptControl.md b/docs/SwitchboardAcceptControl.md new file mode 100644 index 00000000..5b292c00 --- /dev/null +++ b/docs/SwitchboardAcceptControl.md @@ -0,0 +1,15 @@ + + +# SwitchboardAcceptControl + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**payload** | [**SwitchboardAcceptControlAllOfPayload**](SwitchboardAcceptControlAllOfPayload.md) | | [optional] + + + diff --git a/docs/SwitchboardAcceptControlAllOf.md b/docs/SwitchboardAcceptControlAllOf.md new file mode 100644 index 00000000..029176a3 --- /dev/null +++ b/docs/SwitchboardAcceptControlAllOf.md @@ -0,0 +1,12 @@ + + +# SwitchboardAcceptControlAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payload** | [**SwitchboardAcceptControlAllOfPayload**](SwitchboardAcceptControlAllOfPayload.md) | | [optional] + + + diff --git a/docs/SwitchboardAcceptControlAllOfPayload.md b/docs/SwitchboardAcceptControlAllOfPayload.md new file mode 100644 index 00000000..65b0bbdf --- /dev/null +++ b/docs/SwitchboardAcceptControlAllOfPayload.md @@ -0,0 +1,14 @@ + + +# SwitchboardAcceptControlAllOfPayload + +The payload of the event. The contents of this object depend on the type of event. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conversation** | [**ConversationTruncated**](ConversationTruncated.md) | The conversation from which the switchboard event was fired. Will include an `activeSwitchboardIntegration` representing the integration that has just accepted control. | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] + + + diff --git a/docs/SwitchboardAcceptControlFailure.md b/docs/SwitchboardAcceptControlFailure.md new file mode 100644 index 00000000..b31a18b7 --- /dev/null +++ b/docs/SwitchboardAcceptControlFailure.md @@ -0,0 +1,15 @@ + + +# SwitchboardAcceptControlFailure + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**payload** | [**SwitchboardAcceptControlFailureAllOfPayload**](SwitchboardAcceptControlFailureAllOfPayload.md) | | [optional] + + + diff --git a/docs/SwitchboardAcceptControlFailureAllOf.md b/docs/SwitchboardAcceptControlFailureAllOf.md new file mode 100644 index 00000000..fdf762fe --- /dev/null +++ b/docs/SwitchboardAcceptControlFailureAllOf.md @@ -0,0 +1,12 @@ + + +# SwitchboardAcceptControlFailureAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payload** | [**SwitchboardAcceptControlFailureAllOfPayload**](SwitchboardAcceptControlFailureAllOfPayload.md) | | [optional] + + + diff --git a/docs/SwitchboardAcceptControlFailureAllOfPayload.md b/docs/SwitchboardAcceptControlFailureAllOfPayload.md new file mode 100644 index 00000000..9ed3b245 --- /dev/null +++ b/docs/SwitchboardAcceptControlFailureAllOfPayload.md @@ -0,0 +1,15 @@ + + +# SwitchboardAcceptControlFailureAllOfPayload + +The payload of the event. The contents of this object depend on the type of event. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | [**Object**](.md) | Object containing details of what went wrong. | [optional] +**conversation** | [**ConversationTruncated**](ConversationTruncated.md) | The conversation from which the switchboard event was fired. | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] + + + diff --git a/docs/SwitchboardActionsApi.md b/docs/SwitchboardActionsApi.md new file mode 100644 index 00000000..6314fd43 --- /dev/null +++ b/docs/SwitchboardActionsApi.md @@ -0,0 +1,255 @@ +# SwitchboardActionsApi + +All URIs are relative to *https://api.smooch.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**acceptControl**](SwitchboardActionsApi.md#acceptControl) | **POST** /v2/apps/{appId}/conversations/{conversationId}/acceptControl | Accept Control +[**offerControl**](SwitchboardActionsApi.md#offerControl) | **POST** /v2/apps/{appId}/conversations/{conversationId}/offerControl | Offer Control +[**passControl**](SwitchboardActionsApi.md#passControl) | **POST** /v2/apps/{appId}/conversations/{conversationId}/passControl | Pass Control + + + +## acceptControl + +> Object acceptControl(acceptControlBody, appId, conversationId) + +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. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.SwitchboardActionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + SwitchboardActionsApi apiInstance = new SwitchboardActionsApi(defaultClient); + AcceptControlBody acceptControlBody = new AcceptControlBody(); // AcceptControlBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation. + // Add required body parameters + + try { + Object result = apiInstance.acceptControl(acceptControlBody, appId, conversationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SwitchboardActionsApi#acceptControl"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **acceptControlBody** | [**AcceptControlBody**](AcceptControlBody.md)| | + **appId** | **String**| Identifies the app. | + **conversationId** | **String**| Identifies the conversation. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | + + +## offerControl + +> Object offerControl(offerControlBody, appId, conversationId) + +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. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.SwitchboardActionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + SwitchboardActionsApi apiInstance = new SwitchboardActionsApi(defaultClient); + OfferControlBody offerControlBody = new OfferControlBody(); // OfferControlBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation. + // Add required body parameters + + try { + Object result = apiInstance.offerControl(offerControlBody, appId, conversationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SwitchboardActionsApi#offerControl"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **offerControlBody** | [**OfferControlBody**](OfferControlBody.md)| | + **appId** | **String**| Identifies the app. | + **conversationId** | **String**| Identifies the conversation. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Not Found | - | + + +## passControl + +> Object passControl(passControlBody, appId, conversationId) + +Pass Control + +Mark the named switchboard integration as active and transition all the other switchboard integrations to standby status. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.SwitchboardActionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + SwitchboardActionsApi apiInstance = new SwitchboardActionsApi(defaultClient); + PassControlBody passControlBody = new PassControlBody(); // PassControlBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String conversationId = "029c31f25a21b47effd7be90"; // String | Identifies the conversation. + // Add required body parameters + + try { + Object result = apiInstance.passControl(passControlBody, appId, conversationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SwitchboardActionsApi#passControl"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **passControlBody** | [**PassControlBody**](PassControlBody.md)| | + **appId** | **String**| Identifies the app. | + **conversationId** | **String**| Identifies the conversation. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Not Found | - | + diff --git a/docs/SwitchboardIntegration.md b/docs/SwitchboardIntegration.md new file mode 100644 index 00000000..cd83df2a --- /dev/null +++ b/docs/SwitchboardIntegration.md @@ -0,0 +1,18 @@ + + +# SwitchboardIntegration + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the switchboard integration. | +**name** | **String** | Identifier for use in control transfer protocols. Restricted to alphanumeric characters, `-` and `_`. | +**integrationId** | **String** | Id of the integration that should deliver events routed by the switchboard. | +**integrationType** | **String** | Type of integration that should deliver events routed by the switchboard. If referencing an OAuth integration, the clientId issued by Sunshine Conversations during the OAuth partnership process will be the value of integrationType. | +**deliverStandbyEvents** | **Boolean** | Setting to determine if webhooks should be sent when the switchboard integration is not in control of a conversation (standby status) | +**nextSwitchboardIntegrationId** | **String** | The switchboard integration id to which control of a conversation is passed / offered by default. | [optional] +**messageHistoryCount** | **Integer** | Number of messages to include in the message history context. | [optional] + + + diff --git a/docs/SwitchboardIntegrationCreateBody.md b/docs/SwitchboardIntegrationCreateBody.md new file mode 100644 index 00000000..5a5eefba --- /dev/null +++ b/docs/SwitchboardIntegrationCreateBody.md @@ -0,0 +1,17 @@ + + +# SwitchboardIntegrationCreateBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Identifier for use in control transfer protocols. Restricted to alphanumeric characters, `-` and `_`. | +**integrationId** | **String** | The id of the integration to link to the switchboard integration. Must be used when linking a custom integration. One of `integrationId` or `integrationType` must be provided. | [optional] +**integrationType** | **String** | The type of the integration to link to the switchboard integration. Must be used when linking an OAuth integration. One of `integrationId` or `integrationType` must be provided. | [optional] +**deliverStandbyEvents** | **Boolean** | | [optional] +**nextSwitchboardIntegrationId** | **String** | | [optional] +**messageHistoryCount** | **Integer** | Number of messages to include in the message history context. | [optional] + + + diff --git a/docs/SwitchboardIntegrationListResponse.md b/docs/SwitchboardIntegrationListResponse.md new file mode 100644 index 00000000..532c2654 --- /dev/null +++ b/docs/SwitchboardIntegrationListResponse.md @@ -0,0 +1,12 @@ + + +# SwitchboardIntegrationListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**switchboardIntegrations** | [**List<SwitchboardIntegration>**](SwitchboardIntegration.md) | List of returned switchboard integrations. | [optional] + + + diff --git a/docs/SwitchboardIntegrationResponse.md b/docs/SwitchboardIntegrationResponse.md new file mode 100644 index 00000000..3e435baf --- /dev/null +++ b/docs/SwitchboardIntegrationResponse.md @@ -0,0 +1,12 @@ + + +# SwitchboardIntegrationResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**switchboardIntegration** | [**SwitchboardIntegration**](SwitchboardIntegration.md) | The switchboard integration. | [optional] + + + diff --git a/docs/SwitchboardIntegrationUpdateBody.md b/docs/SwitchboardIntegrationUpdateBody.md new file mode 100644 index 00000000..629e70ca --- /dev/null +++ b/docs/SwitchboardIntegrationUpdateBody.md @@ -0,0 +1,17 @@ + + +# SwitchboardIntegrationUpdateBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Identifier for use in control transfer protocols. Restricted to alphanumeric characters, `-` and `_`. | [optional] +**integrationId** | **String** | The id of the integration to link to the switchboard integration. Must be used when linking a custom integration. Can't provide both `integrationId` and `integrationType`. | [optional] +**integrationType** | **String** | The type of the integration to link to the switchboard integration. Must be used when linking an OAuth integration. Can't provide both `integrationId` and `integrationType`. | [optional] +**deliverStandbyEvents** | **Boolean** | Setting to determine if webhooks should be sent when the switchboard integration is not in control of a conversation (standby status) | [optional] +**nextSwitchboardIntegrationId** | **String** | | [optional] +**messageHistoryCount** | **Integer** | Number of messages to include in the message history context. | [optional] + + + diff --git a/docs/SwitchboardIntegrationWebhook.md b/docs/SwitchboardIntegrationWebhook.md new file mode 100644 index 00000000..c6b5f87d --- /dev/null +++ b/docs/SwitchboardIntegrationWebhook.md @@ -0,0 +1,15 @@ + + +# SwitchboardIntegrationWebhook + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the switchboard integration. | [optional] +**name** | **String** | Identifier for use in control transfer protocols. Restricted to alphanumeric characters, `-` and `_`. | [optional] +**integrationId** | **String** | Id of the integration that should deliver events routed by the switchboard. | [optional] +**integrationType** | **String** | Type of integration that should deliver events routed by the switchboard. If referencing an OAuth integration, the clientId issued by Sunshine Conversations during the OAuth partnership process will be the value of integrationType. | [optional] + + + diff --git a/docs/SwitchboardIntegrationsApi.md b/docs/SwitchboardIntegrationsApi.md new file mode 100644 index 00000000..475f0d80 --- /dev/null +++ b/docs/SwitchboardIntegrationsApi.md @@ -0,0 +1,337 @@ +# SwitchboardIntegrationsApi + +All URIs are relative to *https://api.smooch.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createSwitchboardIntegration**](SwitchboardIntegrationsApi.md#createSwitchboardIntegration) | **POST** /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations | Create Switchboard Integration +[**deleteSwitchboardIntegration**](SwitchboardIntegrationsApi.md#deleteSwitchboardIntegration) | **DELETE** /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations/{switchboardIntegrationId} | Delete Switchboard Integration +[**listSwitchboardIntegrations**](SwitchboardIntegrationsApi.md#listSwitchboardIntegrations) | **GET** /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations | List Switchboard Integrations +[**updateSwitchboardIntegration**](SwitchboardIntegrationsApi.md#updateSwitchboardIntegration) | **PATCH** /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations/{switchboardIntegrationId} | Update Switchboard Integration + + + +## createSwitchboardIntegration + +> SwitchboardIntegrationResponse createSwitchboardIntegration(switchboardIntegrationCreateBody, appId, switchboardId) + +Create Switchboard Integration + +Create a switchboard integration. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.SwitchboardIntegrationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + SwitchboardIntegrationsApi apiInstance = new SwitchboardIntegrationsApi(defaultClient); + SwitchboardIntegrationCreateBody switchboardIntegrationCreateBody = {"name":"bot","integrationType":"zd:agentWorkspace","deliverStandbyEvents":true,"nextSwitchboardIntegrationId":"5ef21b86e933b7355c11c606","messageHistoryCount":5}; // SwitchboardIntegrationCreateBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String switchboardId = "5d8cff3cd55b040010928b5b"; // String | Identifies the switchboard. + // Add required body parameters + + try { + SwitchboardIntegrationResponse result = apiInstance.createSwitchboardIntegration(switchboardIntegrationCreateBody, appId, switchboardId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SwitchboardIntegrationsApi#createSwitchboardIntegration"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **switchboardIntegrationCreateBody** | [**SwitchboardIntegrationCreateBody**](SwitchboardIntegrationCreateBody.md)| | + **appId** | **String**| Identifies the app. | + **switchboardId** | **String**| Identifies the switchboard. | + +### Return type + +[**SwitchboardIntegrationResponse**](SwitchboardIntegrationResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **400** | Only one switchboard per app can be created | - | +| **404** | Switchboard not found | - | + + +## deleteSwitchboardIntegration + +> Object deleteSwitchboardIntegration(appId, switchboardId, switchboardIntegrationId) + +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. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.SwitchboardIntegrationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + SwitchboardIntegrationsApi apiInstance = new SwitchboardIntegrationsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String switchboardId = "5d8cff3cd55b040010928b5b"; // String | Identifies the switchboard. + String switchboardIntegrationId = "5d8cff3cd55b040010928b5b"; // String | Identifies the switchboard integration. + // Add required body parameters + + try { + Object result = apiInstance.deleteSwitchboardIntegration(appId, switchboardId, switchboardIntegrationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SwitchboardIntegrationsApi#deleteSwitchboardIntegration"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **switchboardId** | **String**| Identifies the switchboard. | + **switchboardIntegrationId** | **String**| Identifies the switchboard integration. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Not Found | - | + + +## listSwitchboardIntegrations + +> SwitchboardIntegrationListResponse listSwitchboardIntegrations(appId, switchboardId) + +List Switchboard Integrations + +Lists all switchboard integrations linked to the switchboard. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.SwitchboardIntegrationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + SwitchboardIntegrationsApi apiInstance = new SwitchboardIntegrationsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String switchboardId = "5d8cff3cd55b040010928b5b"; // String | Identifies the switchboard. + // Add required body parameters + + try { + SwitchboardIntegrationListResponse result = apiInstance.listSwitchboardIntegrations(appId, switchboardId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SwitchboardIntegrationsApi#listSwitchboardIntegrations"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **switchboardId** | **String**| Identifies the switchboard. | + +### Return type + +[**SwitchboardIntegrationListResponse**](SwitchboardIntegrationListResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Switchboard not found | - | + + +## updateSwitchboardIntegration + +> SwitchboardIntegrationResponse updateSwitchboardIntegration(switchboardIntegrationUpdateBody, appId, switchboardId, switchboardIntegrationId) + +Update Switchboard Integration + +Updates a switchboard integration record. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.SwitchboardIntegrationsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + SwitchboardIntegrationsApi apiInstance = new SwitchboardIntegrationsApi(defaultClient); + SwitchboardIntegrationUpdateBody switchboardIntegrationUpdateBody = {"name":"bot","integrationType":"zd:agentWorkspace","deliverStandbyEvents":true,"nextSwitchboardIntegrationId":"5ef21b86e933b7355c11c606","messageHistoryCount":5}; // SwitchboardIntegrationUpdateBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String switchboardId = "5d8cff3cd55b040010928b5b"; // String | Identifies the switchboard. + String switchboardIntegrationId = "5d8cff3cd55b040010928b5b"; // String | Identifies the switchboard integration. + // Add required body parameters + + try { + SwitchboardIntegrationResponse result = apiInstance.updateSwitchboardIntegration(switchboardIntegrationUpdateBody, appId, switchboardId, switchboardIntegrationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SwitchboardIntegrationsApi#updateSwitchboardIntegration"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **switchboardIntegrationUpdateBody** | [**SwitchboardIntegrationUpdateBody**](SwitchboardIntegrationUpdateBody.md)| | + **appId** | **String**| Identifies the app. | + **switchboardId** | **String**| Identifies the switchboard. | + **switchboardIntegrationId** | **String**| Identifies the switchboard integration. | + +### Return type + +[**SwitchboardIntegrationResponse**](SwitchboardIntegrationResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Enabled switchboard must have an associated default switchboardIntegration | - | + diff --git a/docs/SwitchboardListResponse.md b/docs/SwitchboardListResponse.md new file mode 100644 index 00000000..53f47b10 --- /dev/null +++ b/docs/SwitchboardListResponse.md @@ -0,0 +1,12 @@ + + +# SwitchboardListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**switchboards** | [**List<Switchboard>**](Switchboard.md) | List of returned switchboards. | [optional] + + + diff --git a/docs/SwitchboardOfferControl.md b/docs/SwitchboardOfferControl.md new file mode 100644 index 00000000..d3a3ae60 --- /dev/null +++ b/docs/SwitchboardOfferControl.md @@ -0,0 +1,15 @@ + + +# SwitchboardOfferControl + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**payload** | [**SwitchboardOfferControlAllOfPayload**](SwitchboardOfferControlAllOfPayload.md) | | [optional] + + + diff --git a/docs/SwitchboardOfferControlAllOf.md b/docs/SwitchboardOfferControlAllOf.md new file mode 100644 index 00000000..df6597b9 --- /dev/null +++ b/docs/SwitchboardOfferControlAllOf.md @@ -0,0 +1,12 @@ + + +# SwitchboardOfferControlAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payload** | [**SwitchboardOfferControlAllOfPayload**](SwitchboardOfferControlAllOfPayload.md) | | [optional] + + + diff --git a/docs/SwitchboardOfferControlAllOfPayload.md b/docs/SwitchboardOfferControlAllOfPayload.md new file mode 100644 index 00000000..45eff2a1 --- /dev/null +++ b/docs/SwitchboardOfferControlAllOfPayload.md @@ -0,0 +1,14 @@ + + +# SwitchboardOfferControlAllOfPayload + +The payload of the event. The contents of this object depend on the type of event. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conversation** | [**ConversationTruncated**](ConversationTruncated.md) | The conversation from which the switchboard event was fired. On success, the payload will include an `activeSwitchboardIntegration`, representing the integration from which control is being offered, and a `pendingSwitchboardIntegration`, representing the integration being offered control. | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] + + + diff --git a/docs/SwitchboardOfferControlFailure.md b/docs/SwitchboardOfferControlFailure.md new file mode 100644 index 00000000..8b8a3d5e --- /dev/null +++ b/docs/SwitchboardOfferControlFailure.md @@ -0,0 +1,15 @@ + + +# SwitchboardOfferControlFailure + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**payload** | [**SwitchboardAcceptControlFailureAllOfPayload**](SwitchboardAcceptControlFailureAllOfPayload.md) | | [optional] + + + diff --git a/docs/SwitchboardPassControl.md b/docs/SwitchboardPassControl.md new file mode 100644 index 00000000..b5314982 --- /dev/null +++ b/docs/SwitchboardPassControl.md @@ -0,0 +1,15 @@ + + +# SwitchboardPassControl + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**payload** | [**SwitchboardPassControlAllOfPayload**](SwitchboardPassControlAllOfPayload.md) | | [optional] + + + diff --git a/docs/SwitchboardPassControlAllOf.md b/docs/SwitchboardPassControlAllOf.md new file mode 100644 index 00000000..222d9503 --- /dev/null +++ b/docs/SwitchboardPassControlAllOf.md @@ -0,0 +1,12 @@ + + +# SwitchboardPassControlAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payload** | [**SwitchboardPassControlAllOfPayload**](SwitchboardPassControlAllOfPayload.md) | | [optional] + + + diff --git a/docs/SwitchboardPassControlAllOfPayload.md b/docs/SwitchboardPassControlAllOfPayload.md new file mode 100644 index 00000000..bd62756e --- /dev/null +++ b/docs/SwitchboardPassControlAllOfPayload.md @@ -0,0 +1,14 @@ + + +# SwitchboardPassControlAllOfPayload + +The payload of the event. The contents of this object depend on the type of event. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conversation** | [**ConversationTruncated**](ConversationTruncated.md) | The conversation from which the switchboard event was fired. On success, the payload will include an `activeSwitchboardIntegration`, representing the switchboard integration that is now in control of the conversation. | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] + + + diff --git a/docs/SwitchboardPassControlFailure.md b/docs/SwitchboardPassControlFailure.md new file mode 100644 index 00000000..f7b1e074 --- /dev/null +++ b/docs/SwitchboardPassControlFailure.md @@ -0,0 +1,15 @@ + + +# SwitchboardPassControlFailure + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**payload** | [**SwitchboardAcceptControlFailureAllOfPayload**](SwitchboardAcceptControlFailureAllOfPayload.md) | | [optional] + + + diff --git a/docs/SwitchboardResponse.md b/docs/SwitchboardResponse.md new file mode 100644 index 00000000..761b5591 --- /dev/null +++ b/docs/SwitchboardResponse.md @@ -0,0 +1,12 @@ + + +# SwitchboardResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**switchboard** | [**Switchboard**](Switchboard.md) | The switchboard. | [optional] + + + diff --git a/docs/SwitchboardUpdateBody.md b/docs/SwitchboardUpdateBody.md new file mode 100644 index 00000000..d5de1c87 --- /dev/null +++ b/docs/SwitchboardUpdateBody.md @@ -0,0 +1,13 @@ + + +# SwitchboardUpdateBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enabled** | **Boolean** | Whether the switchboard is enabled. Allows creating the switchboard in a disabled state so that messages don't get lost or misrouted during switchboard configuration. When a switchboard is disabled, integrations linked to the switchboard will receive all events. | [optional] +**defaultSwitchboardIntegrationId** | **String** | The id of the switchboard integration that will be given control when a new conversation begins. It will also be used for conversations that existed before the switchboard was enabled. | [optional] + + + diff --git a/docs/SwitchboardsApi.md b/docs/SwitchboardsApi.md new file mode 100644 index 00000000..b03132f0 --- /dev/null +++ b/docs/SwitchboardsApi.md @@ -0,0 +1,326 @@ +# SwitchboardsApi + +All URIs are relative to *https://api.smooch.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createSwitchboard**](SwitchboardsApi.md#createSwitchboard) | **POST** /v2/apps/{appId}/switchboards | Create Switchboard +[**deleteSwitchboard**](SwitchboardsApi.md#deleteSwitchboard) | **DELETE** /v2/apps/{appId}/switchboards/{switchboardId} | Delete Switchboard +[**listSwitchboards**](SwitchboardsApi.md#listSwitchboards) | **GET** /v2/apps/{appId}/switchboards | List Switchboards +[**updateSwitchboard**](SwitchboardsApi.md#updateSwitchboard) | **PATCH** /v2/apps/{appId}/switchboards/{switchboardId} | Update Switchboard + + + +## createSwitchboard + +> SwitchboardResponse createSwitchboard(appId) + +Create Switchboard + +Create a switchboard. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.SwitchboardsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + SwitchboardsApi apiInstance = new SwitchboardsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + // Add required body parameters + + try { + SwitchboardResponse result = apiInstance.createSwitchboard(appId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SwitchboardsApi#createSwitchboard"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + +### Return type + +[**SwitchboardResponse**](SwitchboardResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **404** | Not Found | - | + + +## deleteSwitchboard + +> Object deleteSwitchboard(appId, switchboardId) + +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. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.SwitchboardsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + SwitchboardsApi apiInstance = new SwitchboardsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String switchboardId = "5d8cff3cd55b040010928b5b"; // String | Identifies the switchboard. + // Add required body parameters + + try { + Object result = apiInstance.deleteSwitchboard(appId, switchboardId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SwitchboardsApi#deleteSwitchboard"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **switchboardId** | **String**| Identifies the switchboard. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Not Found | - | + + +## listSwitchboards + +> SwitchboardListResponse listSwitchboards(appId) + +List Switchboards + +Lists all switchboards belonging to the app. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.SwitchboardsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + SwitchboardsApi apiInstance = new SwitchboardsApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + // Add required body parameters + + try { + SwitchboardListResponse result = apiInstance.listSwitchboards(appId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SwitchboardsApi#listSwitchboards"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + +### Return type + +[**SwitchboardListResponse**](SwitchboardListResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Not Found | - | + + +## updateSwitchboard + +> SwitchboardResponse updateSwitchboard(switchboardUpdateBody, appId, switchboardId) + +Update Switchboard + +Updates a switchboard record. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.SwitchboardsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + SwitchboardsApi apiInstance = new SwitchboardsApi(defaultClient); + SwitchboardUpdateBody switchboardUpdateBody = new SwitchboardUpdateBody(); // SwitchboardUpdateBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String switchboardId = "5d8cff3cd55b040010928b5b"; // String | Identifies the switchboard. + // Add required body parameters + + try { + SwitchboardResponse result = apiInstance.updateSwitchboard(switchboardUpdateBody, appId, switchboardId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SwitchboardsApi#updateSwitchboard"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **switchboardUpdateBody** | [**SwitchboardUpdateBody**](SwitchboardUpdateBody.md)| | + **appId** | **String**| Identifies the app. | + **switchboardId** | **String**| Identifies the switchboard. | + +### Return type + +[**SwitchboardResponse**](SwitchboardResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Not Found | - | + diff --git a/docs/Target.md b/docs/Target.md new file mode 100644 index 00000000..3a89f89a --- /dev/null +++ b/docs/Target.md @@ -0,0 +1,13 @@ + + +# Target + +The target conversation to attach the client to. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conversationId** | **String** | The conversation ID of the target conversation. | + + + diff --git a/docs/Telegram.md b/docs/Telegram.md new file mode 100644 index 00000000..3f56f77a --- /dev/null +++ b/docs/Telegram.md @@ -0,0 +1,15 @@ + + +# Telegram + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**token** | **String** | Telegram Bot Token. | +**username** | **String** | Username of the botId | [optional] [readonly] +**botId** | **String** | A human-friendly name used to identify the integration. | [optional] [readonly] + + + diff --git a/docs/TelegramAllOf.md b/docs/TelegramAllOf.md new file mode 100644 index 00000000..c3330bf4 --- /dev/null +++ b/docs/TelegramAllOf.md @@ -0,0 +1,16 @@ + + +# TelegramAllOf + +To configure a Telegram integration, acquire the required information from the user and call the Create Integration endpoint. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**token** | **String** | Telegram Bot Token. | +**username** | **String** | Username of the botId | [optional] [readonly] +**botId** | **String** | A human-friendly name used to identify the integration. | [optional] [readonly] + + + diff --git a/docs/TelegramUpdate.md b/docs/TelegramUpdate.md new file mode 100644 index 00000000..df9ab59f --- /dev/null +++ b/docs/TelegramUpdate.md @@ -0,0 +1,15 @@ + + +# TelegramUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + +## Implemented Interfaces + +* IntegrationUpdate + + diff --git a/docs/Template.md b/docs/Template.md deleted file mode 100644 index fa490575..00000000 --- a/docs/Template.md +++ /dev/null @@ -1,12 +0,0 @@ - -# Template - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **String** | The template ID, generated automatically. | -**name** | **String** | The name for the template, used when sending via [shorthand](https://docs.smooch.io/guide/shorthand/#sending-template-message-with-inline-syntax). | -**message** | [**Message**](Message.md) | The message sent when referencing the template via syntax. | - - - diff --git a/docs/TemplateApi.md b/docs/TemplateApi.md deleted file mode 100644 index ca699349..00000000 --- a/docs/TemplateApi.md +++ /dev/null @@ -1,341 +0,0 @@ -# TemplateApi - -All URIs are relative to *https://api.smooch.io* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createTemplate**](TemplateApi.md#createTemplate) | **POST** /v1.1/apps/{appId}/templates | -[**deleteTemplate**](TemplateApi.md#deleteTemplate) | **DELETE** /v1.1/apps/{appId}/templates/{templateId} | -[**getTemplate**](TemplateApi.md#getTemplate) | **GET** /v1.1/apps/{appId}/templates/{templateId} | -[**listTemplates**](TemplateApi.md#listTemplates) | **GET** /v1.1/apps/{appId}/templates | -[**updateTemplate**](TemplateApi.md#updateTemplate) | **PUT** /v1.1/apps/{appId}/templates/{templateId} | - - - -# **createTemplate** -> TemplateResponse createTemplate(appId, templateCreateBody) - - - -Create a template for the specified app. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.TemplateApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -TemplateApi apiInstance = new TemplateApi(); -String appId = "appId_example"; // String | Identifies the app. -TemplateCreate templateCreateBody = new TemplateCreate(); // TemplateCreate | Body for a createTemplate request. -try { - TemplateResponse result = apiInstance.createTemplate(appId, templateCreateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling TemplateApi#createTemplate"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **templateCreateBody** | [**TemplateCreate**](TemplateCreate.md)| Body for a createTemplate request. | - -### Return type - -[**TemplateResponse**](TemplateResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **deleteTemplate** -> deleteTemplate(appId, templateId) - - - -Delete the specified template. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.TemplateApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -TemplateApi apiInstance = new TemplateApi(); -String appId = "appId_example"; // String | Identifies the app. -String templateId = "templateId_example"; // String | Identifies the template. -try { - apiInstance.deleteTemplate(appId, templateId); -} catch (ApiException e) { - System.err.println("Exception when calling TemplateApi#deleteTemplate"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **templateId** | **String**| Identifies the template. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getTemplate** -> TemplateResponse getTemplate(appId, templateId) - - - -Get the specified template. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.TemplateApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -TemplateApi apiInstance = new TemplateApi(); -String appId = "appId_example"; // String | Identifies the app. -String templateId = "templateId_example"; // String | Identifies the template. -try { - TemplateResponse result = apiInstance.getTemplate(appId, templateId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling TemplateApi#getTemplate"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **templateId** | **String**| Identifies the template. | - -### Return type - -[**TemplateResponse**](TemplateResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **listTemplates** -> ListTemplatesResponse listTemplates(appId, limit, offset) - - - -List templates for the specified app. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.TemplateApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -TemplateApi apiInstance = new TemplateApi(); -String appId = "appId_example"; // String | Identifies the app. -Integer limit = 25; // Integer | The number of records to return. -Integer offset = 0; // Integer | The number of initial records to skip before picking records to return. -try { - ListTemplatesResponse result = apiInstance.listTemplates(appId, limit, offset); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling TemplateApi#listTemplates"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **limit** | **Integer**| The number of records to return. | [optional] [default to 25] - **offset** | **Integer**| The number of initial records to skip before picking records to return. | [optional] [default to 0] - -### Return type - -[**ListTemplatesResponse**](ListTemplatesResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **updateTemplate** -> TemplateResponse updateTemplate(appId, templateId, templateUpdateBody) - - - -Update the specified template. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.TemplateApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -TemplateApi apiInstance = new TemplateApi(); -String appId = "appId_example"; // String | Identifies the app. -String templateId = "templateId_example"; // String | Identifies the template. -TemplateUpdate templateUpdateBody = new TemplateUpdate(); // TemplateUpdate | Body for an updateTemplate request. -try { - TemplateResponse result = apiInstance.updateTemplate(appId, templateId, templateUpdateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling TemplateApi#updateTemplate"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **templateId** | **String**| Identifies the template. | - **templateUpdateBody** | [**TemplateUpdate**](TemplateUpdate.md)| Body for an updateTemplate request. | - -### Return type - -[**TemplateResponse**](TemplateResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - diff --git a/docs/TemplateCreate.md b/docs/TemplateCreate.md deleted file mode 100644 index 606bc4b6..00000000 --- a/docs/TemplateCreate.md +++ /dev/null @@ -1,11 +0,0 @@ - -# TemplateCreate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **String** | The name for the template, used when sending via [shorthand](https://docs.smooch.io/guide/shorthand/#sending-template-message-with-inline-syntax). | -**message** | [**Message**](Message.md) | The message sent when referencing the template via syntax. | - - - diff --git a/docs/TemplateResponse.md b/docs/TemplateResponse.md deleted file mode 100644 index 2172977f..00000000 --- a/docs/TemplateResponse.md +++ /dev/null @@ -1,10 +0,0 @@ - -# TemplateResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**template** | [**Template**](Template.md) | The template. | - - - diff --git a/docs/TemplateUpdate.md b/docs/TemplateUpdate.md deleted file mode 100644 index 3f726532..00000000 --- a/docs/TemplateUpdate.md +++ /dev/null @@ -1,11 +0,0 @@ - -# TemplateUpdate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **String** | The name for the template, used when sending via [shorthand](https://docs.smooch.io/guide/shorthand/#sending-template-message-with-inline-syntax). | [optional] -**message** | [**Message**](Message.md) | The message sent when referencing the template via syntax. | [optional] - - - diff --git a/docs/TextMessage.md b/docs/TextMessage.md new file mode 100644 index 00000000..3b70e702 --- /dev/null +++ b/docs/TextMessage.md @@ -0,0 +1,18 @@ + + +# TextMessage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of message. | +**text** | **String** | The text content of the message. Optional only if actions are provided. | [optional] +**actions** | [**List<Action>**](Action.md) | Array of message actions. | [optional] + + +## Implemented Interfaces + +* Content + + diff --git a/docs/Twilio.md b/docs/Twilio.md new file mode 100644 index 00000000..f8c652fb --- /dev/null +++ b/docs/Twilio.md @@ -0,0 +1,15 @@ + + +# Twilio + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**accountSid** | **String** | Twilio Account SID. | +**authToken** | **String** | Twilio Auth Token. | +**phoneNumberSid** | **String** | SID for specific phone number. | + + + diff --git a/docs/TwilioAllOf.md b/docs/TwilioAllOf.md new file mode 100644 index 00000000..a3967125 --- /dev/null +++ b/docs/TwilioAllOf.md @@ -0,0 +1,16 @@ + + +# TwilioAllOf + +To configure a Twilio integration, acquire the required information from the user and call the Create Integration endpoint. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**accountSid** | **String** | Twilio Account SID. | +**authToken** | **String** | Twilio Auth Token. | +**phoneNumberSid** | **String** | SID for specific phone number. | + + + diff --git a/docs/TwilioUpdate.md b/docs/TwilioUpdate.md new file mode 100644 index 00000000..16f1b48d --- /dev/null +++ b/docs/TwilioUpdate.md @@ -0,0 +1,15 @@ + + +# TwilioUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + +## Implemented Interfaces + +* IntegrationUpdate + + diff --git a/docs/Twitter.md b/docs/Twitter.md new file mode 100644 index 00000000..92139a62 --- /dev/null +++ b/docs/Twitter.md @@ -0,0 +1,28 @@ + + +# Twitter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**tier** | [**TierEnum**](#TierEnum) | Your Twitter app’s tier, sandbox, premium or enterprise. | +**envName** | **String** | The Twitter dev environments label (required for sandbox and premium tiers). | [optional] +**consumerKey** | **String** | The consumer key for your Twitter app. | +**consumerSecret** | **String** | The consumer key secret for your Twitter app. | +**accessTokenKey** | **String** | The access token key obtained from your user via oauth. | [optional] +**accessTokenSecret** | **String** | The access token secret obtained from your user via oauth. | + + + +## Enum: TierEnum + +Name | Value +---- | ----- +SANDBOX | "sandbox" +PREMIUM | "premium" +ENTERPRISE | "enterprise" + + + diff --git a/docs/TwitterAllOf.md b/docs/TwitterAllOf.md new file mode 100644 index 00000000..3b62eedb --- /dev/null +++ b/docs/TwitterAllOf.md @@ -0,0 +1,29 @@ + + +# TwitterAllOf + +To set up a Twitter integration, please follow the steps outlined in the [Twitter Setup Guide](https://docs.smooch.io/guide/twitter/#setup). +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**tier** | [**TierEnum**](#TierEnum) | Your Twitter app’s tier, sandbox, premium or enterprise. | +**envName** | **String** | The Twitter dev environments label (required for sandbox and premium tiers). | [optional] +**consumerKey** | **String** | The consumer key for your Twitter app. | +**consumerSecret** | **String** | The consumer key secret for your Twitter app. | +**accessTokenKey** | **String** | The access token key obtained from your user via oauth. | [optional] +**accessTokenSecret** | **String** | The access token secret obtained from your user via oauth. | + + + +## Enum: TierEnum + +Name | Value +---- | ----- +SANDBOX | "sandbox" +PREMIUM | "premium" +ENTERPRISE | "enterprise" + + + diff --git a/docs/TwitterUpdate.md b/docs/TwitterUpdate.md new file mode 100644 index 00000000..513bec53 --- /dev/null +++ b/docs/TwitterUpdate.md @@ -0,0 +1,15 @@ + + +# TwitterUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + +## Implemented Interfaces + +* IntegrationUpdate + + diff --git a/docs/UploadIntegrationProfilePhotoResponse.md b/docs/UploadIntegrationProfilePhotoResponse.md deleted file mode 100644 index 3f9f7550..00000000 --- a/docs/UploadIntegrationProfilePhotoResponse.md +++ /dev/null @@ -1,10 +0,0 @@ - -# UploadIntegrationProfilePhotoResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**photoUrl** | **String** | The photo URL after uploading. | - - - diff --git a/docs/User.md b/docs/User.md new file mode 100644 index 00000000..18d28823 --- /dev/null +++ b/docs/User.md @@ -0,0 +1,16 @@ + + +# User + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the user. | [optional] +**externalId** | **String** | An optional ID that if specified can also be used to retrieve the user. | [optional] +**signedUpAt** | **String** | | [optional] +**profile** | [**Profile**](Profile.md) | | [optional] +**metadata** | **Object** | | [optional] + + + diff --git a/docs/UserAllOf.md b/docs/UserAllOf.md new file mode 100644 index 00000000..24db89cc --- /dev/null +++ b/docs/UserAllOf.md @@ -0,0 +1,14 @@ + + +# UserAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**signedUpAt** | **String** | | [optional] +**profile** | [**Profile**](Profile.md) | | [optional] +**metadata** | **Object** | | [optional] + + + diff --git a/docs/UserCreateBody.md b/docs/UserCreateBody.md new file mode 100644 index 00000000..758d5b6c --- /dev/null +++ b/docs/UserCreateBody.md @@ -0,0 +1,15 @@ + + +# UserCreateBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**externalId** | **String** | A unique identifier for the user. The `externalId` can be used to link a user to the same conversation [across multiple devices](https://docs.smooch.io/guide/authenticating-users/). | +**signedUpAt** | **String** | The date at which the user signed up. Must be ISO 8601 time format `YYYY-MM-DDThh:mm:ss.sssZ`. | [optional] +**profile** | [**Profile**](Profile.md) | | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] + + + diff --git a/docs/UserMergeEvent.md b/docs/UserMergeEvent.md new file mode 100644 index 00000000..de777400 --- /dev/null +++ b/docs/UserMergeEvent.md @@ -0,0 +1,15 @@ + + +# UserMergeEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. | [optional] +**type** | **String** | The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). | [optional] +**createdAt** | **String** | A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. | [optional] +**payload** | [**UserMergeEventAllOfPayload**](UserMergeEventAllOfPayload.md) | | [optional] + + + diff --git a/docs/UserMergeEventAllOf.md b/docs/UserMergeEventAllOf.md new file mode 100644 index 00000000..725cce7f --- /dev/null +++ b/docs/UserMergeEventAllOf.md @@ -0,0 +1,12 @@ + + +# UserMergeEventAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payload** | [**UserMergeEventAllOfPayload**](UserMergeEventAllOfPayload.md) | | [optional] + + + diff --git a/docs/UserMergeEventAllOfPayload.md b/docs/UserMergeEventAllOfPayload.md new file mode 100644 index 00000000..a41104cb --- /dev/null +++ b/docs/UserMergeEventAllOfPayload.md @@ -0,0 +1,15 @@ + + +# UserMergeEventAllOfPayload + +The payload of the event. The contents of this object depend on the type of event. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mergedUsers** | [**UserMergeEventAllOfPayloadMergedUsers**](UserMergeEventAllOfPayloadMergedUsers.md) | | [optional] +**mergedConversations** | [**UserMergeEventAllOfPayloadMergedConversations**](UserMergeEventAllOfPayloadMergedConversations.md) | | [optional] +**discardedMetadata** | **Object** | A flat object with the set of metadata properties that were discarded when merging the two users. This should contain values only if the combined metadata fields exceed the 4KB limit. | [optional] + + + diff --git a/docs/UserMergeEventAllOfPayloadMergedConversations.md b/docs/UserMergeEventAllOfPayloadMergedConversations.md new file mode 100644 index 00000000..7b3f3ed3 --- /dev/null +++ b/docs/UserMergeEventAllOfPayloadMergedConversations.md @@ -0,0 +1,14 @@ + + +# UserMergeEventAllOfPayloadMergedConversations + +Contains information about the conversations that were merged together as a result of the operation, if applicable. If no conversations were merged, this property is omitted. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**surviving** | [**ConversationTruncated**](ConversationTruncated.md) | The conversation that now represents the merged conversation object. | [optional] +**discarded** | [**ConversationTruncated**](ConversationTruncated.md) | The conversation that was unified into the surviving conversation object. | [optional] + + + diff --git a/docs/UserMergeEventAllOfPayloadMergedUsers.md b/docs/UserMergeEventAllOfPayloadMergedUsers.md new file mode 100644 index 00000000..6339635d --- /dev/null +++ b/docs/UserMergeEventAllOfPayloadMergedUsers.md @@ -0,0 +1,14 @@ + + +# UserMergeEventAllOfPayloadMergedUsers + +Contains information about the users that were merged together. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**surviving** | [**User**](User.md) | The user that now represents the merged user object. | [optional] +**discarded** | [**User**](User.md) | The user that was unified into the surviving user object. | [optional] + + + diff --git a/docs/UserResponse.md b/docs/UserResponse.md new file mode 100644 index 00000000..bb30db93 --- /dev/null +++ b/docs/UserResponse.md @@ -0,0 +1,12 @@ + + +# UserResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user** | [**User**](User.md) | The user. | [optional] + + + diff --git a/docs/UserTruncated.md b/docs/UserTruncated.md new file mode 100644 index 00000000..f070ae62 --- /dev/null +++ b/docs/UserTruncated.md @@ -0,0 +1,13 @@ + + +# UserTruncated + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the user. | [optional] +**externalId** | **String** | An optional ID that if specified can also be used to retrieve the user. | [optional] + + + diff --git a/docs/UserUpdateBody.md b/docs/UserUpdateBody.md new file mode 100644 index 00000000..829e5749 --- /dev/null +++ b/docs/UserUpdateBody.md @@ -0,0 +1,14 @@ + + +# UserUpdateBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**signedUpAt** | **String** | | [optional] +**profile** | [**Profile**](Profile.md) | | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] + + + diff --git a/docs/UsersApi.md b/docs/UsersApi.md new file mode 100644 index 00000000..6d64b034 --- /dev/null +++ b/docs/UsersApi.md @@ -0,0 +1,410 @@ +# UsersApi + +All URIs are relative to *https://api.smooch.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UsersApi.md#createUser) | **POST** /v2/apps/{appId}/users | Create User +[**deleteUser**](UsersApi.md#deleteUser) | **DELETE** /v2/apps/{appId}/users/{userIdOrExternalId} | Delete User +[**deleteUserPersonalInformation**](UsersApi.md#deleteUserPersonalInformation) | **DELETE** /v2/apps/{appId}/users/{userIdOrExternalId}/personalinformation | Delete User Personal Information +[**getUser**](UsersApi.md#getUser) | **GET** /v2/apps/{appId}/users/{userIdOrExternalId} | Get User +[**updateUser**](UsersApi.md#updateUser) | **PATCH** /v2/apps/{appId}/users/{userIdOrExternalId} | Update User + + + +## createUser + +> UserResponse createUser(userCreateBody, appId) + +Create User + +Creates a new user. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.UsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + UsersApi apiInstance = new UsersApi(defaultClient); + UserCreateBody userCreateBody = new UserCreateBody(); // UserCreateBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + // Add required body parameters + + try { + UserResponse result = apiInstance.createUser(userCreateBody, appId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsersApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **userCreateBody** | [**UserCreateBody**](UserCreateBody.md)| | + **appId** | **String**| Identifies the app. | + +### Return type + +[**UserResponse**](UserResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **409** | User already exists | - | + + +## deleteUser + +> Object deleteUser(appId, userIdOrExternalId) + +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). + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.UsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + UsersApi apiInstance = new UsersApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String userIdOrExternalId = "42589ad070d43be9b00ff7e5"; // String | The user's id or externalId. + // Add required body parameters + + try { + Object result = apiInstance.deleteUser(appId, userIdOrExternalId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsersApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **userIdOrExternalId** | **String**| The user's id or externalId. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | User not found | - | + + +## deleteUserPersonalInformation + +> UserResponse deleteUserPersonalInformation(appId, userIdOrExternalId) + +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). + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.UsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + UsersApi apiInstance = new UsersApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String userIdOrExternalId = "42589ad070d43be9b00ff7e5"; // String | The user's id or externalId. + // Add required body parameters + + try { + UserResponse result = apiInstance.deleteUserPersonalInformation(appId, userIdOrExternalId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsersApi#deleteUserPersonalInformation"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **userIdOrExternalId** | **String**| The user's id or externalId. | + +### Return type + +[**UserResponse**](UserResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | User not found | - | + + +## getUser + +> UserResponse getUser(appId, userIdOrExternalId) + +Get User + +Fetches an individual user. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.UsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + UsersApi apiInstance = new UsersApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String userIdOrExternalId = "42589ad070d43be9b00ff7e5"; // String | The user's id or externalId. + // Add required body parameters + + try { + UserResponse result = apiInstance.getUser(appId, userIdOrExternalId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsersApi#getUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **userIdOrExternalId** | **String**| The user's id or externalId. | + +### Return type + +[**UserResponse**](UserResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | User not found | - | + + +## updateUser + +> UserResponse updateUser(userUpdateBody, appId, userIdOrExternalId) + +Update User + +Updates a user. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.UsersApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + UsersApi apiInstance = new UsersApi(defaultClient); + UserUpdateBody userUpdateBody = new UserUpdateBody(); // UserUpdateBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String userIdOrExternalId = "42589ad070d43be9b00ff7e5"; // String | The user's id or externalId. + // Add required body parameters + + try { + UserResponse result = apiInstance.updateUser(userUpdateBody, appId, userIdOrExternalId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsersApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **userUpdateBody** | [**UserUpdateBody**](UserUpdateBody.md)| | + **appId** | **String**| Identifies the app. | + **userIdOrExternalId** | **String**| The user's id or externalId. | + +### Return type + +[**UserResponse**](UserResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | User not found | - | + diff --git a/docs/Viber.md b/docs/Viber.md new file mode 100644 index 00000000..845a61a4 --- /dev/null +++ b/docs/Viber.md @@ -0,0 +1,15 @@ + + +# Viber + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**token** | **String** | Viber Public Account token. | +**uri** | **String** | Unique URI of the Viber account. | [optional] [readonly] +**accountId** | **String** | Unique ID of the Viber account. | [optional] [readonly] + + + diff --git a/docs/ViberAllOf.md b/docs/ViberAllOf.md new file mode 100644 index 00000000..300c5654 --- /dev/null +++ b/docs/ViberAllOf.md @@ -0,0 +1,16 @@ + + +# ViberAllOf + +To configure a Viber integration, acquire the Viber Public Account token from the user and call the Create Integration endpoint. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**token** | **String** | Viber Public Account token. | +**uri** | **String** | Unique URI of the Viber account. | [optional] [readonly] +**accountId** | **String** | Unique ID of the Viber account. | [optional] [readonly] + + + diff --git a/docs/ViberUpdate.md b/docs/ViberUpdate.md new file mode 100644 index 00000000..d7f192c1 --- /dev/null +++ b/docs/ViberUpdate.md @@ -0,0 +1,15 @@ + + +# ViberUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + +## Implemented Interfaces + +* IntegrationUpdate + + diff --git a/docs/Web.md b/docs/Web.md new file mode 100644 index 00000000..39717838 --- /dev/null +++ b/docs/Web.md @@ -0,0 +1,27 @@ + + +# Web + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**brandColor** | **String** | This color will be used in the messenger header and the button or tab in idle state. Must be a 3 or 6-character hexadecimal color. | [optional] +**fixedIntroPane** | **Boolean** | When true, the introduction pane will be pinned at the top of the conversation instead of scrolling with it. | [optional] +**conversationColor** | **String** | This color will be used for customer messages, quick replies and actions in the footer. Must be a 3 or 6-character hexadecimal color. | [optional] +**actionColor** | **String** | This color will be used for call-to-actions inside your messages. Must be a 3 or 6-character hexadecimal color. | [optional] +**displayStyle** | **String** | Choose how the messenger will appear on your website. Must be either button or tab. | [optional] +**buttonIconUrl** | **String** | With the button style Web Messenger, you have the option of selecting your own button icon. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. | [optional] +**buttonWidth** | **String** | With the button style Web Messenger, you have the option of specifying the button width. | [optional] +**buttonHeight** | **String** | With the button style Web Messenger, you have the option of specifying the button height. | [optional] +**integrationOrder** | **List<String>** | Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed. | [optional] +**businessName** | **String** | A custom business name for the Web Messenger. | [optional] +**businessIconUrl** | **String** | A custom business icon url for the Web Messenger. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. | [optional] +**backgroundImageUrl** | **String** | A background image url for the conversation. Image will be tiled to fit the window. | [optional] +**originWhitelist** | **List<String>** | A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454: scheme \"://\" host [ \":\" port ], where scheme is http or https. | [optional] +**prechatCapture** | [**PrechatCapture**](PrechatCapture.md) | Object whose properties can be set to specify the add-on’s options. See the [guide](https://docs.smooch.io/guide/web-messenger/#prechat-capture) to learn more about Prechat Capture. | [optional] +**canUserCreateMoreConversations** | **Boolean** | Allows users to create more than one conversation on the web messenger integration. | [optional] + + + diff --git a/docs/WebAllOf.md b/docs/WebAllOf.md new file mode 100644 index 00000000..c76eeb2d --- /dev/null +++ b/docs/WebAllOf.md @@ -0,0 +1,28 @@ + + +# WebAllOf + +To configure a Web Messenger integration, acquire the required information and call the Create Integration endpoint. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**brandColor** | **String** | This color will be used in the messenger header and the button or tab in idle state. Must be a 3 or 6-character hexadecimal color. | [optional] +**fixedIntroPane** | **Boolean** | When true, the introduction pane will be pinned at the top of the conversation instead of scrolling with it. | [optional] +**conversationColor** | **String** | This color will be used for customer messages, quick replies and actions in the footer. Must be a 3 or 6-character hexadecimal color. | [optional] +**actionColor** | **String** | This color will be used for call-to-actions inside your messages. Must be a 3 or 6-character hexadecimal color. | [optional] +**displayStyle** | **String** | Choose how the messenger will appear on your website. Must be either button or tab. | [optional] +**buttonIconUrl** | **String** | With the button style Web Messenger, you have the option of selecting your own button icon. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. | [optional] +**buttonWidth** | **String** | With the button style Web Messenger, you have the option of specifying the button width. | [optional] +**buttonHeight** | **String** | With the button style Web Messenger, you have the option of specifying the button height. | [optional] +**integrationOrder** | **List<String>** | Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed. | [optional] +**businessName** | **String** | A custom business name for the Web Messenger. | [optional] +**businessIconUrl** | **String** | A custom business icon url for the Web Messenger. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. | [optional] +**backgroundImageUrl** | **String** | A background image url for the conversation. Image will be tiled to fit the window. | [optional] +**originWhitelist** | **List<String>** | A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454: scheme \"://\" host [ \":\" port ], where scheme is http or https. | [optional] +**prechatCapture** | [**PrechatCapture**](PrechatCapture.md) | Object whose properties can be set to specify the add-on’s options. See the [guide](https://docs.smooch.io/guide/web-messenger/#prechat-capture) to learn more about Prechat Capture. | [optional] +**canUserCreateMoreConversations** | **Boolean** | Allows users to create more than one conversation on the web messenger integration. | [optional] + + + diff --git a/docs/WebUpdate.md b/docs/WebUpdate.md new file mode 100644 index 00000000..56b68fcc --- /dev/null +++ b/docs/WebUpdate.md @@ -0,0 +1,31 @@ + + +# WebUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**displayName** | **String** | A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`. | [optional] +**brandColor** | **String** | This color will be used in the messenger header and the button or tab in idle state. Must be a 3 or 6-character hexadecimal color. | [optional] +**fixedIntroPane** | **Boolean** | When true, the introduction pane will be pinned at the top of the conversation instead of scrolling with it. | [optional] +**conversationColor** | **String** | This color will be used for customer messages, quick replies and actions in the footer. Must be a 3 or 6-character hexadecimal color. | [optional] +**actionColor** | **String** | This color will be used for call-to-actions inside your messages. Must be a 3 or 6-character hexadecimal color. | [optional] +**displayStyle** | **String** | Choose how the messenger will appear on your website. Must be either button or tab. | [optional] +**buttonIconUrl** | **String** | With the button style Web Messenger, you have the option of selecting your own button icon. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. | [optional] +**buttonWidth** | **String** | With the button style Web Messenger, you have the option of specifying the button width. | [optional] +**buttonHeight** | **String** | With the button style Web Messenger, you have the option of specifying the button height. | [optional] +**integrationOrder** | **List<String>** | Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed. | [optional] +**businessName** | **String** | A custom business name for the Web Messenger. | [optional] +**businessIconUrl** | **String** | A custom business icon url for the Web Messenger. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. | [optional] +**backgroundImageUrl** | **String** | A background image url for the conversation. Image will be tiled to fit the window. | [optional] +**originWhitelist** | **List<String>** | A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454: scheme \"://\" host [ \":\" port ], where scheme is http or https. | [optional] +**prechatCapture** | [**PrechatCapture**](PrechatCapture.md) | Object whose properties can be set to specify the add-on’s options. See the [guide](https://docs.smooch.io/guide/web-messenger/#prechat-capture) to learn more about Prechat Capture. | [optional] +**canUserCreateConversation** | **Boolean** | Allows users to create more than one conversation on the web messenger integration. | [optional] + + +## Implemented Interfaces + +* IntegrationUpdate + + diff --git a/docs/WebUpdateAllOf.md b/docs/WebUpdateAllOf.md new file mode 100644 index 00000000..39da0076 --- /dev/null +++ b/docs/WebUpdateAllOf.md @@ -0,0 +1,27 @@ + + +# WebUpdateAllOf + +To configure a Web Messenger integration, acquire the required information and call the Create Integration endpoint. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**brandColor** | **String** | This color will be used in the messenger header and the button or tab in idle state. Must be a 3 or 6-character hexadecimal color. | [optional] +**fixedIntroPane** | **Boolean** | When true, the introduction pane will be pinned at the top of the conversation instead of scrolling with it. | [optional] +**conversationColor** | **String** | This color will be used for customer messages, quick replies and actions in the footer. Must be a 3 or 6-character hexadecimal color. | [optional] +**actionColor** | **String** | This color will be used for call-to-actions inside your messages. Must be a 3 or 6-character hexadecimal color. | [optional] +**displayStyle** | **String** | Choose how the messenger will appear on your website. Must be either button or tab. | [optional] +**buttonIconUrl** | **String** | With the button style Web Messenger, you have the option of selecting your own button icon. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. | [optional] +**buttonWidth** | **String** | With the button style Web Messenger, you have the option of specifying the button width. | [optional] +**buttonHeight** | **String** | With the button style Web Messenger, you have the option of specifying the button height. | [optional] +**integrationOrder** | **List<String>** | Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed. | [optional] +**businessName** | **String** | A custom business name for the Web Messenger. | [optional] +**businessIconUrl** | **String** | A custom business icon url for the Web Messenger. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. | [optional] +**backgroundImageUrl** | **String** | A background image url for the conversation. Image will be tiled to fit the window. | [optional] +**originWhitelist** | **List<String>** | A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454: scheme \"://\" host [ \":\" port ], where scheme is http or https. | [optional] +**prechatCapture** | [**PrechatCapture**](PrechatCapture.md) | Object whose properties can be set to specify the add-on’s options. See the [guide](https://docs.smooch.io/guide/web-messenger/#prechat-capture) to learn more about Prechat Capture. | [optional] +**canUserCreateConversation** | **Boolean** | Allows users to create more than one conversation on the web messenger integration. | [optional] + + + diff --git a/docs/Webhook.md b/docs/Webhook.md index b213d360..6a0ebdb2 100644 --- a/docs/Webhook.md +++ b/docs/Webhook.md @@ -1,16 +1,18 @@ + # Webhook ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **String** | The webhook ID, generated automatically. | +**id** | **String** | A unique identifier for the webhook. | [optional] [readonly] +**version** | **String** | Schema version of the payload delivered to this webhook. Can be `v1`, `v1.1` or `v2`. | [optional] [readonly] **target** | **String** | URL to be called when the webhook is triggered. | -**triggers** | **List<String>** | An array of triggers you wish to have the webhook listen to. See [**WebhookTriggersEnum**](Enums.md#WebhookTriggersEnum) for available values. | -**secret** | **String** | Secret which will be transmitted with each webhook invocation and can be used to verify the authenticity of the caller. | -**version** | **String** | The payload version of the webhook. | [optional] -**includeClient** | **Boolean** | Specifies whether webhook payloads should include the client information associated with a conversation in webhook events. | [optional] -**includeFullAppUser** | **Boolean** | Specifies whether webhook payloads should include the complete appUser schema for appUser events. | [optional] +**triggers** | **List<String>** | An array of triggers the integration is subscribed to. This property is case sensitive. Current supported triggers in v2 are `conversation:create`, `conversation:message:delivery:channel`, `conversation:message:delivery:failure`, `conversation:message:delivery:user`, `conversation:message`, `conversation:read`, `conversation:typing`, `conversation:postback`, and `user:merge` | +**secret** | **String** | Webhook secret, used to verify the origin of incoming requests. | [optional] +**includeFullUser** | **Boolean** | A boolean specifying whether webhook payloads should include the complete user schema for events involving a specific user. | [optional] +**includeFullSource** | **Boolean** | A boolean specifying whether webhook payloads should include the client and device object (when applicable). | [optional] diff --git a/docs/WebhookApi.md b/docs/WebhookApi.md deleted file mode 100644 index cc169298..00000000 --- a/docs/WebhookApi.md +++ /dev/null @@ -1,337 +0,0 @@ -# WebhookApi - -All URIs are relative to *https://api.smooch.io* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createWebhook**](WebhookApi.md#createWebhook) | **POST** /v1.1/apps/{appId}/webhooks | -[**deleteWebhook**](WebhookApi.md#deleteWebhook) | **DELETE** /v1.1/apps/{appId}/webhooks/{webhookId} | -[**getWebhook**](WebhookApi.md#getWebhook) | **GET** /v1.1/apps/{appId}/webhooks/{webhookId} | -[**listWebhooks**](WebhookApi.md#listWebhooks) | **GET** /v1.1/apps/{appId}/webhooks | -[**updateWebhook**](WebhookApi.md#updateWebhook) | **PUT** /v1.1/apps/{appId}/webhooks/{webhookId} | - - - -# **createWebhook** -> WebhookResponse createWebhook(appId, webhookCreateBody) - - - -Create a webhook for the specified app. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.WebhookApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -WebhookApi apiInstance = new WebhookApi(); -String appId = "appId_example"; // String | Identifies the app. -WebhookCreate webhookCreateBody = new WebhookCreate(); // WebhookCreate | Body for a createWebhook request. -try { - WebhookResponse result = apiInstance.createWebhook(appId, webhookCreateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling WebhookApi#createWebhook"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **webhookCreateBody** | [**WebhookCreate**](WebhookCreate.md)| Body for a createWebhook request. | - -### Return type - -[**WebhookResponse**](WebhookResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **deleteWebhook** -> deleteWebhook(appId, webhookId) - - - -Delete the specified webhook. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.WebhookApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -WebhookApi apiInstance = new WebhookApi(); -String appId = "appId_example"; // String | Identifies the app. -String webhookId = "webhookId_example"; // String | Identifies the webhook. -try { - apiInstance.deleteWebhook(appId, webhookId); -} catch (ApiException e) { - System.err.println("Exception when calling WebhookApi#deleteWebhook"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **webhookId** | **String**| Identifies the webhook. | - -### Return type - -null (empty response body) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **getWebhook** -> WebhookResponse getWebhook(appId, webhookId) - - - -Get the specified webhook. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.WebhookApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -WebhookApi apiInstance = new WebhookApi(); -String appId = "appId_example"; // String | Identifies the app. -String webhookId = "webhookId_example"; // String | Identifies the webhook. -try { - WebhookResponse result = apiInstance.getWebhook(appId, webhookId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling WebhookApi#getWebhook"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **webhookId** | **String**| Identifies the webhook. | - -### Return type - -[**WebhookResponse**](WebhookResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **listWebhooks** -> ListWebhooksResponse listWebhooks(appId) - - - -List webhooks for the specified app. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.WebhookApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -WebhookApi apiInstance = new WebhookApi(); -String appId = "appId_example"; // String | Identifies the app. -try { - ListWebhooksResponse result = apiInstance.listWebhooks(appId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling WebhookApi#listWebhooks"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - -### Return type - -[**ListWebhooksResponse**](ListWebhooksResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -# **updateWebhook** -> WebhookResponse updateWebhook(appId, webhookId, webhookUpdateBody) - - - -Update the specified webhook. - -### Example -```java -// Import classes: -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.Configuration; -import io.smooch.client.auth.*; -import io.smooch.client.api.WebhookApi; - -ApiClient defaultClient = Configuration.getDefaultApiClient(); - - -// Configure HTTP basic authorization (recommended): basicAuth -HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); -basicAuth.setUsername("API_KEY_ID"); -basicAuth.setPassword("API_KEY_SECRET"); - - -// OR - -// Configure API key authorization: jwt -ApiKeyAuth jwt = (ApiKeyAuth) defaultClient.getAuthentication("jwt"); -jwt.setApiKey("YOUR JWT"); -jwt.setApiKeyPrefix("Bearer"); - -WebhookApi apiInstance = new WebhookApi(); -String appId = "appId_example"; // String | Identifies the app. -String webhookId = "webhookId_example"; // String | Identifies the webhook. -WebhookUpdate webhookUpdateBody = new WebhookUpdate(); // WebhookUpdate | Body for an updateWebhook request. -try { - WebhookResponse result = apiInstance.updateWebhook(appId, webhookId, webhookUpdateBody); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling WebhookApi#updateWebhook"); - e.printStackTrace(); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **appId** | **String**| Identifies the app. | - **webhookId** | **String**| Identifies the webhook. | - **webhookUpdateBody** | [**WebhookUpdate**](WebhookUpdate.md)| Body for an updateWebhook request. | - -### Return type - -[**WebhookResponse**](WebhookResponse.md) - -### Authorization - -[basicAuth](../README.md#basicAuth), [jwt](../README.md#jwt) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - diff --git a/docs/WebhookBody.md b/docs/WebhookBody.md new file mode 100644 index 00000000..6d51e76e --- /dev/null +++ b/docs/WebhookBody.md @@ -0,0 +1,15 @@ + + +# WebhookBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**target** | **String** | URL to be called when the webhook is triggered. | [optional] +**triggers** | **List<String>** | An array of triggers the integration is subscribed to. This property is case sensitive. Current supported triggers in v2 are `conversation:create`, `conversation:message:delivery:channel`, `conversation:message:delivery:failure`, `conversation:message:delivery:user`, `conversation:message`, `conversation:read`, `conversation:typing`, `conversation:postback`, and `user:merge` | [optional] +**includeFullUser** | **Boolean** | A boolean specifying whether webhook payloads should include the complete user schema for events involving a specific user. | [optional] +**includeFullSource** | **Boolean** | A boolean specifying whether webhook payloads should include the client and device object (when applicable). | [optional] + + + diff --git a/docs/WebhookCreate.md b/docs/WebhookCreate.md deleted file mode 100644 index 9961cad7..00000000 --- a/docs/WebhookCreate.md +++ /dev/null @@ -1,13 +0,0 @@ - -# WebhookCreate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**target** | **String** | URL to be called when the webhook is triggered. | -**triggers** | **List<String>** | An array of triggers you wish to have the webhook listen to. See [**WebhookTriggersEnum**](Enums.md#WebhookTriggersEnum) for available values. | [optional] -**includeClient** | **Boolean** | Specifies whether webhook payloads should include the client information associated with a conversation in webhook events. | [optional] -**includeFullAppUser** | **Boolean** | Specifies whether webhook payloads should include the complete appUser schema for appUser events. | [optional] - - - diff --git a/docs/WebhookCreateBody.md b/docs/WebhookCreateBody.md new file mode 100644 index 00000000..d2bebd35 --- /dev/null +++ b/docs/WebhookCreateBody.md @@ -0,0 +1,11 @@ + + +# WebhookCreateBody + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + + diff --git a/docs/WebhookListResponse.md b/docs/WebhookListResponse.md new file mode 100644 index 00000000..8e846dde --- /dev/null +++ b/docs/WebhookListResponse.md @@ -0,0 +1,12 @@ + + +# WebhookListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**webhooks** | [**List<Webhook>**](Webhook.md) | List of webhooks associated with the integration. | [optional] + + + diff --git a/docs/WebhookResponse.md b/docs/WebhookResponse.md index ce620797..89f697a5 100644 --- a/docs/WebhookResponse.md +++ b/docs/WebhookResponse.md @@ -1,10 +1,12 @@ + # WebhookResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**webhook** | [**Webhook**](Webhook.md) | The webhook. | +**webhook** | [**Webhook**](Webhook.md) | The webhook. | [optional] diff --git a/docs/WebhookSubSchema.md b/docs/WebhookSubSchema.md new file mode 100644 index 00000000..a60fad61 --- /dev/null +++ b/docs/WebhookSubSchema.md @@ -0,0 +1,14 @@ + + +# WebhookSubSchema + +The webhook that generated the payload. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | The unique ID of the webhook. | [optional] +**version** | **String** | Schema version of the payload delivered to this webhook (v2). | [optional] + + + diff --git a/docs/WebhookUpdate.md b/docs/WebhookUpdate.md deleted file mode 100644 index 85d2b6e8..00000000 --- a/docs/WebhookUpdate.md +++ /dev/null @@ -1,13 +0,0 @@ - -# WebhookUpdate - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**target** | **String** | URL to be called when the webhook is triggered. | [optional] -**triggers** | **List<String>** | An array of triggers you wish to have the webhook listen to. See [**WebhookTriggersEnum**](Enums.md#WebhookTriggersEnum) for available values. | [optional] -**includeClient** | **Boolean** | Specifies whether webhook payloads should include the client information associated with a conversation in webhook events. | [optional] -**includeFullAppUser** | **Boolean** | Specifies whether webhook payloads should include the complete appUser schema for appUser events. | [optional] - - - diff --git a/docs/WebhooksApi.md b/docs/WebhooksApi.md new file mode 100644 index 00000000..0a286d14 --- /dev/null +++ b/docs/WebhooksApi.md @@ -0,0 +1,422 @@ +# WebhooksApi + +All URIs are relative to *https://api.smooch.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createWebhook**](WebhooksApi.md#createWebhook) | **POST** /v2/apps/{appId}/integrations/{integrationId}/webhooks | Create Webhook +[**deleteWebhook**](WebhooksApi.md#deleteWebhook) | **DELETE** /v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId} | Delete Webhook +[**getWebhook**](WebhooksApi.md#getWebhook) | **GET** /v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId} | Get Webhook +[**listWebhooks**](WebhooksApi.md#listWebhooks) | **GET** /v2/apps/{appId}/integrations/{integrationId}/webhooks | List Webhooks +[**updateWebhook**](WebhooksApi.md#updateWebhook) | **PATCH** /v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId} | Update Webhook + + + +## createWebhook + +> WebhookResponse createWebhook(webhookCreateBody, appId, integrationId) + +Create Webhook + +Creates a new webhook associated with a Sunshine Conversations Connect integration or a custom integration. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.WebhooksApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + WebhooksApi apiInstance = new WebhooksApi(defaultClient); + WebhookCreateBody webhookCreateBody = new WebhookCreateBody(); // WebhookCreateBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String integrationId = "029c31f25a21b47effd7be90"; // String | The id of the integration. + // Add required body parameters + + try { + WebhookResponse result = apiInstance.createWebhook(webhookCreateBody, appId, integrationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WebhooksApi#createWebhook"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **webhookCreateBody** | [**WebhookCreateBody**](WebhookCreateBody.md)| | + **appId** | **String**| Identifies the app. | + **integrationId** | **String**| The id of the integration. | + +### Return type + +[**WebhookResponse**](WebhookResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Created | - | +| **400** | Bad Request | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | + + +## deleteWebhook + +> Object deleteWebhook(appId, integrationId, webhookId) + +Delete Webhook + +Deletes the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.WebhooksApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + WebhooksApi apiInstance = new WebhooksApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String integrationId = "029c31f25a21b47effd7be90"; // String | The id of the integration. + String webhookId = "029c31f25a21b47effd7be90"; // String | The id of the webhook. + // Add required body parameters + + try { + Object result = apiInstance.deleteWebhook(appId, integrationId, webhookId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WebhooksApi#deleteWebhook"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **integrationId** | **String**| The id of the integration. | + **webhookId** | **String**| The id of the webhook. | + +### Return type + +**Object** + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Not Found | - | + + +## getWebhook + +> WebhookResponse getWebhook(appId, integrationId, webhookId) + +Get Webhook + +Gets the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.WebhooksApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + WebhooksApi apiInstance = new WebhooksApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String integrationId = "029c31f25a21b47effd7be90"; // String | The id of the integration. + String webhookId = "029c31f25a21b47effd7be90"; // String | The id of the webhook. + // Add required body parameters + + try { + WebhookResponse result = apiInstance.getWebhook(appId, integrationId, webhookId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WebhooksApi#getWebhook"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **integrationId** | **String**| The id of the integration. | + **webhookId** | **String**| The id of the webhook. | + +### Return type + +[**WebhookResponse**](WebhookResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **404** | Not Found | - | + + +## listWebhooks + +> WebhookListResponse listWebhooks(appId, integrationId) + +List Webhooks + +Lists all webhooks for a given Sunshine Conversations Connect integration or custom integration. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.WebhooksApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + WebhooksApi apiInstance = new WebhooksApi(defaultClient); + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String integrationId = "029c31f25a21b47effd7be90"; // String | The id of the integration. + // Add required body parameters + + try { + WebhookListResponse result = apiInstance.listWebhooks(appId, integrationId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WebhooksApi#listWebhooks"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **appId** | **String**| Identifies the app. | + **integrationId** | **String**| The id of the integration. | + +### Return type + +[**WebhookListResponse**](WebhookListResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | + + +## updateWebhook + +> WebhookResponse updateWebhook(webhookBody, appId, integrationId, webhookId) + +Update Webhook + +Updates the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration. + +### Example + +```java +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.auth.*; +import com.zendesk.sunshine_conversations_client.model.*; +import com.zendesk.sunshine_conversations_client.api.WebhooksApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.smooch.io"); + + // Configure HTTP basic authorization: basicAuth + HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); + basicAuth.setUsername("API_KEY_ID"); + basicAuth.setPassword("API_KEY_SECRET"); + + // Uncomment this section to use JWTs instead + // HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + // bearerAuth.setBearerToken("YOUR TOKEN OR JWT"); + + WebhooksApi apiInstance = new WebhooksApi(defaultClient); + WebhookBody webhookBody = new WebhookBody(); // WebhookBody | + String appId = "5d8cff3cd55b040010928b5b"; // String | Identifies the app. + String integrationId = "029c31f25a21b47effd7be90"; // String | The id of the integration. + String webhookId = "029c31f25a21b47effd7be90"; // String | The id of the webhook. + // Add required body parameters + + try { + WebhookResponse result = apiInstance.updateWebhook(webhookBody, appId, integrationId, webhookId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WebhooksApi#updateWebhook"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **webhookBody** | [**WebhookBody**](WebhookBody.md)| | + **appId** | **String**| Identifies the app. | + **integrationId** | **String**| The id of the integration. | + **webhookId** | **String**| The id of the webhook. | + +### Return type + +[**WebhookResponse**](WebhookResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Ok | - | +| **400** | Bad Request | - | +| **404** | Not Found | - | + diff --git a/docs/Webview.md b/docs/Webview.md new file mode 100644 index 00000000..384613bd --- /dev/null +++ b/docs/Webview.md @@ -0,0 +1,36 @@ + + +# Webview + +When a webview actions is clicked/tapped, the provided URI will be loaded in a webview. Channels that do not support webviews will open the fallback URI instead. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of action. | +**uri** | [**URI**](URI.md) | The webview URI. This is the URI that will open in the webview when clicking the button. | +**text** | **String** | The button text. | +**_default** | **Boolean** | Boolean value indicating whether the action is the default action for a message item in Facebook Messenger. | [optional] +**metadata** | [**Object**](.md) | Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. | [optional] +**extraChannelOptions** | [**ExtraChannelOptions**](ExtraChannelOptions.md) | | [optional] +**size** | [**SizeEnum**](#SizeEnum) | The size to display a webview. Used for actions of type webview. | [optional] +**fallback** | **String** | The fallback uri for channels that don’t support webviews. Used for actions of type webview. | +**openOnReceive** | **Boolean** | Boolean value indicating if the webview should open automatically. Only one action per message can be set to true. Currently only supported on the Web Messenger. | [optional] + + + +## Enum: SizeEnum + +Name | Value +---- | ----- +COMPACT | "compact" +TALL | "tall" +FULL | "full" + + +## Implemented Interfaces + +* Action +* ActionSubset + + diff --git a/docs/WhatsAppUpdate.md b/docs/WhatsAppUpdate.md new file mode 100644 index 00000000..4294125f --- /dev/null +++ b/docs/WhatsAppUpdate.md @@ -0,0 +1,19 @@ + + +# WhatsAppUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**displayName** | **String** | A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`. | [optional] +**hsmFallbackLanguage** | **String** | Specify a fallback language to use when sending WhatsApp message template using the short hand syntax. Defaults to en_US. See WhatsApp documentation for more info. | [optional] +**accountId** | **String** | The business ID associated with the WhatsApp account. In combination with accountManagementAccessToken, it’s used for Message Template Reconstruction. | [optional] +**accountManagementAccessToken** | **String** | An access token associated with the accountId used to query the WhatsApp Account Management API. In combination with accountId, it’s used for Message Template Reconstruction. | [optional] + + +## Implemented Interfaces + +* IntegrationUpdate + + diff --git a/docs/WhatsAppUpdateAllOf.md b/docs/WhatsAppUpdateAllOf.md new file mode 100644 index 00000000..8a76c392 --- /dev/null +++ b/docs/WhatsAppUpdateAllOf.md @@ -0,0 +1,14 @@ + + +# WhatsAppUpdateAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hsmFallbackLanguage** | **String** | Specify a fallback language to use when sending WhatsApp message template using the short hand syntax. Defaults to en_US. See WhatsApp documentation for more info. | [optional] +**accountId** | **String** | The business ID associated with the WhatsApp account. In combination with accountManagementAccessToken, it’s used for Message Template Reconstruction. | [optional] +**accountManagementAccessToken** | **String** | An access token associated with the accountId used to query the WhatsApp Account Management API. In combination with accountId, it’s used for Message Template Reconstruction. | [optional] + + + diff --git a/docs/Whatsapp.md b/docs/Whatsapp.md new file mode 100644 index 00000000..1c6d86ab --- /dev/null +++ b/docs/Whatsapp.md @@ -0,0 +1,16 @@ + + +# Whatsapp + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**deploymentId** | **String** | The Id of the deployment. The integrationId and the appId will be added to the deployment. Additionally, the deployment’s status will be set to integrated. | +**hsmFallbackLanguage** | **String** | Specify a fallback language to use when sending WhatsApp message template using the short hand syntax. Defaults to en_US. See WhatsApp documentation for more info. | [optional] +**accountId** | **String** | The business ID associated with the WhatsApp account. In combination with accountManagementAccessToken, it’s used for Message Template Reconstruction. | [optional] +**accountManagementAccessToken** | **String** | An access token associated with the accountId used to query the WhatsApp Account Management API. In combination with accountId, it’s used for Message Template Reconstruction. | [optional] + + + diff --git a/docs/WhatsappAllOf.md b/docs/WhatsappAllOf.md new file mode 100644 index 00000000..db767cb3 --- /dev/null +++ b/docs/WhatsappAllOf.md @@ -0,0 +1,17 @@ + + +# WhatsappAllOf + +To configure a WhatsApp integration, use your WhatsApp API Client connection information. Sunshine Conversations can provide WhatsApp API Client hosting for approved brands. See our [WhatsApp guide](https://docs.smooch.io/guide/whatsapp/#whatsapp-api-client) for more details on WhatsApp API Client hosting. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of integration. | [optional] +**deploymentId** | **String** | The Id of the deployment. The integrationId and the appId will be added to the deployment. Additionally, the deployment’s status will be set to integrated. | +**hsmFallbackLanguage** | **String** | Specify a fallback language to use when sending WhatsApp message template using the short hand syntax. Defaults to en_US. See WhatsApp documentation for more info. | [optional] +**accountId** | **String** | The business ID associated with the WhatsApp account. In combination with accountManagementAccessToken, it’s used for Message Template Reconstruction. | [optional] +**accountManagementAccessToken** | **String** | An access token associated with the accountId used to query the WhatsApp Account Management API. In combination with accountId, it’s used for Message Template Reconstruction. | [optional] + + + diff --git a/git_push.sh b/git_push.sh deleted file mode 100644 index ed374619..00000000 --- a/git_push.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." - git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 2c6137b8..62d4c053 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b7a36473..21e622da 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Tue May 17 23:08:05 CST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip diff --git a/gradlew b/gradlew index 9d82f789..fbd7c515 100644 --- a/gradlew +++ b/gradlew @@ -1,4 +1,20 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## ## @@ -6,20 +22,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +64,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,28 +75,14 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -85,7 +106,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -105,10 +126,11 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath @@ -134,27 +156,30 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 5f192121..a9f778a7 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,90 +1,104 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/pom.xml b/pom.xml index bc8c62e9..6f5a3e11 100644 --- a/pom.xml +++ b/pom.xml @@ -1,217 +1,257 @@ - 4.0.0 - io.smooch - api - jar - api - 5.29.0 - https://github.com/swagger-api/swagger-codegen - Swagger Java - - scm:git:git@github.com:swagger-api/swagger-codegen.git - scm:git:git@github.com:swagger-api/swagger-codegen.git - https://github.com/swagger-api/swagger-codegen - - - 2.2.0 - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + 4.0.0 + com.zendesk + sunshine-conversations-client + jar + sunshine-conversations-client + 9.0.0 + + scm:git:git@github.com:openapitools/openapi-generator.git + scm:git:git@github.com:openapitools/openapi-generator.git + https://github.com/openapitools/openapi-generator + - - - Apache-2.0 - http://www.apache.org/licenses/LICENSE-2.0 - repo - - + + + Apache-2.0 + http://www.apache.org/licenses/LICENSE-2.0 + repo + + - - - Swagger - apiteam@swagger.io - Swagger - http://swagger.io - - + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.12 - - - - loggerPath - conf/log4j.properties - - - -Xms512m -Xmx1500m - methods - pertest - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory}/lib - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.2 - - - - jar - test-jar - - - - - - + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + pertest + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + - - org.codehaus.mojo - build-helper-maven-plugin - 1.10 - - - add_sources - generate-sources - - add-source - - - - src/main/java - - - - - add_test_sources - generate-test-sources - - add-test-source - - - - src/test/java - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.4 - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + + jar + test-jar + + + + + + - - - sign-artifacts - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - + + org.codehaus.mojo + build-helper-maven-plugin + 1.10 + + + add_sources + generate-sources + + add-source + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.5.1 + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.1.1 + + none + + + + attach-javadocs + + jar + + + + - - - + + + + io.swagger + swagger-annotations + ${swagger-annotations-version} + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + + org.jboss.resteasy + resteasy-client + ${resteasy-version} + + + org.jboss.resteasy + resteasy-multipart-provider + ${resteasy-version} + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} + + + joda-time + joda-time + ${jodatime-version} + + + + + com.brsanthu + migbase64 + 2.2 + - - - io.swagger - swagger-annotations - ${swagger-core-version} - - - com.squareup.okhttp - okhttp - ${okhttp-version} - - - com.squareup.okhttp - logging-interceptor - ${okhttp-version} - - - com.google.code.gson - gson - ${gson-version} - - - joda-time - joda-time - ${jodatime-version} - - - - junit - junit - ${junit-version} - test - - - - 1.7 - ${java.version} - ${java.version} - 1.5.12 - 2.7.5 - 2.6.2 - 2.9.3 - 1.0.0 - 4.12 - UTF-8 - + + org.jboss.resteasy + resteasy-jackson2-provider + 3.1.3.Final + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + com.github.joschi.jackson + jackson-datatype-threetenbp + ${threetenbp-version} + + + + junit + junit + ${junit-version} + test + + + + UTF-8 + 1.5.22 + 3.1.3.Final + 2.10.3 + 2.10.3 + 0.2.1 + 2.9.10 + 2.9.9 + 1.0.0 + 4.13 + diff --git a/settings.gradle b/settings.gradle index 484f3759..c5884a11 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -rootProject.name = "api" \ No newline at end of file +rootProject.name = "sunshine-conversations-client" \ No newline at end of file diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index f44797ea..181a3694 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -1,3 +1,3 @@ - + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/ApiClient.java b/src/main/java/com/zendesk/sunshine_conversations_client/ApiClient.java new file mode 100644 index 00000000..b2c98808 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/ApiClient.java @@ -0,0 +1,787 @@ +package com.zendesk.sunshine_conversations_client; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TimeZone; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Form; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import com.zendesk.sunshine_conversations_client.model.AppListFilter; +import com.zendesk.sunshine_conversations_client.model.ConversationListFilter; +import com.zendesk.sunshine_conversations_client.model.IntegrationListFilter; +import com.zendesk.sunshine_conversations_client.model.Page; +import org.jboss.logging.Logger; +import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; +import org.jboss.resteasy.client.jaxrs.internal.ClientConfiguration; +import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataOutput; +import org.jboss.resteasy.spi.ResteasyProviderFactory; + +import com.zendesk.sunshine_conversations_client.auth.Authentication; +import com.zendesk.sunshine_conversations_client.auth.HttpBasicAuth; +import com.zendesk.sunshine_conversations_client.auth.HttpBearerAuth; +import com.zendesk.sunshine_conversations_client.auth.ApiKeyAuth; + + +public class ApiClient { + private Map defaultHeaderMap = new HashMap(); + private Map defaultCookieMap = new HashMap(); + private String basePath = "https://api.smooch.io"; + private boolean debugging = false; + private static int DEFAULT_CONNECTION_POOL_SIZE = 20; + + private Client httpClient; + private JSON json; + private String tempFolderPath = null; + + private Map authentications; + + private int statusCode; + private int connectionPoolSize; + private Map> responseHeaders; + + private DateFormat dateFormat; + + public ApiClient(){ + this(DEFAULT_CONNECTION_POOL_SIZE); + } + + public ApiClient(int connectionPoolSize) { + this.connectionPoolSize = connectionPoolSize; + json = new JSON(); + httpClient = buildHttpClient(debugging); + + this.dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", Locale.ROOT); + + // Use UTC as the default time zone. + this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + + this.json.setDateFormat((DateFormat) dateFormat.clone()); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/9.0.0/java"); + + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap(); + authentications.put("basicAuth", new HttpBasicAuth()); + authentications.put("bearerAuth", new HttpBearerAuth("bearer")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Gets the JSON instance to do JSON serialization and deserialization. + * @return the JSON utility class + */ + public JSON getJSON() { + return json; + } + + public Client getHttpClient() { + return httpClient; + } + + public ApiClient setHttpClient(Client httpClient) { + this.httpClient = httpClient; + return this; + } + + public String getBasePath() { + return basePath; + } + + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Gets the status code of the previous request + * @return the status code of the previous request + */ + public int getStatusCode() { + return statusCode; + } + + /** + * Gets the response headers of the previous request + * @return the response headers of the previous request + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * @return the authentications + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set username for the first HTTP basic authentication. + * @param username the username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * @param password the password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * @param apiKey the API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * @param apiKeyPrefix the API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * @param userAgent the User-Agent header value + * @return this {@code ApiClient} + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return this {@code ApiClient} + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * @return {@code true} if debugging is enabled for this API client + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return this {@code ApiClient} + */ + public ApiClient setDebugging(boolean debugging) { + this.debugging = debugging; + // Rebuild HTTP Client according to the new "debugging" value. + this.httpClient = buildHttpClient(debugging); + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default tempopary folder. + * + * @return the temporary folder path + * @see + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get the date format used to parse/format date parameters. + * @return the date format used to parse/format date parameters + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + * Set the date format used to parse/format date parameters. + * @param dateFormat a date format used to parse/format date parameters + * @return this {@code ApiClient} + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + // also set the date format for model (de)serialization with Date properties + this.json.setDateFormat((DateFormat) dateFormat.clone()); + return this; + } + + /** + * Parse the given string into Date object. + * @param str a string to parse + * @return a {@code Date} object + */ + public Date parseDate(String str) { + try { + return dateFormat.parse(str); + } catch (java.text.ParseException e) { + throw new RuntimeException(e); + } + } + + /** + * Format the given Date object into string. + * @param date a {@code Date} object to format + * @return the {@code String} version of the {@code Date} object + */ + public String formatDate(Date date) { + return dateFormat.format(date); + } + + /** + * Format the given parameter object into string. + * @param param an object to format + * @return the {@code String} version of the object + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date) { + return formatDate((Date) param); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for(Object o : (Collection)param) { + if(b.length() > 0) { + b.append(","); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /* + Serialization for deepObject style query parameters + */ + public List serializeDeepObjectParameter(List params, String objectName, String fieldName, T fieldValue){ + if (fieldValue != null) { + params.add(new Pair(String.format("%s[%s]", objectName, fieldName), fieldValue.toString())); + } + + return params; + } + + /* + Format to {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Object value){ + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null) return params; + + Collection valueCollection = null; + if (value instanceof Collection) { + valueCollection = (Collection) value; + } else { + if (value instanceof Page) { + serializeDeepObjectParameter(params, name, "size", ((Page) value).getSize()); + serializeDeepObjectParameter(params, name, "before", ((Page) value).getBefore()); + serializeDeepObjectParameter(params, name, "after", ((Page) value).getAfter()); + } else if (value instanceof AppListFilter || value instanceof ConversationListFilter || value instanceof IntegrationListFilter) { + Field[] fields = value.getClass().getDeclaredFields(); + for(Field field: fields) { + if (!java.lang.reflect.Modifier.isStatic(field.getModifiers())) { + String fieldName = field.getName(); + try { + Method fieldGetter = value.getClass().getDeclaredMethod(String.format("get%s%s", fieldName.substring(0, 1).toUpperCase(), fieldName.substring(1))); + serializeDeepObjectParameter(params, "filter", fieldName, fieldGetter.invoke(value)); + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + e.printStackTrace(); + } + } + } + } else { + params.add(new Pair(name, parameterToString(value))); + } + + return params; + } + + if (valueCollection.isEmpty()){ + return params; + } + + // get the collection format + collectionFormat = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // default: csv + + // create the params based on the collection format + if (collectionFormat.equals("multi")) { + for (Object item : valueCollection) { + params.add(new Pair(name, parameterToString(item))); + } + + return params; + } + + String delimiter = ","; + + if (collectionFormat.equals("csv")) { + delimiter = ","; + } else if (collectionFormat.equals("ssv")) { + delimiter = " "; + } else if (collectionFormat.equals("tsv")) { + delimiter = "\t"; + } else if (collectionFormat.equals("pipes")) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : valueCollection) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + params.add(new Pair(name, sb.substring(1))); + + return params; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * @param str a {@code String} to escape + * @return the escaped version of the {@code String} + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Serialize the given Java object into string entity according the given + * Content-Type (only JSON is supported for now). + * @param obj the object to serialize + * @param formParams the form parameters + * @param contentType the content type + * @return an {@code Entity} + * @throws ApiException on failure to serialize + */ + public Entity serialize(Object obj, Map formParams, String contentType) throws ApiException { + Entity entity = null; + if (contentType.startsWith("multipart/form-data")) { + MultipartFormDataOutput multipart = new MultipartFormDataOutput(); + for (Entry param: formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + try { + multipart.addFormData(param.getKey(), new FileInputStream(file),MediaType.APPLICATION_OCTET_STREAM_TYPE, file.getName()); + } catch (FileNotFoundException e) { + throw new ApiException("Could not serialize multipart/form-data "+e.getMessage()); + } + } else { + multipart.addFormData(param.getKey(),param.getValue().toString(),MediaType.APPLICATION_OCTET_STREAM_TYPE); + } + } + entity = Entity.entity(multipart, MediaType.MULTIPART_FORM_DATA_TYPE); + } else if (contentType.startsWith("application/x-www-form-urlencoded")) { + Form form = new Form(); + for (Entry param: formParams.entrySet()) { + form.param(param.getKey(), parameterToString(param.getValue())); + } + entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); + } else { + // We let jersey handle the serialization + entity = Entity.entity(obj, contentType); + } + return entity; + } + + /** + * Deserialize response body to Java object according to the Content-Type. + * @param a Java type parameter + * @param response the response body to deserialize + * @param returnType a Java type to deserialize into + * @return a deserialized Java object + * @throws ApiException on failure to deserialize + */ + public T deserialize(Response response, GenericType returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + return (T) response.readEntity(byte[].class); + } else if (returnType.equals(File.class)) { + // Handle file downloading. + @SuppressWarnings("unchecked") + T file = (T) downloadFileFromResponse(response); + return file; + } + + String contentType = null; + List contentTypes = response.getHeaders().get("Content-Type"); + if (contentTypes != null && !contentTypes.isEmpty()) + contentType = String.valueOf(contentTypes.get(0)); + if (contentType == null) + throw new ApiException(500, "missing Content-Type in response"); + + return response.readEntity(returnType); + } + + /** + * Download file from the given response. + * @param response a response + * @return a file from the given response + * @throws ApiException If fail to read file content from response and write to disk + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + Files.copy(response.readEntity(InputStream.class), file.toPath()); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) + filename = matcher.group(1); + } + + String prefix = null; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf("."); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // File.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return File.createTempFile(prefix, suffix); + else + return File.createTempFile(prefix, suffix, new File(tempFolderPath)); + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param a Java type parameter + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE" + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param accept The request's Accept header + * @param contentType The request's Content-Type header + * @param authNames The authentications to apply + * @param returnType The return type into which to deserialize the response + * @return The response body in type of string + * @throws ApiException if the invocation failed + */ + public T invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType) throws ApiException { + // In case a per-request authorization is used, skip applying default authorization + if(!headerParams.containsKey("Authorization")){ + updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + } + + // Not using `.target(this.basePath).path(path)` below, + // to support (constant) query string in `path`, e.g. "/posts?draft=1" + WebTarget target = httpClient.target(this.basePath + path); + + if (queryParams != null) { + for (Pair queryParam : queryParams) { + if (queryParam.getValue() != null) { + target = target.queryParam(queryParam.getName(), queryParam.getValue()); + } + } + } + + Invocation.Builder invocationBuilder = target.request().accept(accept); + + for (Entry headerParamsEnrty : headerParams.entrySet()) { + String value = headerParamsEnrty.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.header(headerParamsEnrty.getKey(), value); + } + } + + for (Entry defaultHeaderEnrty: defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(defaultHeaderEnrty.getKey())) { + String value = defaultHeaderEnrty.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.header(defaultHeaderEnrty.getKey(), value); + } + } + } + + for (Entry cookieParamsEntry : cookieParams.entrySet()) { + String value = cookieParamsEntry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.cookie(cookieParamsEntry.getKey(), value); + } + } + + for (Entry defaultCookieEntry: defaultHeaderMap.entrySet()) { + if (!cookieParams.containsKey(defaultCookieEntry.getKey())) { + String value = defaultCookieEntry.getValue(); + if (value != null) { + invocationBuilder = invocationBuilder.cookie(defaultCookieEntry.getKey(), value); + } + } + } + + Entity entity = serialize(body, formParams, contentType); + + Response response = null; + + if ("GET".equals(method)) { + response = invocationBuilder.get(); + } else if ("POST".equals(method)) { + response = invocationBuilder.post(entity); + } else if ("PUT".equals(method)) { + response = invocationBuilder.put(entity); + } else if ("DELETE".equals(method)) { + response = invocationBuilder.method("DELETE", entity); + } else if ("PATCH".equals(method)) { + response = invocationBuilder.method("PATCH", entity); + } else if ("HEAD".equals(method)) { + response = invocationBuilder.head(); + } else if ("OPTIONS".equals(method)) { + response = invocationBuilder.options(); + } else if ("TRACE".equals(method)) { + response = invocationBuilder.trace(); + } else { + throw new ApiException(500, "unknown method type " + method); + } + + statusCode = response.getStatusInfo().getStatusCode(); + responseHeaders = buildResponseHeaders(response); + + if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { + return null; + } else if (response.getStatusInfo().getFamily().equals(Status.Family.SUCCESSFUL)) { + if (returnType == null) + return null; + else + return deserialize(response, returnType); + } else { + String message = "error"; + String respBody = null; + if (response.hasEntity()) { + try { + respBody = String.valueOf(response.readEntity(String.class)); + message = respBody; + } catch (RuntimeException e) { + // e.printStackTrace(); + } + } + throw new ApiException( + response.getStatus(), + message, + buildResponseHeaders(response), + respBody); + } + } + + /** + * Build the Client used to make HTTP requests. + */ + private Client buildHttpClient(boolean debugging) { + final ClientConfiguration clientConfig = new ClientConfiguration(ResteasyProviderFactory.getInstance()); + clientConfig.register(json); + if(debugging){ + clientConfig.register(Logger.class); + } + + ResteasyClientBuilder clientBuilder = (ResteasyClientBuilder) ResteasyClientBuilder.newBuilder(); + clientBuilder.connectionPoolSize(connectionPoolSize); + clientBuilder.withConfig(clientConfig); + return clientBuilder.build(); + } + private Map> buildResponseHeaders(Response response) { + Map> responseHeaders = new HashMap>(); + for (Entry> entry: response.getHeaders().entrySet()) { + List values = entry.getValue(); + List headers = new ArrayList(); + for (Object o : values) { + headers.add(String.valueOf(o)); + } + responseHeaders.put(entry.getKey(), headers); + } + return responseHeaders; + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + */ + private void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, Map cookieParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams, cookieParams); + } + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/ApiException.java b/src/main/java/com/zendesk/sunshine_conversations_client/ApiException.java new file mode 100644 index 00000000..bdc99471 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/ApiException.java @@ -0,0 +1,90 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client; + +import java.util.Map; +import java.util.List; + +public class ApiException extends Exception { + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/Configuration.java b/src/main/java/com/zendesk/sunshine_conversations_client/Configuration.java new file mode 100644 index 00000000..36c205b6 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/Configuration.java @@ -0,0 +1,39 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client; + + +public class Configuration { + private static ApiClient defaultApiClient = new ApiClient(); + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/CustomInstantDeserializer.java b/src/main/java/com/zendesk/sunshine_conversations_client/CustomInstantDeserializer.java new file mode 100644 index 00000000..f7ccc153 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/CustomInstantDeserializer.java @@ -0,0 +1,232 @@ +package com.zendesk.sunshine_conversations_client; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonTokenId; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils; +import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; +import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; +import com.fasterxml.jackson.datatype.threetenbp.function.Function; +import org.threeten.bp.DateTimeException; +import org.threeten.bp.DateTimeUtils; +import org.threeten.bp.Instant; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.ZoneId; +import org.threeten.bp.ZonedDateTime; +import org.threeten.bp.format.DateTimeFormatter; +import org.threeten.bp.temporal.Temporal; +import org.threeten.bp.temporal.TemporalAccessor; + +import java.io.IOException; +import java.math.BigDecimal; + +/** + * Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link ZonedDateTime}s. + * Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format. + * + * @author Nick Williams + */ +public class CustomInstantDeserializer + extends ThreeTenDateTimeDeserializerBase { + private static final long serialVersionUID = 1L; + + public static final CustomInstantDeserializer INSTANT = new CustomInstantDeserializer( + Instant.class, DateTimeFormatter.ISO_INSTANT, + new Function() { + @Override + public Instant apply(TemporalAccessor temporalAccessor) { + return Instant.from(temporalAccessor); + } + }, + new Function() { + @Override + public Instant apply(FromIntegerArguments a) { + return Instant.ofEpochMilli(a.value); + } + }, + new Function() { + @Override + public Instant apply(FromDecimalArguments a) { + return Instant.ofEpochSecond(a.integer, a.fraction); + } + }, + null + ); + + public static final CustomInstantDeserializer OFFSET_DATE_TIME = new CustomInstantDeserializer( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + new Function() { + @Override + public OffsetDateTime apply(TemporalAccessor temporalAccessor) { + return OffsetDateTime.from(temporalAccessor); + } + }, + new Function() { + @Override + public OffsetDateTime apply(FromIntegerArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function() { + @Override + public OffsetDateTime apply(FromDecimalArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction() { + @Override + public OffsetDateTime apply(OffsetDateTime d, ZoneId z) { + return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime())); + } + } + ); + + public static final CustomInstantDeserializer ZONED_DATE_TIME = new CustomInstantDeserializer( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + new Function() { + @Override + public ZonedDateTime apply(TemporalAccessor temporalAccessor) { + return ZonedDateTime.from(temporalAccessor); + } + }, + new Function() { + @Override + public ZonedDateTime apply(FromIntegerArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function() { + @Override + public ZonedDateTime apply(FromDecimalArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction() { + @Override + public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { + return zonedDateTime.withZoneSameInstant(zoneId); + } + } + ); + + protected final Function fromMilliseconds; + + protected final Function fromNanoseconds; + + protected final Function parsedToValue; + + protected final BiFunction adjust; + + protected CustomInstantDeserializer(Class supportedType, + DateTimeFormatter parser, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust) { + super(supportedType, parser); + this.parsedToValue = parsedToValue; + this.fromMilliseconds = fromMilliseconds; + this.fromNanoseconds = fromNanoseconds; + this.adjust = adjust == null ? new BiFunction() { + @Override + public T apply(T t, ZoneId zoneId) { + return t; + } + } : adjust; + } + + @SuppressWarnings("unchecked") + protected CustomInstantDeserializer(CustomInstantDeserializer base, DateTimeFormatter f) { + super((Class) base.handledType(), f); + parsedToValue = base.parsedToValue; + fromMilliseconds = base.fromMilliseconds; + fromNanoseconds = base.fromNanoseconds; + adjust = base.adjust; + } + + @Override + protected JsonDeserializer withDateFormat(DateTimeFormatter dtf) { + if (dtf == _formatter) { + return this; + } + return new CustomInstantDeserializer(this, dtf); + } + + @Override + public T deserialize(JsonParser parser, DeserializationContext context) throws IOException { + //NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only + //string values have to be adjusted to the configured TZ. + switch (parser.getCurrentTokenId()) { + case JsonTokenId.ID_NUMBER_FLOAT: { + BigDecimal value = parser.getDecimalValue(); + long seconds = value.longValue(); + int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds); + return fromNanoseconds.apply(new FromDecimalArguments( + seconds, nanoseconds, getZone(context))); + } + + case JsonTokenId.ID_NUMBER_INT: { + long timestamp = parser.getLongValue(); + if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) { + return this.fromNanoseconds.apply(new FromDecimalArguments( + timestamp, 0, this.getZone(context) + )); + } + return this.fromMilliseconds.apply(new FromIntegerArguments( + timestamp, this.getZone(context) + )); + } + + case JsonTokenId.ID_STRING: { + String string = parser.getText().trim(); + if (string.length() == 0) { + return null; + } + if (string.endsWith("+0000")) { + string = string.substring(0, string.length() - 5) + "Z"; + } + T value; + try { + TemporalAccessor acc = _formatter.parse(string); + value = parsedToValue.apply(acc); + if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) { + return adjust.apply(value, this.getZone(context)); + } + } catch (DateTimeException e) { + throw _peelDTE(e); + } + return value; + } + } + throw context.mappingException("Expected type float, integer, or string."); + } + + private ZoneId getZone(DeserializationContext context) { + // Instants are always in UTC, so don't waste compute cycles + return (_valueClass == Instant.class) ? null : DateTimeUtils.toZoneId(context.getTimeZone()); + } + + private static class FromIntegerArguments { + public final long value; + public final ZoneId zoneId; + + private FromIntegerArguments(long value, ZoneId zoneId) { + this.value = value; + this.zoneId = zoneId; + } + } + + private static class FromDecimalArguments { + public final long integer; + public final int fraction; + public final ZoneId zoneId; + + private FromDecimalArguments(long integer, int fraction, ZoneId zoneId) { + this.integer = integer; + this.fraction = fraction; + this.zoneId = zoneId; + } + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/JSON.java b/src/main/java/com/zendesk/sunshine_conversations_client/JSON.java new file mode 100644 index 00000000..562fa6d8 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/JSON.java @@ -0,0 +1,42 @@ +package com.zendesk.sunshine_conversations_client; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import org.openapitools.jackson.nullable.JsonNullableModule; +import com.fasterxml.jackson.datatype.joda.*; + +import java.text.DateFormat; + +import javax.ws.rs.ext.ContextResolver; + + +public class JSON implements ContextResolver { + private ObjectMapper mapper; + + public JSON() { + mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.setDateFormat(new RFC3339DateFormat()); + JsonNullableModule jnm = new JsonNullableModule(); + mapper.registerModule(jnm); + mapper.registerModule(new JodaModule()); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * @param dateFormat the date format to set + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + @Override + public ObjectMapper getContext(Class type) { + return mapper; + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/Pair.java b/src/main/java/com/zendesk/sunshine_conversations_client/Pair.java new file mode 100644 index 00000000..31c7cc9d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/Pair.java @@ -0,0 +1,60 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client; + +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } + + return true; + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/RFC3339DateFormat.java b/src/main/java/com/zendesk/sunshine_conversations_client/RFC3339DateFormat.java new file mode 100644 index 00000000..b53225a4 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/RFC3339DateFormat.java @@ -0,0 +1,32 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.zendesk.sunshine_conversations_client; + +import com.fasterxml.jackson.databind.util.ISO8601DateFormat; +import com.fasterxml.jackson.databind.util.ISO8601Utils; + +import java.text.FieldPosition; +import java.util.Date; + + +public class RFC3339DateFormat extends ISO8601DateFormat { + + // Same as ISO8601DateFormat but serializing milliseconds. + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + String value = ISO8601Utils.format(date, true); + toAppendTo.append(value); + return toAppendTo; + } + +} \ No newline at end of file diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/ServerConfiguration.java b/src/main/java/com/zendesk/sunshine_conversations_client/ServerConfiguration.java new file mode 100644 index 00000000..41f5045b --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/ServerConfiguration.java @@ -0,0 +1,58 @@ +package com.zendesk.sunshine_conversations_client; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A describtion of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replaceAll("\\{" + name + "\\}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/ServerVariable.java b/src/main/java/com/zendesk/sunshine_conversations_client/ServerVariable.java new file mode 100644 index 00000000..b936967b --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/ServerVariable.java @@ -0,0 +1,23 @@ +package com.zendesk.sunshine_conversations_client; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/StringUtil.java b/src/main/java/com/zendesk/sunshine_conversations_client/StringUtil.java new file mode 100644 index 00000000..fee7073c --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/StringUtil.java @@ -0,0 +1,60 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client; + +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/api/ActivitiesApi.java b/src/main/java/com/zendesk/sunshine_conversations_client/api/ActivitiesApi.java new file mode 100644 index 00000000..a04767c7 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/api/ActivitiesApi.java @@ -0,0 +1,156 @@ +package com.zendesk.sunshine_conversations_client.api; + +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.Pair; + +import javax.ws.rs.core.GenericType; + +import com.zendesk.sunshine_conversations_client.model.ActivityPost; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class ActivitiesApi { + private ApiClient apiClient; + + public ActivitiesApi() { + this(Configuration.getDefaultApiClient()); + } + + public ActivitiesApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Post Activity + * Notify Sunshine Conversations of different conversation activities. Supported activity types are: * Typing activity * Conversation read event + * @param activityPost (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object postActivity(ActivityPost activityPost, String appId, String conversationId) throws ApiException { + Object localVarPostBody = activityPost; + + // verify the required parameter 'activityPost' is set + if (activityPost == null) { + throw new ApiException(400, "Missing the required parameter 'activityPost' when calling postActivity"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling postActivity"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling postActivity"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/activity".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * Post Activity + * Notify Sunshine Conversations of different conversation activities. Supported activity types are: * Typing activity * Conversation read event + * @param bearerToken a token to be used for this request (required) + * + * @param activityPost (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object postActivity(String bearerToken, ActivityPost activityPost, String appId, String conversationId) throws ApiException { + Object localVarPostBody = activityPost; + + // verify the required parameter 'activityPost' is set + if (activityPost == null) { + throw new ApiException(400, "Missing the required parameter 'activityPost' when calling postActivity"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling postActivity"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling postActivity"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/activity".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/api/AppKeysApi.java b/src/main/java/com/zendesk/sunshine_conversations_client/api/AppKeysApi.java new file mode 100644 index 00000000..5ef35369 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/api/AppKeysApi.java @@ -0,0 +1,448 @@ +package com.zendesk.sunshine_conversations_client.api; + +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.Pair; + +import javax.ws.rs.core.GenericType; + +import com.zendesk.sunshine_conversations_client.model.AppKeyCreateBody; +import com.zendesk.sunshine_conversations_client.model.AppKeyListResponse; +import com.zendesk.sunshine_conversations_client.model.AppKeyResponse; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class AppKeysApi { + private ApiClient apiClient; + + public AppKeysApi() { + this(Configuration.getDefaultApiClient()); + } + + public AppKeysApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * 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. + * @param appKeyCreateBody (required) + * @param appId Identifies the app. (required) + * @return a {@code AppKeyResponse} + * @throws ApiException if fails to make API call + */ + public AppKeyResponse createAppKey(AppKeyCreateBody appKeyCreateBody, String appId) throws ApiException { + Object localVarPostBody = appKeyCreateBody; + + // verify the required parameter 'appKeyCreateBody' is set + if (appKeyCreateBody == null) { + throw new ApiException(400, "Missing the required parameter 'appKeyCreateBody' when calling createAppKey"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createAppKey"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/keys".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Delete App Key + * Removes an API key. + * @param appId Identifies the app. (required) + * @param keyId The id of the key. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteAppKey(String appId, String keyId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteAppKey"); + } + + // verify the required parameter 'keyId' is set + if (keyId == null) { + throw new ApiException(400, "Missing the required parameter 'keyId' when calling deleteAppKey"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/keys/{keyId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "keyId" + "\\}", apiClient.escapeString(keyId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Get App Key + * Returns an API key. + * @param appId Identifies the app. (required) + * @param keyId The id of the key. (required) + * @return a {@code AppKeyResponse} + * @throws ApiException if fails to make API call + */ + public AppKeyResponse getAppKey(String appId, String keyId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling getAppKey"); + } + + // verify the required parameter 'keyId' is set + if (keyId == null) { + throw new ApiException(400, "Missing the required parameter 'keyId' when calling getAppKey"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/keys/{keyId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "keyId" + "\\}", apiClient.escapeString(keyId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * List App Keys + * Lists all API keys for a given app. + * @param appId Identifies the app. (required) + * @return a {@code AppKeyListResponse} + * @throws ApiException if fails to make API call + */ + public AppKeyListResponse listAppKeys(String appId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listAppKeys"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/keys".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * 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. + * @param bearerToken a token to be used for this request (required) + * + * @param appKeyCreateBody (required) + * @param appId Identifies the app. (required) + * @return a {@code AppKeyResponse} + * @throws ApiException if fails to make API call + */ + public AppKeyResponse createAppKey(String bearerToken, AppKeyCreateBody appKeyCreateBody, String appId) throws ApiException { + Object localVarPostBody = appKeyCreateBody; + + // verify the required parameter 'appKeyCreateBody' is set + if (appKeyCreateBody == null) { + throw new ApiException(400, "Missing the required parameter 'appKeyCreateBody' when calling createAppKey"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createAppKey"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/keys".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Delete App Key + * Removes an API key. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param keyId The id of the key. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteAppKey(String bearerToken, String appId, String keyId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteAppKey"); + } + + // verify the required parameter 'keyId' is set + if (keyId == null) { + throw new ApiException(400, "Missing the required parameter 'keyId' when calling deleteAppKey"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/keys/{keyId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "keyId" + "\\}", apiClient.escapeString(keyId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Get App Key + * Returns an API key. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param keyId The id of the key. (required) + * @return a {@code AppKeyResponse} + * @throws ApiException if fails to make API call + */ + public AppKeyResponse getAppKey(String bearerToken, String appId, String keyId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling getAppKey"); + } + + // verify the required parameter 'keyId' is set + if (keyId == null) { + throw new ApiException(400, "Missing the required parameter 'keyId' when calling getAppKey"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/keys/{keyId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "keyId" + "\\}", apiClient.escapeString(keyId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * List App Keys + * Lists all API keys for a given app. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @return a {@code AppKeyListResponse} + * @throws ApiException if fails to make API call + */ + public AppKeyListResponse listAppKeys(String bearerToken, String appId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listAppKeys"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/keys".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/api/AppsApi.java b/src/main/java/com/zendesk/sunshine_conversations_client/api/AppsApi.java new file mode 100644 index 00000000..a8a31dd7 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/api/AppsApi.java @@ -0,0 +1,507 @@ +package com.zendesk.sunshine_conversations_client.api; + +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.Pair; + +import javax.ws.rs.core.GenericType; + +import com.zendesk.sunshine_conversations_client.model.AppCreateBody; +import com.zendesk.sunshine_conversations_client.model.AppListFilter; +import com.zendesk.sunshine_conversations_client.model.AppListResponse; +import com.zendesk.sunshine_conversations_client.model.AppResponse; +import com.zendesk.sunshine_conversations_client.model.AppUpdateBody; +import com.zendesk.sunshine_conversations_client.model.Page; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class AppsApi { + private ApiClient apiClient; + + public AppsApi() { + this(Configuration.getDefaultApiClient()); + } + + public AppsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create App + * Creates a new app. When using [service account](#service-accounts) credentials, the service account is automatically granted access to the app. + * @param appCreateBody (required) + * @return a {@code AppResponse} + * @throws ApiException if fails to make API call + */ + public AppResponse createApp(AppCreateBody appCreateBody) throws ApiException { + Object localVarPostBody = appCreateBody; + + // verify the required parameter 'appCreateBody' is set + if (appCreateBody == null) { + throw new ApiException(400, "Missing the required parameter 'appCreateBody' when calling createApp"); + } + + // create path and map variables + String localVarPath = "/v2/apps".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Delete App + * Removes the specified app, including all its enabled integrations. + * @param appId Identifies the app. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteApp(String appId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteApp"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Get App + * Fetches an individual app. + * @param appId Identifies the app. (required) + * @return a {@code AppResponse} + * @throws ApiException if fails to make API call + */ + public AppResponse getApp(String appId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling getApp"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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 ``` + * @param page Contains parameters for applying cursor pagination. (optional) + * @param filter Contains parameters for filtering the results. (optional) + * @return a {@code AppListResponse} + * @throws ApiException if fails to make API call + */ + public AppListResponse listApps(Page page, AppListFilter filter) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v2/apps".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter)); + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Update App + * Updates an app. + * @param appUpdateBody (required) + * @param appId Identifies the app. (required) + * @return a {@code AppResponse} + * @throws ApiException if fails to make API call + */ + public AppResponse updateApp(AppUpdateBody appUpdateBody, String appId) throws ApiException { + Object localVarPostBody = appUpdateBody; + + // verify the required parameter 'appUpdateBody' is set + if (appUpdateBody == null) { + throw new ApiException(400, "Missing the required parameter 'appUpdateBody' when calling updateApp"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling updateApp"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * Create App + * Creates a new app. When using [service account](#service-accounts) credentials, the service account is automatically granted access to the app. + * @param bearerToken a token to be used for this request (required) + * + * @param appCreateBody (required) + * @return a {@code AppResponse} + * @throws ApiException if fails to make API call + */ + public AppResponse createApp(String bearerToken, AppCreateBody appCreateBody) throws ApiException { + Object localVarPostBody = appCreateBody; + + // verify the required parameter 'appCreateBody' is set + if (appCreateBody == null) { + throw new ApiException(400, "Missing the required parameter 'appCreateBody' when calling createApp"); + } + + // create path and map variables + String localVarPath = "/v2/apps".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Delete App + * Removes the specified app, including all its enabled integrations. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteApp(String bearerToken, String appId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteApp"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Get App + * Fetches an individual app. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @return a {@code AppResponse} + * @throws ApiException if fails to make API call + */ + public AppResponse getApp(String bearerToken, String appId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling getApp"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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 ``` + * @param bearerToken a token to be used for this request (required) + * + * @param page Contains parameters for applying cursor pagination. (optional) + * @param filter Contains parameters for filtering the results. (optional) + * @return a {@code AppListResponse} + * @throws ApiException if fails to make API call + */ + public AppListResponse listApps(String bearerToken, Page page, AppListFilter filter) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v2/apps".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter)); + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Update App + * Updates an app. + * @param bearerToken a token to be used for this request (required) + * + * @param appUpdateBody (required) + * @param appId Identifies the app. (required) + * @return a {@code AppResponse} + * @throws ApiException if fails to make API call + */ + public AppResponse updateApp(String bearerToken, AppUpdateBody appUpdateBody, String appId) throws ApiException { + Object localVarPostBody = appUpdateBody; + + // verify the required parameter 'appUpdateBody' is set + if (appUpdateBody == null) { + throw new ApiException(400, "Missing the required parameter 'appUpdateBody' when calling updateApp"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling updateApp"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/api/AttachmentsApi.java b/src/main/java/com/zendesk/sunshine_conversations_client/api/AttachmentsApi.java new file mode 100644 index 00000000..7f46a2a9 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/api/AttachmentsApi.java @@ -0,0 +1,472 @@ +package com.zendesk.sunshine_conversations_client.api; + +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.Pair; + +import javax.ws.rs.core.GenericType; + +import com.zendesk.sunshine_conversations_client.model.AttachmentDeleteBody; +import com.zendesk.sunshine_conversations_client.model.AttachmentMediaTokenBody; +import com.zendesk.sunshine_conversations_client.model.AttachmentMediaTokenResponse; +import com.zendesk.sunshine_conversations_client.model.AttachmentResponse; +import java.io.File; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class AttachmentsApi { + private ApiClient apiClient; + + public AttachmentsApi() { + this(Configuration.getDefaultApiClient()); + } + + public AttachmentsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * 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> + * @param attachmentDeleteBody (required) + * @param appId Identifies the app. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteAttachment(AttachmentDeleteBody attachmentDeleteBody, String appId) throws ApiException { + Object localVarPostBody = attachmentDeleteBody; + + // verify the required parameter 'attachmentDeleteBody' is set + if (attachmentDeleteBody == null) { + throw new ApiException(400, "Missing the required parameter 'attachmentDeleteBody' when calling deleteAttachment"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteAttachment"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/attachments/remove".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Generate Media Token + * Generates a media JWT for a list of attachment paths. This media token is a prerequisite for setting the cookie needed to visualize a private attachment. <aside class=\"notice\">Note you have the ability to allow files using different rules, see <a href=\"https://docs.smooch.io/guide/private-attachments\">Private Attachments</a> for more details.</aside> + * @param attachmentMediaTokenBody (required) + * @param appId Identifies the app. (required) + * @return a {@code AttachmentMediaTokenResponse} + * @throws ApiException if fails to make API call + */ + public AttachmentMediaTokenResponse generateMediaJsonWebToken(AttachmentMediaTokenBody attachmentMediaTokenBody, String appId) throws ApiException { + Object localVarPostBody = attachmentMediaTokenBody; + + // verify the required parameter 'attachmentMediaTokenBody' is set + if (attachmentMediaTokenBody == null) { + throw new ApiException(400, "Missing the required parameter 'attachmentMediaTokenBody' when calling generateMediaJsonWebToken"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling generateMediaJsonWebToken"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/attachments/token".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Set Cookie + * With the media JWT retrieved, pass it in the header of the below request as it’s authorization in order to set a cookie in the user’s browser corresponding to the path within the media JWT. The expiration date of this cookie will match the expiration date of the media JWT. This cookie will be needed to visualize a private attachment. + * @param appId Identifies the app. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object setCookie(String appId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling setCookie"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/attachments/cookie".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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> + * @param source (required) + * @param appId Identifies the app. (required) + * @param access The access level for the attachment. Currently the available access levels are public and private. (required) + * @param _for Specifies the intended container for the attachment, to enable automatic attachment deletion (on deletion of associated message, conversation or user). For now, only message is supported. See [Attachments for Messages](#section/Attachments-for-Messages) for details. (optional) + * @param conversationId Links the attachment getting uploaded to the conversation ID. (optional) + * @return a {@code AttachmentResponse} + * @throws ApiException if fails to make API call + */ + public AttachmentResponse uploadAttachment(File source, String appId, String access, String _for, String conversationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'source' is set + if (source == null) { + throw new ApiException(400, "Missing the required parameter 'source' when calling uploadAttachment"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling uploadAttachment"); + } + + // verify the required parameter 'access' is set + if (access == null) { + throw new ApiException(400, "Missing the required parameter 'access' when calling uploadAttachment"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/attachments".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "access", access)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "for", _for)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "conversationId", conversationId)); + + + + if (source != null) + localVarFormParams.put("source", source); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * 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> + * @param bearerToken a token to be used for this request (required) + * + * @param attachmentDeleteBody (required) + * @param appId Identifies the app. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteAttachment(String bearerToken, AttachmentDeleteBody attachmentDeleteBody, String appId) throws ApiException { + Object localVarPostBody = attachmentDeleteBody; + + // verify the required parameter 'attachmentDeleteBody' is set + if (attachmentDeleteBody == null) { + throw new ApiException(400, "Missing the required parameter 'attachmentDeleteBody' when calling deleteAttachment"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteAttachment"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/attachments/remove".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Generate Media Token + * Generates a media JWT for a list of attachment paths. This media token is a prerequisite for setting the cookie needed to visualize a private attachment. <aside class=\"notice\">Note you have the ability to allow files using different rules, see <a href=\"https://docs.smooch.io/guide/private-attachments\">Private Attachments</a> for more details.</aside> + * @param bearerToken a token to be used for this request (required) + * + * @param attachmentMediaTokenBody (required) + * @param appId Identifies the app. (required) + * @return a {@code AttachmentMediaTokenResponse} + * @throws ApiException if fails to make API call + */ + public AttachmentMediaTokenResponse generateMediaJsonWebToken(String bearerToken, AttachmentMediaTokenBody attachmentMediaTokenBody, String appId) throws ApiException { + Object localVarPostBody = attachmentMediaTokenBody; + + // verify the required parameter 'attachmentMediaTokenBody' is set + if (attachmentMediaTokenBody == null) { + throw new ApiException(400, "Missing the required parameter 'attachmentMediaTokenBody' when calling generateMediaJsonWebToken"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling generateMediaJsonWebToken"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/attachments/token".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Set Cookie + * With the media JWT retrieved, pass it in the header of the below request as it’s authorization in order to set a cookie in the user’s browser corresponding to the path within the media JWT. The expiration date of this cookie will match the expiration date of the media JWT. This cookie will be needed to visualize a private attachment. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object setCookie(String bearerToken, String appId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling setCookie"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/attachments/cookie".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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> + * @param bearerToken a token to be used for this request (required) + * + * @param source (required) + * @param appId Identifies the app. (required) + * @param access The access level for the attachment. Currently the available access levels are public and private. (required) + * @param _for Specifies the intended container for the attachment, to enable automatic attachment deletion (on deletion of associated message, conversation or user). For now, only message is supported. See [Attachments for Messages](#section/Attachments-for-Messages) for details. (optional) + * @param conversationId Links the attachment getting uploaded to the conversation ID. (optional) + * @return a {@code AttachmentResponse} + * @throws ApiException if fails to make API call + */ + public AttachmentResponse uploadAttachment(String bearerToken, File source, String appId, String access, String _for, String conversationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'source' is set + if (source == null) { + throw new ApiException(400, "Missing the required parameter 'source' when calling uploadAttachment"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling uploadAttachment"); + } + + // verify the required parameter 'access' is set + if (access == null) { + throw new ApiException(400, "Missing the required parameter 'access' when calling uploadAttachment"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/attachments".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "access", access)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "for", _for)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "conversationId", conversationId)); + + + + if (source != null) + localVarFormParams.put("source", source); + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/api/ClientsApi.java b/src/main/java/com/zendesk/sunshine_conversations_client/api/ClientsApi.java new file mode 100644 index 00000000..3e66623d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/api/ClientsApi.java @@ -0,0 +1,389 @@ +package com.zendesk.sunshine_conversations_client.api; + +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.Pair; + +import javax.ws.rs.core.GenericType; + +import com.zendesk.sunshine_conversations_client.model.ClientCreate; +import com.zendesk.sunshine_conversations_client.model.ClientListResponse; +import com.zendesk.sunshine_conversations_client.model.ClientResponse; +import com.zendesk.sunshine_conversations_client.model.Page; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class ClientsApi { + private ApiClient apiClient; + + public ClientsApi() { + this(Configuration.getDefaultApiClient()); + } + + public ClientsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create Client + * Create a client and link it to a channel specified by the matchCriteria.type. + * @param clientCreate (required) + * @param appId Identifies the app. (required) + * @param userIdOrExternalId The user's id or externalId. (required) + * @return a {@code ClientResponse} + * @throws ApiException if fails to make API call + */ + public ClientResponse createClient(ClientCreate clientCreate, String appId, String userIdOrExternalId) throws ApiException { + Object localVarPostBody = clientCreate; + + // verify the required parameter 'clientCreate' is set + if (clientCreate == null) { + throw new ApiException(400, "Missing the required parameter 'clientCreate' when calling createClient"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createClient"); + } + + // verify the required parameter 'userIdOrExternalId' is set + if (userIdOrExternalId == null) { + throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling createClient"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}/clients".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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 ``` + * @param appId Identifies the app. (required) + * @param userIdOrExternalId The user's id or externalId. (required) + * @param page Contains parameters for applying cursor pagination. (optional) + * @return a {@code ClientListResponse} + * @throws ApiException if fails to make API call + */ + public ClientListResponse listClients(String appId, String userIdOrExternalId, Page page) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listClients"); + } + + // verify the required parameter 'userIdOrExternalId' is set + if (userIdOrExternalId == null) { + throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling listClients"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}/clients".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Remove Client + * Remove a particular client and unsubscribe it from all connected conversations. + * @param appId Identifies the app. (required) + * @param userIdOrExternalId The user's id or externalId. (required) + * @param clientId The client's id. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object removeClient(String appId, String userIdOrExternalId, String clientId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling removeClient"); + } + + // verify the required parameter 'userIdOrExternalId' is set + if (userIdOrExternalId == null) { + throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling removeClient"); + } + + // verify the required parameter 'clientId' is set + if (clientId == null) { + throw new ApiException(400, "Missing the required parameter 'clientId' when calling removeClient"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}/clients/{clientId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.toString())) + .replaceAll("\\{" + "clientId" + "\\}", apiClient.escapeString(clientId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * Create Client + * Create a client and link it to a channel specified by the matchCriteria.type. + * @param bearerToken a token to be used for this request (required) + * + * @param clientCreate (required) + * @param appId Identifies the app. (required) + * @param userIdOrExternalId The user's id or externalId. (required) + * @return a {@code ClientResponse} + * @throws ApiException if fails to make API call + */ + public ClientResponse createClient(String bearerToken, ClientCreate clientCreate, String appId, String userIdOrExternalId) throws ApiException { + Object localVarPostBody = clientCreate; + + // verify the required parameter 'clientCreate' is set + if (clientCreate == null) { + throw new ApiException(400, "Missing the required parameter 'clientCreate' when calling createClient"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createClient"); + } + + // verify the required parameter 'userIdOrExternalId' is set + if (userIdOrExternalId == null) { + throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling createClient"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}/clients".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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 ``` + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param userIdOrExternalId The user's id or externalId. (required) + * @param page Contains parameters for applying cursor pagination. (optional) + * @return a {@code ClientListResponse} + * @throws ApiException if fails to make API call + */ + public ClientListResponse listClients(String bearerToken, String appId, String userIdOrExternalId, Page page) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listClients"); + } + + // verify the required parameter 'userIdOrExternalId' is set + if (userIdOrExternalId == null) { + throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling listClients"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}/clients".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Remove Client + * Remove a particular client and unsubscribe it from all connected conversations. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param userIdOrExternalId The user's id or externalId. (required) + * @param clientId The client's id. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object removeClient(String bearerToken, String appId, String userIdOrExternalId, String clientId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling removeClient"); + } + + // verify the required parameter 'userIdOrExternalId' is set + if (userIdOrExternalId == null) { + throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling removeClient"); + } + + // verify the required parameter 'clientId' is set + if (clientId == null) { + throw new ApiException(400, "Missing the required parameter 'clientId' when calling removeClient"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}/clients/{clientId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.toString())) + .replaceAll("\\{" + "clientId" + "\\}", apiClient.escapeString(clientId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/api/ConversationsApi.java b/src/main/java/com/zendesk/sunshine_conversations_client/api/ConversationsApi.java new file mode 100644 index 00000000..ba8e8499 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/api/ConversationsApi.java @@ -0,0 +1,587 @@ +package com.zendesk.sunshine_conversations_client.api; + +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.Pair; + +import javax.ws.rs.core.GenericType; + +import com.zendesk.sunshine_conversations_client.model.ConversationCreateBody; +import com.zendesk.sunshine_conversations_client.model.ConversationListFilter; +import com.zendesk.sunshine_conversations_client.model.ConversationListResponse; +import com.zendesk.sunshine_conversations_client.model.ConversationResponse; +import com.zendesk.sunshine_conversations_client.model.ConversationUpdateBody; +import com.zendesk.sunshine_conversations_client.model.Page; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class ConversationsApi { + private ApiClient apiClient; + + public ConversationsApi() { + this(Configuration.getDefaultApiClient()); + } + + public ConversationsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create Conversation + * Create a conversation for the specified user(s). + * @param conversationCreateBody (required) + * @param appId Identifies the app. (required) + * @return a {@code ConversationResponse} + * @throws ApiException if fails to make API call + */ + public ConversationResponse createConversation(ConversationCreateBody conversationCreateBody, String appId) throws ApiException { + Object localVarPostBody = conversationCreateBody; + + // verify the required parameter 'conversationCreateBody' is set + if (conversationCreateBody == null) { + throw new ApiException(400, "Missing the required parameter 'conversationCreateBody' when calling createConversation"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createConversation"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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). + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteConversation(String appId, String conversationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteConversation"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling deleteConversation"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Get Conversation + * Fetches an individual conversation. + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code ConversationResponse} + * @throws ApiException if fails to make API call + */ + public ConversationResponse getConversation(String appId, String conversationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling getConversation"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling getConversation"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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 ``` + * @param appId Identifies the app. (required) + * @param filter Contains parameters for filtering the results. (required) + * @param page Contains parameters for applying cursor pagination. (optional) + * @return a {@code ConversationListResponse} + * @throws ApiException if fails to make API call + */ + public ConversationListResponse listConversations(String appId, ConversationListFilter filter, Page page) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listConversations"); + } + + // verify the required parameter 'filter' is set + if (filter == null) { + throw new ApiException(400, "Missing the required parameter 'filter' when calling listConversations"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter)); + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Update Conversation + * Updates a conversation record. + * @param conversationUpdateBody (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code ConversationResponse} + * @throws ApiException if fails to make API call + */ + public ConversationResponse updateConversation(ConversationUpdateBody conversationUpdateBody, String appId, String conversationId) throws ApiException { + Object localVarPostBody = conversationUpdateBody; + + // verify the required parameter 'conversationUpdateBody' is set + if (conversationUpdateBody == null) { + throw new ApiException(400, "Missing the required parameter 'conversationUpdateBody' when calling updateConversation"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling updateConversation"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling updateConversation"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * Create Conversation + * Create a conversation for the specified user(s). + * @param bearerToken a token to be used for this request (required) + * + * @param conversationCreateBody (required) + * @param appId Identifies the app. (required) + * @return a {@code ConversationResponse} + * @throws ApiException if fails to make API call + */ + public ConversationResponse createConversation(String bearerToken, ConversationCreateBody conversationCreateBody, String appId) throws ApiException { + Object localVarPostBody = conversationCreateBody; + + // verify the required parameter 'conversationCreateBody' is set + if (conversationCreateBody == null) { + throw new ApiException(400, "Missing the required parameter 'conversationCreateBody' when calling createConversation"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createConversation"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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). + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteConversation(String bearerToken, String appId, String conversationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteConversation"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling deleteConversation"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Get Conversation + * Fetches an individual conversation. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code ConversationResponse} + * @throws ApiException if fails to make API call + */ + public ConversationResponse getConversation(String bearerToken, String appId, String conversationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling getConversation"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling getConversation"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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 ``` + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param filter Contains parameters for filtering the results. (required) + * @param page Contains parameters for applying cursor pagination. (optional) + * @return a {@code ConversationListResponse} + * @throws ApiException if fails to make API call + */ + public ConversationListResponse listConversations(String bearerToken, String appId, ConversationListFilter filter, Page page) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listConversations"); + } + + // verify the required parameter 'filter' is set + if (filter == null) { + throw new ApiException(400, "Missing the required parameter 'filter' when calling listConversations"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter)); + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Update Conversation + * Updates a conversation record. + * @param bearerToken a token to be used for this request (required) + * + * @param conversationUpdateBody (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code ConversationResponse} + * @throws ApiException if fails to make API call + */ + public ConversationResponse updateConversation(String bearerToken, ConversationUpdateBody conversationUpdateBody, String appId, String conversationId) throws ApiException { + Object localVarPostBody = conversationUpdateBody; + + // verify the required parameter 'conversationUpdateBody' is set + if (conversationUpdateBody == null) { + throw new ApiException(400, "Missing the required parameter 'conversationUpdateBody' when calling updateConversation"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling updateConversation"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling updateConversation"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/api/CustomIntegrationApiKeysApi.java b/src/main/java/com/zendesk/sunshine_conversations_client/api/CustomIntegrationApiKeysApi.java new file mode 100644 index 00000000..a01de312 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/api/CustomIntegrationApiKeysApi.java @@ -0,0 +1,504 @@ +package com.zendesk.sunshine_conversations_client.api; + +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.Pair; + +import javax.ws.rs.core.GenericType; + +import com.zendesk.sunshine_conversations_client.model.IntegrationApiKey; +import com.zendesk.sunshine_conversations_client.model.IntegrationApiKeyListResponse; +import com.zendesk.sunshine_conversations_client.model.IntegrationApiKeyResponse; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class CustomIntegrationApiKeysApi { + private ApiClient apiClient; + + public CustomIntegrationApiKeysApi() { + this(Configuration.getDefaultApiClient()); + } + + public CustomIntegrationApiKeysApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * 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. + * @param integrationApiKey (required) + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @return a {@code IntegrationApiKeyResponse} + * @throws ApiException if fails to make API call + */ + public IntegrationApiKeyResponse createCustomIntegrationKey(IntegrationApiKey integrationApiKey, String appId, String integrationId) throws ApiException { + Object localVarPostBody = integrationApiKey; + + // verify the required parameter 'integrationApiKey' is set + if (integrationApiKey == null) { + throw new ApiException(400, "Missing the required parameter 'integrationApiKey' when calling createCustomIntegrationKey"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createCustomIntegrationKey"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling createCustomIntegrationKey"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/keys".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Delete Integration Key + * Removes an API key. + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @param keyId The id of the key. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteCustomIntegrationKey(String appId, String integrationId, String keyId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteCustomIntegrationKey"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling deleteCustomIntegrationKey"); + } + + // verify the required parameter 'keyId' is set + if (keyId == null) { + throw new ApiException(400, "Missing the required parameter 'keyId' when calling deleteCustomIntegrationKey"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/keys/{keyId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())) + .replaceAll("\\{" + "keyId" + "\\}", apiClient.escapeString(keyId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Get Integration Key + * Get the specified API key. + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @param keyId The id of the key. (required) + * @return a {@code IntegrationApiKeyResponse} + * @throws ApiException if fails to make API call + */ + public IntegrationApiKeyResponse getCustomIntegrationKey(String appId, String integrationId, String keyId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling getCustomIntegrationKey"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling getCustomIntegrationKey"); + } + + // verify the required parameter 'keyId' is set + if (keyId == null) { + throw new ApiException(400, "Missing the required parameter 'keyId' when calling getCustomIntegrationKey"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/keys/{keyId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())) + .replaceAll("\\{" + "keyId" + "\\}", apiClient.escapeString(keyId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * List Integration Keys + * Lists all API keys for a given integration. + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @return a {@code IntegrationApiKeyListResponse} + * @throws ApiException if fails to make API call + */ + public IntegrationApiKeyListResponse listCustomIntegrationKeys(String appId, String integrationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listCustomIntegrationKeys"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling listCustomIntegrationKeys"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/keys".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * 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. + * @param bearerToken a token to be used for this request (required) + * + * @param integrationApiKey (required) + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @return a {@code IntegrationApiKeyResponse} + * @throws ApiException if fails to make API call + */ + public IntegrationApiKeyResponse createCustomIntegrationKey(String bearerToken, IntegrationApiKey integrationApiKey, String appId, String integrationId) throws ApiException { + Object localVarPostBody = integrationApiKey; + + // verify the required parameter 'integrationApiKey' is set + if (integrationApiKey == null) { + throw new ApiException(400, "Missing the required parameter 'integrationApiKey' when calling createCustomIntegrationKey"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createCustomIntegrationKey"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling createCustomIntegrationKey"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/keys".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Delete Integration Key + * Removes an API key. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @param keyId The id of the key. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteCustomIntegrationKey(String bearerToken, String appId, String integrationId, String keyId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteCustomIntegrationKey"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling deleteCustomIntegrationKey"); + } + + // verify the required parameter 'keyId' is set + if (keyId == null) { + throw new ApiException(400, "Missing the required parameter 'keyId' when calling deleteCustomIntegrationKey"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/keys/{keyId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())) + .replaceAll("\\{" + "keyId" + "\\}", apiClient.escapeString(keyId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Get Integration Key + * Get the specified API key. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @param keyId The id of the key. (required) + * @return a {@code IntegrationApiKeyResponse} + * @throws ApiException if fails to make API call + */ + public IntegrationApiKeyResponse getCustomIntegrationKey(String bearerToken, String appId, String integrationId, String keyId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling getCustomIntegrationKey"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling getCustomIntegrationKey"); + } + + // verify the required parameter 'keyId' is set + if (keyId == null) { + throw new ApiException(400, "Missing the required parameter 'keyId' when calling getCustomIntegrationKey"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/keys/{keyId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())) + .replaceAll("\\{" + "keyId" + "\\}", apiClient.escapeString(keyId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * List Integration Keys + * Lists all API keys for a given integration. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @return a {@code IntegrationApiKeyListResponse} + * @throws ApiException if fails to make API call + */ + public IntegrationApiKeyListResponse listCustomIntegrationKeys(String bearerToken, String appId, String integrationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listCustomIntegrationKeys"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling listCustomIntegrationKeys"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/keys".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/api/IntegrationsApi.java b/src/main/java/com/zendesk/sunshine_conversations_client/api/IntegrationsApi.java new file mode 100644 index 00000000..a501d0a4 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/api/IntegrationsApi.java @@ -0,0 +1,577 @@ +package com.zendesk.sunshine_conversations_client.api; + +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.Pair; + +import javax.ws.rs.core.GenericType; + +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.IntegrationListFilter; +import com.zendesk.sunshine_conversations_client.model.IntegrationListResponse; +import com.zendesk.sunshine_conversations_client.model.IntegrationResponse; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdate; +import com.zendesk.sunshine_conversations_client.model.Page; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class IntegrationsApi { + private ApiClient apiClient; + + public IntegrationsApi() { + this(Configuration.getDefaultApiClient()); + } + + public IntegrationsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * 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. + * @param integration (required) + * @param appId Identifies the app. (required) + * @return a {@code IntegrationResponse} + * @throws ApiException if fails to make API call + */ + public IntegrationResponse createIntegration(Integration integration, String appId) throws ApiException { + Object localVarPostBody = integration; + + // verify the required parameter 'integration' is set + if (integration == null) { + throw new ApiException(400, "Missing the required parameter 'integration' when calling createIntegration"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createIntegration"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Delete Integration + * Delete the specified integration. + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteIntegration(String appId, String integrationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteIntegration"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling deleteIntegration"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Get Integration + * Get integration. + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @return a {@code IntegrationResponse} + * @throws ApiException if fails to make API call + */ + public IntegrationResponse getIntegration(String appId, String integrationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling getIntegration"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling getIntegration"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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 ``` + * @param appId Identifies the app. (required) + * @param page Contains parameters for applying cursor pagination. (optional) + * @param filter Contains parameters for filtering the results. (optional) + * @return a {@code IntegrationListResponse} + * @throws ApiException if fails to make API call + */ + public IntegrationListResponse listIntegrations(String appId, Page page, IntegrationListFilter filter) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listIntegrations"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter)); + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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. + * @param integrationUpdate (required) + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @return a {@code IntegrationResponse} + * @throws ApiException if fails to make API call + */ + public IntegrationResponse updateIntegration(IntegrationUpdate integrationUpdate, String appId, String integrationId) throws ApiException { + Object localVarPostBody = integrationUpdate; + + // verify the required parameter 'integrationUpdate' is set + if (integrationUpdate == null) { + throw new ApiException(400, "Missing the required parameter 'integrationUpdate' when calling updateIntegration"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling updateIntegration"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling updateIntegration"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * 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. + * @param bearerToken a token to be used for this request (required) + * + * @param integration (required) + * @param appId Identifies the app. (required) + * @return a {@code IntegrationResponse} + * @throws ApiException if fails to make API call + */ + public IntegrationResponse createIntegration(String bearerToken, Integration integration, String appId) throws ApiException { + Object localVarPostBody = integration; + + // verify the required parameter 'integration' is set + if (integration == null) { + throw new ApiException(400, "Missing the required parameter 'integration' when calling createIntegration"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createIntegration"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Delete Integration + * Delete the specified integration. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteIntegration(String bearerToken, String appId, String integrationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteIntegration"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling deleteIntegration"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Get Integration + * Get integration. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @return a {@code IntegrationResponse} + * @throws ApiException if fails to make API call + */ + public IntegrationResponse getIntegration(String bearerToken, String appId, String integrationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling getIntegration"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling getIntegration"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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 ``` + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param page Contains parameters for applying cursor pagination. (optional) + * @param filter Contains parameters for filtering the results. (optional) + * @return a {@code IntegrationListResponse} + * @throws ApiException if fails to make API call + */ + public IntegrationListResponse listIntegrations(String bearerToken, String appId, Page page, IntegrationListFilter filter) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listIntegrations"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter)); + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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. + * @param bearerToken a token to be used for this request (required) + * + * @param integrationUpdate (required) + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @return a {@code IntegrationResponse} + * @throws ApiException if fails to make API call + */ + public IntegrationResponse updateIntegration(String bearerToken, IntegrationUpdate integrationUpdate, String appId, String integrationId) throws ApiException { + Object localVarPostBody = integrationUpdate; + + // verify the required parameter 'integrationUpdate' is set + if (integrationUpdate == null) { + throw new ApiException(400, "Missing the required parameter 'integrationUpdate' when calling updateIntegration"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling updateIntegration"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling updateIntegration"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/api/MessagesApi.java b/src/main/java/com/zendesk/sunshine_conversations_client/api/MessagesApi.java new file mode 100644 index 00000000..572731ab --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/api/MessagesApi.java @@ -0,0 +1,495 @@ +package com.zendesk.sunshine_conversations_client.api; + +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.Pair; + +import javax.ws.rs.core.GenericType; + +import com.zendesk.sunshine_conversations_client.model.MessageListResponse; +import com.zendesk.sunshine_conversations_client.model.MessagePost; +import com.zendesk.sunshine_conversations_client.model.MessagePostResponse; +import com.zendesk.sunshine_conversations_client.model.Page; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class MessagesApi { + private ApiClient apiClient; + + public MessagesApi() { + this(Configuration.getDefaultApiClient()); + } + + public MessagesApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Delete All Messages + * Delete all messages of a particular conversation. + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteAllMessages(String appId, String conversationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteAllMessages"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling deleteAllMessages"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Delete Message + * Delete a single message of a particular conversation. + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @param messageId The id of the message. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteMessage(String appId, String conversationId, String messageId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteMessage"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling deleteMessage"); + } + + // verify the required parameter 'messageId' is set + if (messageId == null) { + throw new ApiException(400, "Missing the required parameter 'messageId' when calling deleteMessage"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages/{messageId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())) + .replaceAll("\\{" + "messageId" + "\\}", apiClient.escapeString(messageId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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 ``` + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @param page Contains parameters for applying cursor pagination. (optional) + * @return a {@code MessageListResponse} + * @throws ApiException if fails to make API call + */ + public MessageListResponse listMessages(String appId, String conversationId, Page page) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listMessages"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling listMessages"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Post Message + * Send a message in a particular conversation. + * @param messagePost (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code MessagePostResponse} + * @throws ApiException if fails to make API call + */ + public MessagePostResponse postMessage(MessagePost messagePost, String appId, String conversationId) throws ApiException { + Object localVarPostBody = messagePost; + + // verify the required parameter 'messagePost' is set + if (messagePost == null) { + throw new ApiException(400, "Missing the required parameter 'messagePost' when calling postMessage"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling postMessage"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling postMessage"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * Delete All Messages + * Delete all messages of a particular conversation. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteAllMessages(String bearerToken, String appId, String conversationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteAllMessages"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling deleteAllMessages"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Delete Message + * Delete a single message of a particular conversation. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @param messageId The id of the message. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteMessage(String bearerToken, String appId, String conversationId, String messageId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteMessage"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling deleteMessage"); + } + + // verify the required parameter 'messageId' is set + if (messageId == null) { + throw new ApiException(400, "Missing the required parameter 'messageId' when calling deleteMessage"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages/{messageId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())) + .replaceAll("\\{" + "messageId" + "\\}", apiClient.escapeString(messageId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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 ``` + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @param page Contains parameters for applying cursor pagination. (optional) + * @return a {@code MessageListResponse} + * @throws ApiException if fails to make API call + */ + public MessageListResponse listMessages(String bearerToken, String appId, String conversationId, Page page) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listMessages"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling listMessages"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Post Message + * Send a message in a particular conversation. + * @param bearerToken a token to be used for this request (required) + * + * @param messagePost (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code MessagePostResponse} + * @throws ApiException if fails to make API call + */ + public MessagePostResponse postMessage(String bearerToken, MessagePost messagePost, String appId, String conversationId) throws ApiException { + Object localVarPostBody = messagePost; + + // verify the required parameter 'messagePost' is set + if (messagePost == null) { + throw new ApiException(400, "Missing the required parameter 'messagePost' when calling postMessage"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling postMessage"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling postMessage"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/api/ParticipantsApi.java b/src/main/java/com/zendesk/sunshine_conversations_client/api/ParticipantsApi.java new file mode 100644 index 00000000..56d8cada --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/api/ParticipantsApi.java @@ -0,0 +1,389 @@ +package com.zendesk.sunshine_conversations_client.api; + +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.Pair; + +import javax.ws.rs.core.GenericType; + +import com.zendesk.sunshine_conversations_client.model.Page; +import com.zendesk.sunshine_conversations_client.model.ParticipantJoinBody; +import com.zendesk.sunshine_conversations_client.model.ParticipantLeaveBody; +import com.zendesk.sunshine_conversations_client.model.ParticipantListResponse; +import com.zendesk.sunshine_conversations_client.model.ParticipantResponse; +import com.zendesk.sunshine_conversations_client.model.ParticipantSubSchema; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class ParticipantsApi { + private ApiClient apiClient; + + public ParticipantsApi() { + this(Configuration.getDefaultApiClient()); + } + + public ParticipantsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * 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. + * @param participantJoinBody (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code ParticipantResponse} + * @throws ApiException if fails to make API call + */ + public ParticipantResponse joinConversation(ParticipantJoinBody participantJoinBody, String appId, String conversationId) throws ApiException { + Object localVarPostBody = participantJoinBody; + + // verify the required parameter 'participantJoinBody' is set + if (participantJoinBody == null) { + throw new ApiException(400, "Missing the required parameter 'participantJoinBody' when calling joinConversation"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling joinConversation"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling joinConversation"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/join".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Leave Conversation + * Removes a user from a conversation using either their userId, userExternalId, or participantId. + * @param participantLeaveBody (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object leaveConversation(ParticipantLeaveBody participantLeaveBody, String appId, String conversationId) throws ApiException { + Object localVarPostBody = participantLeaveBody; + + // verify the required parameter 'participantLeaveBody' is set + if (participantLeaveBody == null) { + throw new ApiException(400, "Missing the required parameter 'participantLeaveBody' when calling leaveConversation"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling leaveConversation"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling leaveConversation"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/leave".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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 ``` + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @param page Contains parameters for applying cursor pagination. (optional) + * @return a {@code ParticipantListResponse} + * @throws ApiException if fails to make API call + */ + public ParticipantListResponse listParticipants(String appId, String conversationId, Page page) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listParticipants"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling listParticipants"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/participants".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * 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. + * @param bearerToken a token to be used for this request (required) + * + * @param participantJoinBody (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code ParticipantResponse} + * @throws ApiException if fails to make API call + */ + public ParticipantResponse joinConversation(String bearerToken, ParticipantJoinBody participantJoinBody, String appId, String conversationId) throws ApiException { + Object localVarPostBody = participantJoinBody; + + // verify the required parameter 'participantJoinBody' is set + if (participantJoinBody == null) { + throw new ApiException(400, "Missing the required parameter 'participantJoinBody' when calling joinConversation"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling joinConversation"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling joinConversation"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/join".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Leave Conversation + * Removes a user from a conversation using either their userId, userExternalId, or participantId. + * @param bearerToken a token to be used for this request (required) + * + * @param participantLeaveBody (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object leaveConversation(String bearerToken, ParticipantLeaveBody participantLeaveBody, String appId, String conversationId) throws ApiException { + Object localVarPostBody = participantLeaveBody; + + // verify the required parameter 'participantLeaveBody' is set + if (participantLeaveBody == null) { + throw new ApiException(400, "Missing the required parameter 'participantLeaveBody' when calling leaveConversation"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling leaveConversation"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling leaveConversation"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/leave".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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 ``` + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @param page Contains parameters for applying cursor pagination. (optional) + * @return a {@code ParticipantListResponse} + * @throws ApiException if fails to make API call + */ + public ParticipantListResponse listParticipants(String bearerToken, String appId, String conversationId, Page page) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listParticipants"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling listParticipants"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/participants".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/api/SwitchboardActionsApi.java b/src/main/java/com/zendesk/sunshine_conversations_client/api/SwitchboardActionsApi.java new file mode 100644 index 00000000..bd15162f --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/api/SwitchboardActionsApi.java @@ -0,0 +1,394 @@ +package com.zendesk.sunshine_conversations_client.api; + +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.Pair; + +import javax.ws.rs.core.GenericType; + +import com.zendesk.sunshine_conversations_client.model.AcceptControlBody; +import com.zendesk.sunshine_conversations_client.model.OfferControlBody; +import com.zendesk.sunshine_conversations_client.model.PassControlBody; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class SwitchboardActionsApi { + private ApiClient apiClient; + + public SwitchboardActionsApi() { + this(Configuration.getDefaultApiClient()); + } + + public SwitchboardActionsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * 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. + * @param acceptControlBody (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object acceptControl(AcceptControlBody acceptControlBody, String appId, String conversationId) throws ApiException { + Object localVarPostBody = acceptControlBody; + + // verify the required parameter 'acceptControlBody' is set + if (acceptControlBody == null) { + throw new ApiException(400, "Missing the required parameter 'acceptControlBody' when calling acceptControl"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling acceptControl"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling acceptControl"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/acceptControl".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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. + * @param offerControlBody (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object offerControl(OfferControlBody offerControlBody, String appId, String conversationId) throws ApiException { + Object localVarPostBody = offerControlBody; + + // verify the required parameter 'offerControlBody' is set + if (offerControlBody == null) { + throw new ApiException(400, "Missing the required parameter 'offerControlBody' when calling offerControl"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling offerControl"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling offerControl"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/offerControl".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Pass Control + * Mark the named switchboard integration as active and transition all the other switchboard integrations to standby status. + * @param passControlBody (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object passControl(PassControlBody passControlBody, String appId, String conversationId) throws ApiException { + Object localVarPostBody = passControlBody; + + // verify the required parameter 'passControlBody' is set + if (passControlBody == null) { + throw new ApiException(400, "Missing the required parameter 'passControlBody' when calling passControl"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling passControl"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling passControl"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/passControl".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * 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. + * @param bearerToken a token to be used for this request (required) + * + * @param acceptControlBody (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object acceptControl(String bearerToken, AcceptControlBody acceptControlBody, String appId, String conversationId) throws ApiException { + Object localVarPostBody = acceptControlBody; + + // verify the required parameter 'acceptControlBody' is set + if (acceptControlBody == null) { + throw new ApiException(400, "Missing the required parameter 'acceptControlBody' when calling acceptControl"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling acceptControl"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling acceptControl"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/acceptControl".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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. + * @param bearerToken a token to be used for this request (required) + * + * @param offerControlBody (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object offerControl(String bearerToken, OfferControlBody offerControlBody, String appId, String conversationId) throws ApiException { + Object localVarPostBody = offerControlBody; + + // verify the required parameter 'offerControlBody' is set + if (offerControlBody == null) { + throw new ApiException(400, "Missing the required parameter 'offerControlBody' when calling offerControl"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling offerControl"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling offerControl"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/offerControl".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Pass Control + * Mark the named switchboard integration as active and transition all the other switchboard integrations to standby status. + * @param bearerToken a token to be used for this request (required) + * + * @param passControlBody (required) + * @param appId Identifies the app. (required) + * @param conversationId Identifies the conversation. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object passControl(String bearerToken, PassControlBody passControlBody, String appId, String conversationId) throws ApiException { + Object localVarPostBody = passControlBody; + + // verify the required parameter 'passControlBody' is set + if (passControlBody == null) { + throw new ApiException(400, "Missing the required parameter 'passControlBody' when calling passControl"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling passControl"); + } + + // verify the required parameter 'conversationId' is set + if (conversationId == null) { + throw new ApiException(400, "Missing the required parameter 'conversationId' when calling passControl"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/passControl".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/api/SwitchboardIntegrationsApi.java b/src/main/java/com/zendesk/sunshine_conversations_client/api/SwitchboardIntegrationsApi.java new file mode 100644 index 00000000..f3dd783f --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/api/SwitchboardIntegrationsApi.java @@ -0,0 +1,517 @@ +package com.zendesk.sunshine_conversations_client.api; + +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.Pair; + +import javax.ws.rs.core.GenericType; + +import com.zendesk.sunshine_conversations_client.model.SwitchboardIntegrationCreateBody; +import com.zendesk.sunshine_conversations_client.model.SwitchboardIntegrationListResponse; +import com.zendesk.sunshine_conversations_client.model.SwitchboardIntegrationResponse; +import com.zendesk.sunshine_conversations_client.model.SwitchboardIntegrationUpdateBody; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class SwitchboardIntegrationsApi { + private ApiClient apiClient; + + public SwitchboardIntegrationsApi() { + this(Configuration.getDefaultApiClient()); + } + + public SwitchboardIntegrationsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create Switchboard Integration + * Create a switchboard integration. + * @param switchboardIntegrationCreateBody (required) + * @param appId Identifies the app. (required) + * @param switchboardId Identifies the switchboard. (required) + * @return a {@code SwitchboardIntegrationResponse} + * @throws ApiException if fails to make API call + */ + public SwitchboardIntegrationResponse createSwitchboardIntegration(SwitchboardIntegrationCreateBody switchboardIntegrationCreateBody, String appId, String switchboardId) throws ApiException { + Object localVarPostBody = switchboardIntegrationCreateBody; + + // verify the required parameter 'switchboardIntegrationCreateBody' is set + if (switchboardIntegrationCreateBody == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardIntegrationCreateBody' when calling createSwitchboardIntegration"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createSwitchboardIntegration"); + } + + // verify the required parameter 'switchboardId' is set + if (switchboardId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardId' when calling createSwitchboardIntegration"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "switchboardId" + "\\}", apiClient.escapeString(switchboardId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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. + * @param appId Identifies the app. (required) + * @param switchboardId Identifies the switchboard. (required) + * @param switchboardIntegrationId Identifies the switchboard integration. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteSwitchboardIntegration(String appId, String switchboardId, String switchboardIntegrationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteSwitchboardIntegration"); + } + + // verify the required parameter 'switchboardId' is set + if (switchboardId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardId' when calling deleteSwitchboardIntegration"); + } + + // verify the required parameter 'switchboardIntegrationId' is set + if (switchboardIntegrationId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardIntegrationId' when calling deleteSwitchboardIntegration"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations/{switchboardIntegrationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "switchboardId" + "\\}", apiClient.escapeString(switchboardId.toString())) + .replaceAll("\\{" + "switchboardIntegrationId" + "\\}", apiClient.escapeString(switchboardIntegrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * List Switchboard Integrations + * Lists all switchboard integrations linked to the switchboard. + * @param appId Identifies the app. (required) + * @param switchboardId Identifies the switchboard. (required) + * @return a {@code SwitchboardIntegrationListResponse} + * @throws ApiException if fails to make API call + */ + public SwitchboardIntegrationListResponse listSwitchboardIntegrations(String appId, String switchboardId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listSwitchboardIntegrations"); + } + + // verify the required parameter 'switchboardId' is set + if (switchboardId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardId' when calling listSwitchboardIntegrations"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "switchboardId" + "\\}", apiClient.escapeString(switchboardId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Update Switchboard Integration + * Updates a switchboard integration record. + * @param switchboardIntegrationUpdateBody (required) + * @param appId Identifies the app. (required) + * @param switchboardId Identifies the switchboard. (required) + * @param switchboardIntegrationId Identifies the switchboard integration. (required) + * @return a {@code SwitchboardIntegrationResponse} + * @throws ApiException if fails to make API call + */ + public SwitchboardIntegrationResponse updateSwitchboardIntegration(SwitchboardIntegrationUpdateBody switchboardIntegrationUpdateBody, String appId, String switchboardId, String switchboardIntegrationId) throws ApiException { + Object localVarPostBody = switchboardIntegrationUpdateBody; + + // verify the required parameter 'switchboardIntegrationUpdateBody' is set + if (switchboardIntegrationUpdateBody == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardIntegrationUpdateBody' when calling updateSwitchboardIntegration"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling updateSwitchboardIntegration"); + } + + // verify the required parameter 'switchboardId' is set + if (switchboardId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardId' when calling updateSwitchboardIntegration"); + } + + // verify the required parameter 'switchboardIntegrationId' is set + if (switchboardIntegrationId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardIntegrationId' when calling updateSwitchboardIntegration"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations/{switchboardIntegrationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "switchboardId" + "\\}", apiClient.escapeString(switchboardId.toString())) + .replaceAll("\\{" + "switchboardIntegrationId" + "\\}", apiClient.escapeString(switchboardIntegrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * Create Switchboard Integration + * Create a switchboard integration. + * @param bearerToken a token to be used for this request (required) + * + * @param switchboardIntegrationCreateBody (required) + * @param appId Identifies the app. (required) + * @param switchboardId Identifies the switchboard. (required) + * @return a {@code SwitchboardIntegrationResponse} + * @throws ApiException if fails to make API call + */ + public SwitchboardIntegrationResponse createSwitchboardIntegration(String bearerToken, SwitchboardIntegrationCreateBody switchboardIntegrationCreateBody, String appId, String switchboardId) throws ApiException { + Object localVarPostBody = switchboardIntegrationCreateBody; + + // verify the required parameter 'switchboardIntegrationCreateBody' is set + if (switchboardIntegrationCreateBody == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardIntegrationCreateBody' when calling createSwitchboardIntegration"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createSwitchboardIntegration"); + } + + // verify the required parameter 'switchboardId' is set + if (switchboardId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardId' when calling createSwitchboardIntegration"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "switchboardId" + "\\}", apiClient.escapeString(switchboardId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param switchboardId Identifies the switchboard. (required) + * @param switchboardIntegrationId Identifies the switchboard integration. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteSwitchboardIntegration(String bearerToken, String appId, String switchboardId, String switchboardIntegrationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteSwitchboardIntegration"); + } + + // verify the required parameter 'switchboardId' is set + if (switchboardId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardId' when calling deleteSwitchboardIntegration"); + } + + // verify the required parameter 'switchboardIntegrationId' is set + if (switchboardIntegrationId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardIntegrationId' when calling deleteSwitchboardIntegration"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations/{switchboardIntegrationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "switchboardId" + "\\}", apiClient.escapeString(switchboardId.toString())) + .replaceAll("\\{" + "switchboardIntegrationId" + "\\}", apiClient.escapeString(switchboardIntegrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * List Switchboard Integrations + * Lists all switchboard integrations linked to the switchboard. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param switchboardId Identifies the switchboard. (required) + * @return a {@code SwitchboardIntegrationListResponse} + * @throws ApiException if fails to make API call + */ + public SwitchboardIntegrationListResponse listSwitchboardIntegrations(String bearerToken, String appId, String switchboardId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listSwitchboardIntegrations"); + } + + // verify the required parameter 'switchboardId' is set + if (switchboardId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardId' when calling listSwitchboardIntegrations"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "switchboardId" + "\\}", apiClient.escapeString(switchboardId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Update Switchboard Integration + * Updates a switchboard integration record. + * @param bearerToken a token to be used for this request (required) + * + * @param switchboardIntegrationUpdateBody (required) + * @param appId Identifies the app. (required) + * @param switchboardId Identifies the switchboard. (required) + * @param switchboardIntegrationId Identifies the switchboard integration. (required) + * @return a {@code SwitchboardIntegrationResponse} + * @throws ApiException if fails to make API call + */ + public SwitchboardIntegrationResponse updateSwitchboardIntegration(String bearerToken, SwitchboardIntegrationUpdateBody switchboardIntegrationUpdateBody, String appId, String switchboardId, String switchboardIntegrationId) throws ApiException { + Object localVarPostBody = switchboardIntegrationUpdateBody; + + // verify the required parameter 'switchboardIntegrationUpdateBody' is set + if (switchboardIntegrationUpdateBody == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardIntegrationUpdateBody' when calling updateSwitchboardIntegration"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling updateSwitchboardIntegration"); + } + + // verify the required parameter 'switchboardId' is set + if (switchboardId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardId' when calling updateSwitchboardIntegration"); + } + + // verify the required parameter 'switchboardIntegrationId' is set + if (switchboardIntegrationId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardIntegrationId' when calling updateSwitchboardIntegration"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations/{switchboardIntegrationId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "switchboardId" + "\\}", apiClient.escapeString(switchboardId.toString())) + .replaceAll("\\{" + "switchboardIntegrationId" + "\\}", apiClient.escapeString(switchboardIntegrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/api/SwitchboardsApi.java b/src/main/java/com/zendesk/sunshine_conversations_client/api/SwitchboardsApi.java new file mode 100644 index 00000000..7314838b --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/api/SwitchboardsApi.java @@ -0,0 +1,448 @@ +package com.zendesk.sunshine_conversations_client.api; + +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.Pair; + +import javax.ws.rs.core.GenericType; + +import com.zendesk.sunshine_conversations_client.model.SwitchboardListResponse; +import com.zendesk.sunshine_conversations_client.model.SwitchboardResponse; +import com.zendesk.sunshine_conversations_client.model.SwitchboardUpdateBody; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class SwitchboardsApi { + private ApiClient apiClient; + + public SwitchboardsApi() { + this(Configuration.getDefaultApiClient()); + } + + public SwitchboardsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create Switchboard + * Create a switchboard. + * @param appId Identifies the app. (required) + * @return a {@code SwitchboardResponse} + * @throws ApiException if fails to make API call + */ + public SwitchboardResponse createSwitchboard(String appId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createSwitchboard"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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. + * @param appId Identifies the app. (required) + * @param switchboardId Identifies the switchboard. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteSwitchboard(String appId, String switchboardId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteSwitchboard"); + } + + // verify the required parameter 'switchboardId' is set + if (switchboardId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardId' when calling deleteSwitchboard"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards/{switchboardId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "switchboardId" + "\\}", apiClient.escapeString(switchboardId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * List Switchboards + * Lists all switchboards belonging to the app. + * @param appId Identifies the app. (required) + * @return a {@code SwitchboardListResponse} + * @throws ApiException if fails to make API call + */ + public SwitchboardListResponse listSwitchboards(String appId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listSwitchboards"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Update Switchboard + * Updates a switchboard record. + * @param switchboardUpdateBody (required) + * @param appId Identifies the app. (required) + * @param switchboardId Identifies the switchboard. (required) + * @return a {@code SwitchboardResponse} + * @throws ApiException if fails to make API call + */ + public SwitchboardResponse updateSwitchboard(SwitchboardUpdateBody switchboardUpdateBody, String appId, String switchboardId) throws ApiException { + Object localVarPostBody = switchboardUpdateBody; + + // verify the required parameter 'switchboardUpdateBody' is set + if (switchboardUpdateBody == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardUpdateBody' when calling updateSwitchboard"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling updateSwitchboard"); + } + + // verify the required parameter 'switchboardId' is set + if (switchboardId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardId' when calling updateSwitchboard"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards/{switchboardId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "switchboardId" + "\\}", apiClient.escapeString(switchboardId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * Create Switchboard + * Create a switchboard. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @return a {@code SwitchboardResponse} + * @throws ApiException if fails to make API call + */ + public SwitchboardResponse createSwitchboard(String bearerToken, String appId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createSwitchboard"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param switchboardId Identifies the switchboard. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteSwitchboard(String bearerToken, String appId, String switchboardId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteSwitchboard"); + } + + // verify the required parameter 'switchboardId' is set + if (switchboardId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardId' when calling deleteSwitchboard"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards/{switchboardId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "switchboardId" + "\\}", apiClient.escapeString(switchboardId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * List Switchboards + * Lists all switchboards belonging to the app. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @return a {@code SwitchboardListResponse} + * @throws ApiException if fails to make API call + */ + public SwitchboardListResponse listSwitchboards(String bearerToken, String appId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listSwitchboards"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Update Switchboard + * Updates a switchboard record. + * @param bearerToken a token to be used for this request (required) + * + * @param switchboardUpdateBody (required) + * @param appId Identifies the app. (required) + * @param switchboardId Identifies the switchboard. (required) + * @return a {@code SwitchboardResponse} + * @throws ApiException if fails to make API call + */ + public SwitchboardResponse updateSwitchboard(String bearerToken, SwitchboardUpdateBody switchboardUpdateBody, String appId, String switchboardId) throws ApiException { + Object localVarPostBody = switchboardUpdateBody; + + // verify the required parameter 'switchboardUpdateBody' is set + if (switchboardUpdateBody == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardUpdateBody' when calling updateSwitchboard"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling updateSwitchboard"); + } + + // verify the required parameter 'switchboardId' is set + if (switchboardId == null) { + throw new ApiException(400, "Missing the required parameter 'switchboardId' when calling updateSwitchboard"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/switchboards/{switchboardId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "switchboardId" + "\\}", apiClient.escapeString(switchboardId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/api/UsersApi.java b/src/main/java/com/zendesk/sunshine_conversations_client/api/UsersApi.java new file mode 100644 index 00000000..2efd7ba1 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/api/UsersApi.java @@ -0,0 +1,580 @@ +package com.zendesk.sunshine_conversations_client.api; + +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.Pair; + +import javax.ws.rs.core.GenericType; + +import com.zendesk.sunshine_conversations_client.model.UserCreateBody; +import com.zendesk.sunshine_conversations_client.model.UserResponse; +import com.zendesk.sunshine_conversations_client.model.UserUpdateBody; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class UsersApi { + private ApiClient apiClient; + + public UsersApi() { + this(Configuration.getDefaultApiClient()); + } + + public UsersApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create User + * Creates a new user. + * @param userCreateBody (required) + * @param appId Identifies the app. (required) + * @return a {@code UserResponse} + * @throws ApiException if fails to make API call + */ + public UserResponse createUser(UserCreateBody userCreateBody, String appId) throws ApiException { + Object localVarPostBody = userCreateBody; + + // verify the required parameter 'userCreateBody' is set + if (userCreateBody == null) { + throw new ApiException(400, "Missing the required parameter 'userCreateBody' when calling createUser"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createUser"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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). + * @param appId Identifies the app. (required) + * @param userIdOrExternalId The user's id or externalId. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteUser(String appId, String userIdOrExternalId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteUser"); + } + + // verify the required parameter 'userIdOrExternalId' is set + if (userIdOrExternalId == null) { + throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling deleteUser"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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). + * @param appId Identifies the app. (required) + * @param userIdOrExternalId The user's id or externalId. (required) + * @return a {@code UserResponse} + * @throws ApiException if fails to make API call + */ + public UserResponse deleteUserPersonalInformation(String appId, String userIdOrExternalId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteUserPersonalInformation"); + } + + // verify the required parameter 'userIdOrExternalId' is set + if (userIdOrExternalId == null) { + throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling deleteUserPersonalInformation"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}/personalinformation".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Get User + * Fetches an individual user. + * @param appId Identifies the app. (required) + * @param userIdOrExternalId The user's id or externalId. (required) + * @return a {@code UserResponse} + * @throws ApiException if fails to make API call + */ + public UserResponse getUser(String appId, String userIdOrExternalId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling getUser"); + } + + // verify the required parameter 'userIdOrExternalId' is set + if (userIdOrExternalId == null) { + throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling getUser"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Update User + * Updates a user. + * @param userUpdateBody (required) + * @param appId Identifies the app. (required) + * @param userIdOrExternalId The user's id or externalId. (required) + * @return a {@code UserResponse} + * @throws ApiException if fails to make API call + */ + public UserResponse updateUser(UserUpdateBody userUpdateBody, String appId, String userIdOrExternalId) throws ApiException { + Object localVarPostBody = userUpdateBody; + + // verify the required parameter 'userUpdateBody' is set + if (userUpdateBody == null) { + throw new ApiException(400, "Missing the required parameter 'userUpdateBody' when calling updateUser"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling updateUser"); + } + + // verify the required parameter 'userIdOrExternalId' is set + if (userIdOrExternalId == null) { + throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling updateUser"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * Create User + * Creates a new user. + * @param bearerToken a token to be used for this request (required) + * + * @param userCreateBody (required) + * @param appId Identifies the app. (required) + * @return a {@code UserResponse} + * @throws ApiException if fails to make API call + */ + public UserResponse createUser(String bearerToken, UserCreateBody userCreateBody, String appId) throws ApiException { + Object localVarPostBody = userCreateBody; + + // verify the required parameter 'userCreateBody' is set + if (userCreateBody == null) { + throw new ApiException(400, "Missing the required parameter 'userCreateBody' when calling createUser"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createUser"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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). + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param userIdOrExternalId The user's id or externalId. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteUser(String bearerToken, String appId, String userIdOrExternalId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteUser"); + } + + // verify the required parameter 'userIdOrExternalId' is set + if (userIdOrExternalId == null) { + throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling deleteUser"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * 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). + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param userIdOrExternalId The user's id or externalId. (required) + * @return a {@code UserResponse} + * @throws ApiException if fails to make API call + */ + public UserResponse deleteUserPersonalInformation(String bearerToken, String appId, String userIdOrExternalId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteUserPersonalInformation"); + } + + // verify the required parameter 'userIdOrExternalId' is set + if (userIdOrExternalId == null) { + throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling deleteUserPersonalInformation"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}/personalinformation".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Get User + * Fetches an individual user. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param userIdOrExternalId The user's id or externalId. (required) + * @return a {@code UserResponse} + * @throws ApiException if fails to make API call + */ + public UserResponse getUser(String bearerToken, String appId, String userIdOrExternalId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling getUser"); + } + + // verify the required parameter 'userIdOrExternalId' is set + if (userIdOrExternalId == null) { + throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling getUser"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Update User + * Updates a user. + * @param bearerToken a token to be used for this request (required) + * + * @param userUpdateBody (required) + * @param appId Identifies the app. (required) + * @param userIdOrExternalId The user's id or externalId. (required) + * @return a {@code UserResponse} + * @throws ApiException if fails to make API call + */ + public UserResponse updateUser(String bearerToken, UserUpdateBody userUpdateBody, String appId, String userIdOrExternalId) throws ApiException { + Object localVarPostBody = userUpdateBody; + + // verify the required parameter 'userUpdateBody' is set + if (userUpdateBody == null) { + throw new ApiException(400, "Missing the required parameter 'userUpdateBody' when calling updateUser"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling updateUser"); + } + + // verify the required parameter 'userIdOrExternalId' is set + if (userIdOrExternalId == null) { + throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling updateUser"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/api/WebhooksApi.java b/src/main/java/com/zendesk/sunshine_conversations_client/api/WebhooksApi.java new file mode 100644 index 00000000..eaac69d1 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/api/WebhooksApi.java @@ -0,0 +1,637 @@ +package com.zendesk.sunshine_conversations_client.api; + +import com.zendesk.sunshine_conversations_client.ApiException; +import com.zendesk.sunshine_conversations_client.ApiClient; +import com.zendesk.sunshine_conversations_client.Configuration; +import com.zendesk.sunshine_conversations_client.Pair; + +import javax.ws.rs.core.GenericType; + +import com.zendesk.sunshine_conversations_client.model.WebhookBody; +import com.zendesk.sunshine_conversations_client.model.WebhookCreateBody; +import com.zendesk.sunshine_conversations_client.model.WebhookListResponse; +import com.zendesk.sunshine_conversations_client.model.WebhookResponse; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class WebhooksApi { + private ApiClient apiClient; + + public WebhooksApi() { + this(Configuration.getDefaultApiClient()); + } + + public WebhooksApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create Webhook + * Creates a new webhook associated with a Sunshine Conversations Connect integration or a custom integration. + * @param webhookCreateBody (required) + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @return a {@code WebhookResponse} + * @throws ApiException if fails to make API call + */ + public WebhookResponse createWebhook(WebhookCreateBody webhookCreateBody, String appId, String integrationId) throws ApiException { + Object localVarPostBody = webhookCreateBody; + + // verify the required parameter 'webhookCreateBody' is set + if (webhookCreateBody == null) { + throw new ApiException(400, "Missing the required parameter 'webhookCreateBody' when calling createWebhook"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createWebhook"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling createWebhook"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/webhooks".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Delete Webhook + * Deletes the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration. + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @param webhookId The id of the webhook. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteWebhook(String appId, String integrationId, String webhookId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteWebhook"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling deleteWebhook"); + } + + // verify the required parameter 'webhookId' is set + if (webhookId == null) { + throw new ApiException(400, "Missing the required parameter 'webhookId' when calling deleteWebhook"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())) + .replaceAll("\\{" + "webhookId" + "\\}", apiClient.escapeString(webhookId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Get Webhook + * Gets the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration. + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @param webhookId The id of the webhook. (required) + * @return a {@code WebhookResponse} + * @throws ApiException if fails to make API call + */ + public WebhookResponse getWebhook(String appId, String integrationId, String webhookId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling getWebhook"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling getWebhook"); + } + + // verify the required parameter 'webhookId' is set + if (webhookId == null) { + throw new ApiException(400, "Missing the required parameter 'webhookId' when calling getWebhook"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())) + .replaceAll("\\{" + "webhookId" + "\\}", apiClient.escapeString(webhookId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * List Webhooks + * Lists all webhooks for a given Sunshine Conversations Connect integration or custom integration. + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @return a {@code WebhookListResponse} + * @throws ApiException if fails to make API call + */ + public WebhookListResponse listWebhooks(String appId, String integrationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listWebhooks"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling listWebhooks"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/webhooks".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Update Webhook + * Updates the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration. + * @param webhookBody (required) + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @param webhookId The id of the webhook. (required) + * @return a {@code WebhookResponse} + * @throws ApiException if fails to make API call + */ + public WebhookResponse updateWebhook(WebhookBody webhookBody, String appId, String integrationId, String webhookId) throws ApiException { + Object localVarPostBody = webhookBody; + + // verify the required parameter 'webhookBody' is set + if (webhookBody == null) { + throw new ApiException(400, "Missing the required parameter 'webhookBody' when calling updateWebhook"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling updateWebhook"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling updateWebhook"); + } + + // verify the required parameter 'webhookId' is set + if (webhookId == null) { + throw new ApiException(400, "Missing the required parameter 'webhookId' when calling updateWebhook"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())) + .replaceAll("\\{" + "webhookId" + "\\}", apiClient.escapeString(webhookId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * Create Webhook + * Creates a new webhook associated with a Sunshine Conversations Connect integration or a custom integration. + * @param bearerToken a token to be used for this request (required) + * + * @param webhookCreateBody (required) + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @return a {@code WebhookResponse} + * @throws ApiException if fails to make API call + */ + public WebhookResponse createWebhook(String bearerToken, WebhookCreateBody webhookCreateBody, String appId, String integrationId) throws ApiException { + Object localVarPostBody = webhookCreateBody; + + // verify the required parameter 'webhookCreateBody' is set + if (webhookCreateBody == null) { + throw new ApiException(400, "Missing the required parameter 'webhookCreateBody' when calling createWebhook"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling createWebhook"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling createWebhook"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/webhooks".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Delete Webhook + * Deletes the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @param webhookId The id of the webhook. (required) + * @return a {@code Object} + * @throws ApiException if fails to make API call + */ + public Object deleteWebhook(String bearerToken, String appId, String integrationId, String webhookId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteWebhook"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling deleteWebhook"); + } + + // verify the required parameter 'webhookId' is set + if (webhookId == null) { + throw new ApiException(400, "Missing the required parameter 'webhookId' when calling deleteWebhook"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())) + .replaceAll("\\{" + "webhookId" + "\\}", apiClient.escapeString(webhookId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Get Webhook + * Gets the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @param webhookId The id of the webhook. (required) + * @return a {@code WebhookResponse} + * @throws ApiException if fails to make API call + */ + public WebhookResponse getWebhook(String bearerToken, String appId, String integrationId, String webhookId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling getWebhook"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling getWebhook"); + } + + // verify the required parameter 'webhookId' is set + if (webhookId == null) { + throw new ApiException(400, "Missing the required parameter 'webhookId' when calling getWebhook"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())) + .replaceAll("\\{" + "webhookId" + "\\}", apiClient.escapeString(webhookId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * List Webhooks + * Lists all webhooks for a given Sunshine Conversations Connect integration or custom integration. + * @param bearerToken a token to be used for this request (required) + * + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @return a {@code WebhookListResponse} + * @throws ApiException if fails to make API call + */ + public WebhookListResponse listWebhooks(String bearerToken, String appId, String integrationId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling listWebhooks"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling listWebhooks"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/webhooks".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * Update Webhook + * Updates the specified webhook associated with a Sunshine Conversations Connect integration or a custom integration. + * @param bearerToken a token to be used for this request (required) + * + * @param webhookBody (required) + * @param appId Identifies the app. (required) + * @param integrationId The id of the integration. (required) + * @param webhookId The id of the webhook. (required) + * @return a {@code WebhookResponse} + * @throws ApiException if fails to make API call + */ + public WebhookResponse updateWebhook(String bearerToken, WebhookBody webhookBody, String appId, String integrationId, String webhookId) throws ApiException { + Object localVarPostBody = webhookBody; + + // verify the required parameter 'webhookBody' is set + if (webhookBody == null) { + throw new ApiException(400, "Missing the required parameter 'webhookBody' when calling updateWebhook"); + } + + // verify the required parameter 'appId' is set + if (appId == null) { + throw new ApiException(400, "Missing the required parameter 'appId' when calling updateWebhook"); + } + + // verify the required parameter 'integrationId' is set + if (integrationId == null) { + throw new ApiException(400, "Missing the required parameter 'integrationId' when calling updateWebhook"); + } + + // verify the required parameter 'webhookId' is set + if (webhookId == null) { + throw new ApiException(400, "Missing the required parameter 'webhookId' when calling updateWebhook"); + } + + // create path and map variables + String localVarPath = "/v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId}".replaceAll("\\{format\\}","json") + .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) + .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())) + .replaceAll("\\{" + "webhookId" + "\\}", apiClient.escapeString(webhookId.toString())); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + localVarHeaderParams.put("Authorization", "Bearer " + bearerToken); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/auth/ApiKeyAuth.java b/src/main/java/com/zendesk/sunshine_conversations_client/auth/ApiKeyAuth.java new file mode 100644 index 00000000..ee3e69a6 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/auth/ApiKeyAuth.java @@ -0,0 +1,76 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.auth; + +import com.zendesk.sunshine_conversations_client.Pair; + +import java.util.Map; +import java.util.List; + +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } else if ("cookie".equals(location)) { + cookieParams.put(paramName, value); + } + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/auth/Authentication.java b/src/main/java/com/zendesk/sunshine_conversations_client/auth/Authentication.java new file mode 100644 index 00000000..436a277f --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/auth/Authentication.java @@ -0,0 +1,30 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.auth; + +import com.zendesk.sunshine_conversations_client.Pair; + +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams); +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/auth/HttpBasicAuth.java b/src/main/java/com/zendesk/sunshine_conversations_client/auth/HttpBasicAuth.java new file mode 100644 index 00000000..4b334e79 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/auth/HttpBasicAuth.java @@ -0,0 +1,57 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.auth; + +import com.zendesk.sunshine_conversations_client.Pair; + +import com.migcomponents.migbase64.Base64; + +import java.util.Map; +import java.util.List; + +import java.io.UnsupportedEncodingException; + +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { + if (username == null && password == null) { + return; + } + String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + try { + headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes("UTF-8"), false)); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/auth/HttpBearerAuth.java b/src/main/java/com/zendesk/sunshine_conversations_client/auth/HttpBearerAuth.java new file mode 100644 index 00000000..a9749070 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/auth/HttpBearerAuth.java @@ -0,0 +1,59 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.auth; + +import com.zendesk.sunshine_conversations_client.Pair; + +import java.util.Map; +import java.util.List; + +public class HttpBearerAuth implements Authentication { + private final String scheme; + private String bearerToken; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return bearerToken; + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { + if(bearerToken == null) { + return; + } + + headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AcceptControlBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AcceptControlBody.java new file mode 100644 index 00000000..121f98b3 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AcceptControlBody.java @@ -0,0 +1,102 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AcceptControlBody + */ +@JsonPropertyOrder({ + AcceptControlBody.JSON_PROPERTY_METADATA +}) + +public class AcceptControlBody { + public static final String JSON_PROPERTY_METADATA = "metadata"; + private Object metadata = null; + + + public AcceptControlBody metadata(Object metadata) { + + this.metadata = metadata; + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. The metadata object will be included in the `switchboard:acceptControl` and `switchboard:acceptControl:failure` webhooks. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. The metadata object will be included in the `switchboard:acceptControl` and `switchboard:acceptControl:failure` webhooks.") + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getMetadata() { + return metadata; + } + + + public void setMetadata(Object metadata) { + this.metadata = metadata; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AcceptControlBody acceptControlBody = (AcceptControlBody) o; + return Objects.equals(this.metadata, acceptControlBody.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AcceptControlBody {\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Action.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Action.java new file mode 100644 index 00000000..a7542cfb --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Action.java @@ -0,0 +1,53 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Buy; +import com.zendesk.sunshine_conversations_client.model.ExtraChannelOptions; +import com.zendesk.sunshine_conversations_client.model.Link; +import com.zendesk.sunshine_conversations_client.model.LocationRequest; +import com.zendesk.sunshine_conversations_client.model.Postback; +import com.zendesk.sunshine_conversations_client.model.Reply; +import com.zendesk.sunshine_conversations_client.model.Webview; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Buy.class, name = "buy"), + @JsonSubTypes.Type(value = Link.class, name = "link"), + @JsonSubTypes.Type(value = LocationRequest.class, name = "locationRequest"), + @JsonSubTypes.Type(value = Postback.class, name = "postback"), + @JsonSubTypes.Type(value = Reply.class, name = "reply"), + @JsonSubTypes.Type(value = Webview.class, name = "webview"), +}) + +public interface Action { + public String getType(); +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ActionSubset.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ActionSubset.java new file mode 100644 index 00000000..c2cc8c5e --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ActionSubset.java @@ -0,0 +1,49 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Buy; +import com.zendesk.sunshine_conversations_client.model.ExtraChannelOptions; +import com.zendesk.sunshine_conversations_client.model.Link; +import com.zendesk.sunshine_conversations_client.model.Postback; +import com.zendesk.sunshine_conversations_client.model.Webview; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Buy.class, name = "buy"), + @JsonSubTypes.Type(value = Link.class, name = "link"), + @JsonSubTypes.Type(value = Postback.class, name = "postback"), + @JsonSubTypes.Type(value = Webview.class, name = "webview"), +}) + +public interface ActionSubset { + public String getType(); +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Activity.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Activity.java new file mode 100644 index 00000000..891b920e --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Activity.java @@ -0,0 +1,205 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ActivityAllOf; +import com.zendesk.sunshine_conversations_client.model.ActivityTypes; +import com.zendesk.sunshine_conversations_client.model.AuthorWebhook; +import com.zendesk.sunshine_conversations_client.model.SourceWebhook; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Activity + */ +@JsonPropertyOrder({ + Activity.JSON_PROPERTY_TYPE, + Activity.JSON_PROPERTY_SOURCE, + Activity.JSON_PROPERTY_AUTHOR +}) + +public class Activity { + /** + * If the author type is `user`, only `conversation:read` is supported. + */ + public enum TypeEnum { + CONVERSATION_READ("conversation:read"), + + TYPING_START("typing:start"), + + TYPING_STOP("typing:stop"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public static final String JSON_PROPERTY_SOURCE = "source"; + private SourceWebhook source = null; + + public static final String JSON_PROPERTY_AUTHOR = "author"; + private AuthorWebhook author; + + + public Activity type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * If the author type is `user`, only `conversation:read` is supported. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "If the author type is `user`, only `conversation:read` is supported.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public Activity source(SourceWebhook source) { + + this.source = source; + return this; + } + + /** + * The source of the activity. + * @return source + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The source of the activity.") + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SourceWebhook getSource() { + return source; + } + + + public void setSource(SourceWebhook source) { + this.source = source; + } + + + public Activity author(AuthorWebhook author) { + + this.author = author; + return this; + } + + /** + * Get author + * @return author + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_AUTHOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AuthorWebhook getAuthor() { + return author; + } + + + public void setAuthor(AuthorWebhook author) { + this.author = author; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Activity activity = (Activity) o; + return Objects.equals(this.type, activity.type) && + Objects.equals(this.source, activity.source) && + Objects.equals(this.author, activity.author); + } + + @Override + public int hashCode() { + return Objects.hash(type, source, author); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Activity {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" author: ").append(toIndentedString(author)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ActivityAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ActivityAllOf.java new file mode 100644 index 00000000..f0366021 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ActivityAllOf.java @@ -0,0 +1,135 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.AuthorWebhook; +import com.zendesk.sunshine_conversations_client.model.SourceWebhook; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ActivityAllOf + */ +@JsonPropertyOrder({ + ActivityAllOf.JSON_PROPERTY_SOURCE, + ActivityAllOf.JSON_PROPERTY_AUTHOR +}) + +public class ActivityAllOf { + public static final String JSON_PROPERTY_SOURCE = "source"; + private SourceWebhook source = null; + + public static final String JSON_PROPERTY_AUTHOR = "author"; + private AuthorWebhook author; + + + public ActivityAllOf source(SourceWebhook source) { + + this.source = source; + return this; + } + + /** + * The source of the activity. + * @return source + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The source of the activity.") + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SourceWebhook getSource() { + return source; + } + + + public void setSource(SourceWebhook source) { + this.source = source; + } + + + public ActivityAllOf author(AuthorWebhook author) { + + this.author = author; + return this; + } + + /** + * Get author + * @return author + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_AUTHOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AuthorWebhook getAuthor() { + return author; + } + + + public void setAuthor(AuthorWebhook author) { + this.author = author; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ActivityAllOf activityAllOf = (ActivityAllOf) o; + return Objects.equals(this.source, activityAllOf.source) && + Objects.equals(this.author, activityAllOf.author); + } + + @Override + public int hashCode() { + return Objects.hash(source, author); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ActivityAllOf {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" author: ").append(toIndentedString(author)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ActivityPost.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ActivityPost.java new file mode 100644 index 00000000..e672ee77 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ActivityPost.java @@ -0,0 +1,171 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ActivityPostAllOf; +import com.zendesk.sunshine_conversations_client.model.ActivityTypes; +import com.zendesk.sunshine_conversations_client.model.Author; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ActivityPost + */ +@JsonPropertyOrder({ + ActivityPost.JSON_PROPERTY_AUTHOR, + ActivityPost.JSON_PROPERTY_TYPE +}) + +public class ActivityPost { + public static final String JSON_PROPERTY_AUTHOR = "author"; + private Author author = null; + + /** + * If the author type is `user`, only `conversation:read` is supported. + */ + public enum TypeEnum { + CONVERSATION_READ("conversation:read"), + + TYPING_START("typing:start"), + + TYPING_STOP("typing:stop"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + + public ActivityPost author(Author author) { + + this.author = author; + return this; + } + + /** + * The author of the activity. + * @return author + **/ + @ApiModelProperty(required = true, value = "The author of the activity.") + @JsonProperty(JSON_PROPERTY_AUTHOR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Author getAuthor() { + return author; + } + + + public void setAuthor(Author author) { + this.author = author; + } + + + public ActivityPost type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * If the author type is `user`, only `conversation:read` is supported. + * @return type + **/ + @ApiModelProperty(required = true, value = "If the author type is `user`, only `conversation:read` is supported.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ActivityPost activityPost = (ActivityPost) o; + return Objects.equals(this.author, activityPost.author) && + Objects.equals(this.type, activityPost.type); + } + + @Override + public int hashCode() { + return Objects.hash(author, type); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ActivityPost {\n"); + sb.append(" author: ").append(toIndentedString(author)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ActivityPostAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ActivityPostAllOf.java new file mode 100644 index 00000000..da533f39 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ActivityPostAllOf.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Author; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ActivityPostAllOf + */ +@JsonPropertyOrder({ + ActivityPostAllOf.JSON_PROPERTY_AUTHOR +}) + +public class ActivityPostAllOf { + public static final String JSON_PROPERTY_AUTHOR = "author"; + private Author author = null; + + + public ActivityPostAllOf author(Author author) { + + this.author = author; + return this; + } + + /** + * The author of the activity. + * @return author + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The author of the activity.") + @JsonProperty(JSON_PROPERTY_AUTHOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Author getAuthor() { + return author; + } + + + public void setAuthor(Author author) { + this.author = author; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ActivityPostAllOf activityPostAllOf = (ActivityPostAllOf) o; + return Objects.equals(this.author, activityPostAllOf.author); + } + + @Override + public int hashCode() { + return Objects.hash(author); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ActivityPostAllOf {\n"); + sb.append(" author: ").append(toIndentedString(author)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ActivityTypes.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ActivityTypes.java new file mode 100644 index 00000000..7ebf3081 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ActivityTypes.java @@ -0,0 +1,139 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ActivityTypes + */ +@JsonPropertyOrder({ + ActivityTypes.JSON_PROPERTY_TYPE +}) + +public class ActivityTypes { + /** + * If the author type is `user`, only `conversation:read` is supported. + */ + public enum TypeEnum { + CONVERSATION_READ("conversation:read"), + + TYPING_START("typing:start"), + + TYPING_STOP("typing:stop"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + + public ActivityTypes type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * If the author type is `user`, only `conversation:read` is supported. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "If the author type is `user`, only `conversation:read` is supported.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ActivityTypes activityTypes = (ActivityTypes) o; + return Objects.equals(this.type, activityTypes.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ActivityTypes {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Android.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Android.java new file mode 100644 index 00000000..85142514 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Android.java @@ -0,0 +1,257 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Android; +import com.zendesk.sunshine_conversations_client.model.AndroidAllOf; +import com.zendesk.sunshine_conversations_client.model.Apple; +import com.zendesk.sunshine_conversations_client.model.Custom; +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.Ios; +import com.zendesk.sunshine_conversations_client.model.Line; +import com.zendesk.sunshine_conversations_client.model.Mailgun; +import com.zendesk.sunshine_conversations_client.model.MessageBird; +import com.zendesk.sunshine_conversations_client.model.Messenger; +import com.zendesk.sunshine_conversations_client.model.Status; +import com.zendesk.sunshine_conversations_client.model.Telegram; +import com.zendesk.sunshine_conversations_client.model.Twilio; +import com.zendesk.sunshine_conversations_client.model.Twitter; +import com.zendesk.sunshine_conversations_client.model.Viber; +import com.zendesk.sunshine_conversations_client.model.Web; +import com.zendesk.sunshine_conversations_client.model.Whatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Android + */ +@JsonPropertyOrder({ + Android.JSON_PROPERTY_TYPE, + Android.JSON_PROPERTY_SERVER_KEY, + Android.JSON_PROPERTY_SENDER_ID, + Android.JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Android.class, name = "android"), + @JsonSubTypes.Type(value = Apple.class, name = "apple"), + @JsonSubTypes.Type(value = Custom.class, name = "custom"), + @JsonSubTypes.Type(value = Ios.class, name = "ios"), + @JsonSubTypes.Type(value = Line.class, name = "line"), + @JsonSubTypes.Type(value = Mailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messagebird"), + @JsonSubTypes.Type(value = Messenger.class, name = "messenger"), + @JsonSubTypes.Type(value = Telegram.class, name = "telegram"), + @JsonSubTypes.Type(value = Twilio.class, name = "twilio"), + @JsonSubTypes.Type(value = Twitter.class, name = "twitter"), + @JsonSubTypes.Type(value = Viber.class, name = "viber"), + @JsonSubTypes.Type(value = Web.class, name = "web"), + @JsonSubTypes.Type(value = Whatsapp.class, name = "whatsapp"), +}) + +public class Android extends Integration { + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type = "android"; + + public static final String JSON_PROPERTY_SERVER_KEY = "serverKey"; + private JsonNullable serverKey = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SENDER_ID = "senderId"; + private JsonNullable senderId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS = "canUserCreateMoreConversations"; + private Boolean canUserCreateMoreConversations; + + + public Android type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Android serverKey(String serverKey) { + this.serverKey = JsonNullable.of(serverKey); + + return this; + } + + /** + * Your server key from the fcm console. + * @return serverKey + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "", value = "Your server key from the fcm console.") + @JsonIgnore + + public String getServerKey() { + return serverKey.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SERVER_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getServerKey_JsonNullable() { + return serverKey; + } + + @JsonProperty(JSON_PROPERTY_SERVER_KEY) + public void setServerKey_JsonNullable(JsonNullable serverKey) { + this.serverKey = serverKey; + } + + public void setServerKey(String serverKey) { + this.serverKey = JsonNullable.of(serverKey); + } + + + public Android senderId(String senderId) { + this.senderId = JsonNullable.of(senderId); + + return this; + } + + /** + * Your sender id from the fcm console. + * @return senderId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "", value = "Your sender id from the fcm console.") + @JsonIgnore + + public String getSenderId() { + return senderId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SENDER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getSenderId_JsonNullable() { + return senderId; + } + + @JsonProperty(JSON_PROPERTY_SENDER_ID) + public void setSenderId_JsonNullable(JsonNullable senderId) { + this.senderId = senderId; + } + + public void setSenderId(String senderId) { + this.senderId = JsonNullable.of(senderId); + } + + + public Android canUserCreateMoreConversations(Boolean canUserCreateMoreConversations) { + + this.canUserCreateMoreConversations = canUserCreateMoreConversations; + return this; + } + + /** + * Allows users to create more than one conversation on the android integration. + * @return canUserCreateMoreConversations + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Allows users to create more than one conversation on the android integration.") + @JsonProperty(JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getCanUserCreateMoreConversations() { + return canUserCreateMoreConversations; + } + + + public void setCanUserCreateMoreConversations(Boolean canUserCreateMoreConversations) { + this.canUserCreateMoreConversations = canUserCreateMoreConversations; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Android android = (Android) o; + return Objects.equals(this.type, android.type) && + Objects.equals(this.serverKey, android.serverKey) && + Objects.equals(this.senderId, android.senderId) && + Objects.equals(this.canUserCreateMoreConversations, android.canUserCreateMoreConversations) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, serverKey, senderId, canUserCreateMoreConversations, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Android {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" serverKey: ").append(toIndentedString(serverKey)).append("\n"); + sb.append(" senderId: ").append(toIndentedString(senderId)).append("\n"); + sb.append(" canUserCreateMoreConversations: ").append(toIndentedString(canUserCreateMoreConversations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AndroidAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AndroidAllOf.java new file mode 100644 index 00000000..8ae94310 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AndroidAllOf.java @@ -0,0 +1,218 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AndroidAllOf + */ +@JsonPropertyOrder({ + AndroidAllOf.JSON_PROPERTY_TYPE, + AndroidAllOf.JSON_PROPERTY_SERVER_KEY, + AndroidAllOf.JSON_PROPERTY_SENDER_ID, + AndroidAllOf.JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS +}) + +public class AndroidAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "android"; + + public static final String JSON_PROPERTY_SERVER_KEY = "serverKey"; + private JsonNullable serverKey = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SENDER_ID = "senderId"; + private JsonNullable senderId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS = "canUserCreateMoreConversations"; + private Boolean canUserCreateMoreConversations; + + + public AndroidAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public AndroidAllOf serverKey(String serverKey) { + this.serverKey = JsonNullable.of(serverKey); + + return this; + } + + /** + * Your server key from the fcm console. + * @return serverKey + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "", value = "Your server key from the fcm console.") + @JsonIgnore + + public String getServerKey() { + return serverKey.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SERVER_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getServerKey_JsonNullable() { + return serverKey; + } + + @JsonProperty(JSON_PROPERTY_SERVER_KEY) + public void setServerKey_JsonNullable(JsonNullable serverKey) { + this.serverKey = serverKey; + } + + public void setServerKey(String serverKey) { + this.serverKey = JsonNullable.of(serverKey); + } + + + public AndroidAllOf senderId(String senderId) { + this.senderId = JsonNullable.of(senderId); + + return this; + } + + /** + * Your sender id from the fcm console. + * @return senderId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "", value = "Your sender id from the fcm console.") + @JsonIgnore + + public String getSenderId() { + return senderId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SENDER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getSenderId_JsonNullable() { + return senderId; + } + + @JsonProperty(JSON_PROPERTY_SENDER_ID) + public void setSenderId_JsonNullable(JsonNullable senderId) { + this.senderId = senderId; + } + + public void setSenderId(String senderId) { + this.senderId = JsonNullable.of(senderId); + } + + + public AndroidAllOf canUserCreateMoreConversations(Boolean canUserCreateMoreConversations) { + + this.canUserCreateMoreConversations = canUserCreateMoreConversations; + return this; + } + + /** + * Allows users to create more than one conversation on the android integration. + * @return canUserCreateMoreConversations + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Allows users to create more than one conversation on the android integration.") + @JsonProperty(JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getCanUserCreateMoreConversations() { + return canUserCreateMoreConversations; + } + + + public void setCanUserCreateMoreConversations(Boolean canUserCreateMoreConversations) { + this.canUserCreateMoreConversations = canUserCreateMoreConversations; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AndroidAllOf androidAllOf = (AndroidAllOf) o; + return Objects.equals(this.type, androidAllOf.type) && + Objects.equals(this.serverKey, androidAllOf.serverKey) && + Objects.equals(this.senderId, androidAllOf.senderId) && + Objects.equals(this.canUserCreateMoreConversations, androidAllOf.canUserCreateMoreConversations); + } + + @Override + public int hashCode() { + return Objects.hash(type, serverKey, senderId, canUserCreateMoreConversations); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AndroidAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" serverKey: ").append(toIndentedString(serverKey)).append("\n"); + sb.append(" senderId: ").append(toIndentedString(senderId)).append("\n"); + sb.append(" canUserCreateMoreConversations: ").append(toIndentedString(canUserCreateMoreConversations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AndroidUpdate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AndroidUpdate.java new file mode 100644 index 00000000..32d37407 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AndroidUpdate.java @@ -0,0 +1,233 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.AndroidUpdateAllOf; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdateBase; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdate; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AndroidUpdate + */ +@JsonPropertyOrder({ + AndroidUpdate.JSON_PROPERTY_DISPLAY_NAME, + AndroidUpdate.JSON_PROPERTY_SERVER_KEY, + AndroidUpdate.JSON_PROPERTY_SENDER_ID, + AndroidUpdate.JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION +}) + +public class AndroidUpdate implements IntegrationUpdate { + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private JsonNullable displayName = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SERVER_KEY = "serverKey"; + private JsonNullable serverKey = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SENDER_ID = "senderId"; + private JsonNullable senderId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION = "canUserCreateConversation"; + private Boolean canUserCreateConversation; + + + public AndroidUpdate displayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + + return this; + } + + /** + * A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "My awesome integration", value = "A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`.") + @JsonIgnore + + public String getDisplayName() { + return displayName.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDisplayName_JsonNullable() { + return displayName; + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + public void setDisplayName_JsonNullable(JsonNullable displayName) { + this.displayName = displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + } + + + public AndroidUpdate serverKey(String serverKey) { + this.serverKey = JsonNullable.of(serverKey); + + return this; + } + + /** + * Your server key from the fcm console. + * @return serverKey + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "", value = "Your server key from the fcm console.") + @JsonIgnore + + public String getServerKey() { + return serverKey.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SERVER_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getServerKey_JsonNullable() { + return serverKey; + } + + @JsonProperty(JSON_PROPERTY_SERVER_KEY) + public void setServerKey_JsonNullable(JsonNullable serverKey) { + this.serverKey = serverKey; + } + + public void setServerKey(String serverKey) { + this.serverKey = JsonNullable.of(serverKey); + } + + + public AndroidUpdate senderId(String senderId) { + this.senderId = JsonNullable.of(senderId); + + return this; + } + + /** + * Your sender id from the fcm console. + * @return senderId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "", value = "Your sender id from the fcm console.") + @JsonIgnore + + public String getSenderId() { + return senderId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SENDER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getSenderId_JsonNullable() { + return senderId; + } + + @JsonProperty(JSON_PROPERTY_SENDER_ID) + public void setSenderId_JsonNullable(JsonNullable senderId) { + this.senderId = senderId; + } + + public void setSenderId(String senderId) { + this.senderId = JsonNullable.of(senderId); + } + + + public AndroidUpdate canUserCreateConversation(Boolean canUserCreateConversation) { + + this.canUserCreateConversation = canUserCreateConversation; + return this; + } + + /** + * Allows users to create more than one conversation on the android integration. + * @return canUserCreateConversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Allows users to create more than one conversation on the android integration.") + @JsonProperty(JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getCanUserCreateConversation() { + return canUserCreateConversation; + } + + + public void setCanUserCreateConversation(Boolean canUserCreateConversation) { + this.canUserCreateConversation = canUserCreateConversation; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AndroidUpdate androidUpdate = (AndroidUpdate) o; + return Objects.equals(this.displayName, androidUpdate.displayName) && + Objects.equals(this.serverKey, androidUpdate.serverKey) && + Objects.equals(this.senderId, androidUpdate.senderId) && + Objects.equals(this.canUserCreateConversation, androidUpdate.canUserCreateConversation); + } + + @Override + public int hashCode() { + return Objects.hash(displayName, serverKey, senderId, canUserCreateConversation); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AndroidUpdate {\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" serverKey: ").append(toIndentedString(serverKey)).append("\n"); + sb.append(" senderId: ").append(toIndentedString(senderId)).append("\n"); + sb.append(" canUserCreateConversation: ").append(toIndentedString(canUserCreateConversation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AndroidUpdateAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AndroidUpdateAllOf.java new file mode 100644 index 00000000..87445841 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AndroidUpdateAllOf.java @@ -0,0 +1,187 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AndroidUpdateAllOf + */ +@JsonPropertyOrder({ + AndroidUpdateAllOf.JSON_PROPERTY_SERVER_KEY, + AndroidUpdateAllOf.JSON_PROPERTY_SENDER_ID, + AndroidUpdateAllOf.JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION +}) + +public class AndroidUpdateAllOf { + public static final String JSON_PROPERTY_SERVER_KEY = "serverKey"; + private JsonNullable serverKey = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SENDER_ID = "senderId"; + private JsonNullable senderId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION = "canUserCreateConversation"; + private Boolean canUserCreateConversation; + + + public AndroidUpdateAllOf serverKey(String serverKey) { + this.serverKey = JsonNullable.of(serverKey); + + return this; + } + + /** + * Your server key from the fcm console. + * @return serverKey + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "", value = "Your server key from the fcm console.") + @JsonIgnore + + public String getServerKey() { + return serverKey.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SERVER_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getServerKey_JsonNullable() { + return serverKey; + } + + @JsonProperty(JSON_PROPERTY_SERVER_KEY) + public void setServerKey_JsonNullable(JsonNullable serverKey) { + this.serverKey = serverKey; + } + + public void setServerKey(String serverKey) { + this.serverKey = JsonNullable.of(serverKey); + } + + + public AndroidUpdateAllOf senderId(String senderId) { + this.senderId = JsonNullable.of(senderId); + + return this; + } + + /** + * Your sender id from the fcm console. + * @return senderId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "", value = "Your sender id from the fcm console.") + @JsonIgnore + + public String getSenderId() { + return senderId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SENDER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getSenderId_JsonNullable() { + return senderId; + } + + @JsonProperty(JSON_PROPERTY_SENDER_ID) + public void setSenderId_JsonNullable(JsonNullable senderId) { + this.senderId = senderId; + } + + public void setSenderId(String senderId) { + this.senderId = JsonNullable.of(senderId); + } + + + public AndroidUpdateAllOf canUserCreateConversation(Boolean canUserCreateConversation) { + + this.canUserCreateConversation = canUserCreateConversation; + return this; + } + + /** + * Allows users to create more than one conversation on the android integration. + * @return canUserCreateConversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Allows users to create more than one conversation on the android integration.") + @JsonProperty(JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getCanUserCreateConversation() { + return canUserCreateConversation; + } + + + public void setCanUserCreateConversation(Boolean canUserCreateConversation) { + this.canUserCreateConversation = canUserCreateConversation; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AndroidUpdateAllOf androidUpdateAllOf = (AndroidUpdateAllOf) o; + return Objects.equals(this.serverKey, androidUpdateAllOf.serverKey) && + Objects.equals(this.senderId, androidUpdateAllOf.senderId) && + Objects.equals(this.canUserCreateConversation, androidUpdateAllOf.canUserCreateConversation); + } + + @Override + public int hashCode() { + return Objects.hash(serverKey, senderId, canUserCreateConversation); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AndroidUpdateAllOf {\n"); + sb.append(" serverKey: ").append(toIndentedString(serverKey)).append("\n"); + sb.append(" senderId: ").append(toIndentedString(senderId)).append("\n"); + sb.append(" canUserCreateConversation: ").append(toIndentedString(canUserCreateConversation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ApiKey.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ApiKey.java new file mode 100644 index 00000000..314f64ee --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ApiKey.java @@ -0,0 +1,165 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The integration key. + */ +@ApiModel(description = "The integration key.") +@JsonPropertyOrder({ + ApiKey.JSON_PROPERTY_ID, + ApiKey.JSON_PROPERTY_DISPLAY_NAME, + ApiKey.JSON_PROPERTY_SECRET +}) + +public class ApiKey { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private String displayName = null; + + public static final String JSON_PROPERTY_SECRET = "secret"; + private String secret; + + + public ApiKey id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the API key, used when signing JWTs or accessing the API using Basic Authentication. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "int_5e4b0f225aca01092928f917", value = "The unique ID of the API key, used when signing JWTs or accessing the API using Basic Authentication.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public ApiKey displayName(String displayName) { + + this.displayName = displayName; + return this; + } + + /** + * The name of the API key. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "My custom key", value = "The name of the API key.") + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDisplayName() { + return displayName; + } + + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + + public ApiKey secret(String secret) { + + this.secret = secret; + return this; + } + + /** + * The secret of the API key, used when signing JWTs or accessing the API using Basic Authentication + * @return secret + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Ck1LjzzlUzvlCTtqAdQ2z1QukuBTrN3TIx", value = "The secret of the API key, used when signing JWTs or accessing the API using Basic Authentication") + @JsonProperty(JSON_PROPERTY_SECRET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSecret() { + return secret; + } + + + public void setSecret(String secret) { + this.secret = secret; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApiKey apiKey = (ApiKey) o; + return Objects.equals(this.id, apiKey.id) && + Objects.equals(this.displayName, apiKey.displayName) && + Objects.equals(this.secret, apiKey.secret); + } + + @Override + public int hashCode() { + return Objects.hash(id, displayName, secret); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApiKey {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/App.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/App.java new file mode 100644 index 00000000..b890759c --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/App.java @@ -0,0 +1,209 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.AppSettings; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * App + */ +@JsonPropertyOrder({ + App.JSON_PROPERTY_ID, + App.JSON_PROPERTY_DISPLAY_NAME, + App.JSON_PROPERTY_SETTINGS, + App.JSON_PROPERTY_METADATA +}) + +public class App { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private String displayName = null; + + public static final String JSON_PROPERTY_SETTINGS = "settings"; + private AppSettings settings; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public App id(String id) { + + this.id = id; + return this; + } + + /** + * A canonical ID that can be used to retrieve the Sunshine Conversations app. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5d8cff3cd55b040010928b5b", value = "A canonical ID that can be used to retrieve the Sunshine Conversations app.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public App displayName(String displayName) { + + this.displayName = displayName; + return this; + } + + /** + * The friendly name of the app. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "My App", value = "The friendly name of the app.") + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDisplayName() { + return displayName; + } + + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + + public App settings(AppSettings settings) { + + this.settings = settings; + return this; + } + + /** + * Get settings + * @return settings + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SETTINGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AppSettings getSettings() { + return settings; + } + + + public void setSettings(AppSettings settings) { + this.settings = settings; + } + + + public App metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + App app = (App) o; + return Objects.equals(this.id, app.id) && + Objects.equals(this.displayName, app.displayName) && + Objects.equals(this.settings, app.settings) && + Objects.equals(this.metadata, app.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(id, displayName, settings, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class App {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AppCreateBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppCreateBody.java new file mode 100644 index 00000000..554e4098 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppCreateBody.java @@ -0,0 +1,177 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.AppSettings; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AppCreateBody + */ +@JsonPropertyOrder({ + AppCreateBody.JSON_PROPERTY_DISPLAY_NAME, + AppCreateBody.JSON_PROPERTY_SETTINGS, + AppCreateBody.JSON_PROPERTY_METADATA +}) + +public class AppCreateBody { + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private String displayName = null; + + public static final String JSON_PROPERTY_SETTINGS = "settings"; + private AppSettings settings; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public AppCreateBody displayName(String displayName) { + + this.displayName = displayName; + return this; + } + + /** + * The friendly name of the app. + * @return displayName + **/ + @ApiModelProperty(example = "My App", required = true, value = "The friendly name of the app.") + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getDisplayName() { + return displayName; + } + + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + + public AppCreateBody settings(AppSettings settings) { + + this.settings = settings; + return this; + } + + /** + * Get settings + * @return settings + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SETTINGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AppSettings getSettings() { + return settings; + } + + + public void setSettings(AppSettings settings) { + this.settings = settings; + } + + + public AppCreateBody metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppCreateBody appCreateBody = (AppCreateBody) o; + return Objects.equals(this.displayName, appCreateBody.displayName) && + Objects.equals(this.settings, appCreateBody.settings) && + Objects.equals(this.metadata, appCreateBody.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(displayName, settings, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppCreateBody {\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AppKey.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppKey.java new file mode 100644 index 00000000..1c02112a --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppKey.java @@ -0,0 +1,164 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AppKey + */ +@JsonPropertyOrder({ + AppKey.JSON_PROPERTY_ID, + AppKey.JSON_PROPERTY_DISPLAY_NAME, + AppKey.JSON_PROPERTY_SECRET +}) + +public class AppKey { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private String displayName; + + public static final String JSON_PROPERTY_SECRET = "secret"; + private String secret; + + + public AppKey id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the API key, used when signing JWTs or accessing the API using Basic Authentication. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "app_5723a347f82ba0516cb4ea34", value = "The unique ID of the API key, used when signing JWTs or accessing the API using Basic Authentication.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public AppKey displayName(String displayName) { + + this.displayName = displayName; + return this; + } + + /** + * The name of the API key. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Key 1", value = "The name of the API key.") + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDisplayName() { + return displayName; + } + + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + + public AppKey secret(String secret) { + + this.secret = secret; + return this; + } + + /** + * The secret of the API key, used when signing JWTs or accessing the API using Basic Authentication + * @return secret + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5XJ85yjUtRcaQu_pDINblPZb", value = "The secret of the API key, used when signing JWTs or accessing the API using Basic Authentication") + @JsonProperty(JSON_PROPERTY_SECRET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSecret() { + return secret; + } + + + public void setSecret(String secret) { + this.secret = secret; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppKey appKey = (AppKey) o; + return Objects.equals(this.id, appKey.id) && + Objects.equals(this.displayName, appKey.displayName) && + Objects.equals(this.secret, appKey.secret); + } + + @Override + public int hashCode() { + return Objects.hash(id, displayName, secret); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppKey {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AppKeyCreateBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppKeyCreateBody.java new file mode 100644 index 00000000..e8955db6 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppKeyCreateBody.java @@ -0,0 +1,101 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AppKeyCreateBody + */ +@JsonPropertyOrder({ + AppKeyCreateBody.JSON_PROPERTY_DISPLAY_NAME +}) + +public class AppKeyCreateBody { + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private String displayName = null; + + + public AppKeyCreateBody displayName(String displayName) { + + this.displayName = displayName; + return this; + } + + /** + * Get displayName + * @return displayName + **/ + @ApiModelProperty(example = "Key 1", required = true, value = "") + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getDisplayName() { + return displayName; + } + + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppKeyCreateBody appKeyCreateBody = (AppKeyCreateBody) o; + return Objects.equals(this.displayName, appKeyCreateBody.displayName); + } + + @Override + public int hashCode() { + return Objects.hash(displayName); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppKeyCreateBody {\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AppKeyListResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppKeyListResponse.java new file mode 100644 index 00000000..8f971b18 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppKeyListResponse.java @@ -0,0 +1,113 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.AppKey; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AppKeyListResponse + */ +@JsonPropertyOrder({ + AppKeyListResponse.JSON_PROPERTY_KEYS +}) + +public class AppKeyListResponse { + public static final String JSON_PROPERTY_KEYS = "keys"; + private List keys = null; + + + public AppKeyListResponse keys(List keys) { + + this.keys = keys; + return this; + } + + public AppKeyListResponse addKeysItem(AppKey keysItem) { + if (this.keys == null) { + this.keys = new ArrayList(); + } + this.keys.add(keysItem); + return this; + } + + /** + * List of returned keys. + * @return keys + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of returned keys.") + @JsonProperty(JSON_PROPERTY_KEYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getKeys() { + return keys; + } + + + public void setKeys(List keys) { + this.keys = keys; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppKeyListResponse appKeyListResponse = (AppKeyListResponse) o; + return Objects.equals(this.keys, appKeyListResponse.keys); + } + + @Override + public int hashCode() { + return Objects.hash(keys); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppKeyListResponse {\n"); + sb.append(" keys: ").append(toIndentedString(keys)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AppKeyResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppKeyResponse.java new file mode 100644 index 00000000..34ed28ff --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppKeyResponse.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.AppKey; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AppKeyResponse + */ +@JsonPropertyOrder({ + AppKeyResponse.JSON_PROPERTY_KEY +}) + +public class AppKeyResponse { + public static final String JSON_PROPERTY_KEY = "key"; + private AppKey key = null; + + + public AppKeyResponse key(AppKey key) { + + this.key = key; + return this; + } + + /** + * The created key object. + * @return key + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The created key object.") + @JsonProperty(JSON_PROPERTY_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AppKey getKey() { + return key; + } + + + public void setKey(AppKey key) { + this.key = key; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppKeyResponse appKeyResponse = (AppKeyResponse) o; + return Objects.equals(this.key, appKeyResponse.key); + } + + @Override + public int hashCode() { + return Objects.hash(key); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppKeyResponse {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AppListFilter.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppListFilter.java new file mode 100644 index 00000000..03d81c22 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppListFilter.java @@ -0,0 +1,102 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AppListFilter + */ +@JsonPropertyOrder({ + AppListFilter.JSON_PROPERTY_SERVICE_ACCOUNT_ID +}) + +public class AppListFilter { + public static final String JSON_PROPERTY_SERVICE_ACCOUNT_ID = "serviceAccountId"; + private String serviceAccountId; + + + public AppListFilter serviceAccountId(String serviceAccountId) { + + this.serviceAccountId = serviceAccountId; + return this; + } + + /** + * When specified, lists only the apps that the service account has access to. + * @return serviceAccountId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "When specified, lists only the apps that the service account has access to.") + @JsonProperty(JSON_PROPERTY_SERVICE_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getServiceAccountId() { + return serviceAccountId; + } + + + public void setServiceAccountId(String serviceAccountId) { + this.serviceAccountId = serviceAccountId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppListFilter appListFilter = (AppListFilter) o; + return Objects.equals(this.serviceAccountId, appListFilter.serviceAccountId); + } + + @Override + public int hashCode() { + return Objects.hash(serviceAccountId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppListFilter {\n"); + sb.append(" serviceAccountId: ").append(toIndentedString(serviceAccountId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AppListResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppListResponse.java new file mode 100644 index 00000000..fbdcbd89 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppListResponse.java @@ -0,0 +1,177 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.App; +import com.zendesk.sunshine_conversations_client.model.Links; +import com.zendesk.sunshine_conversations_client.model.Meta; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AppListResponse + */ +@JsonPropertyOrder({ + AppListResponse.JSON_PROPERTY_APPS, + AppListResponse.JSON_PROPERTY_META, + AppListResponse.JSON_PROPERTY_LINKS +}) + +public class AppListResponse { + public static final String JSON_PROPERTY_APPS = "apps"; + private List apps = null; + + public static final String JSON_PROPERTY_META = "meta"; + private Meta meta; + + public static final String JSON_PROPERTY_LINKS = "links"; + private Links links; + + + public AppListResponse apps(List apps) { + + this.apps = apps; + return this; + } + + public AppListResponse addAppsItem(App appsItem) { + if (this.apps == null) { + this.apps = new ArrayList(); + } + this.apps.add(appsItem); + return this; + } + + /** + * List of returned apps. + * @return apps + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of returned apps.") + @JsonProperty(JSON_PROPERTY_APPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getApps() { + return apps; + } + + + public void setApps(List apps) { + this.apps = apps; + } + + + public AppListResponse meta(Meta meta) { + + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Meta getMeta() { + return meta; + } + + + public void setMeta(Meta meta) { + this.meta = meta; + } + + + public AppListResponse links(Links links) { + + this.links = links; + return this; + } + + /** + * Get links + * @return links + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LINKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Links getLinks() { + return links; + } + + + public void setLinks(Links links) { + this.links = links; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppListResponse appListResponse = (AppListResponse) o; + return Objects.equals(this.apps, appListResponse.apps) && + Objects.equals(this.meta, appListResponse.meta) && + Objects.equals(this.links, appListResponse.links); + } + + @Override + public int hashCode() { + return Objects.hash(apps, meta, links); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppListResponse {\n"); + sb.append(" apps: ").append(toIndentedString(apps)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AppResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppResponse.java new file mode 100644 index 00000000..099ba938 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppResponse.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.App; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AppResponse + */ +@JsonPropertyOrder({ + AppResponse.JSON_PROPERTY_APP +}) + +public class AppResponse { + public static final String JSON_PROPERTY_APP = "app"; + private App app = null; + + + public AppResponse app(App app) { + + this.app = app; + return this; + } + + /** + * The app. + * @return app + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The app.") + @JsonProperty(JSON_PROPERTY_APP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public App getApp() { + return app; + } + + + public void setApp(App app) { + this.app = app; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppResponse appResponse = (AppResponse) o; + return Objects.equals(this.app, appResponse.app); + } + + @Override + public int hashCode() { + return Objects.hash(app); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppResponse {\n"); + sb.append(" app: ").append(toIndentedString(app)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AppSettings.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppSettings.java new file mode 100644 index 00000000..cf65a23b --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppSettings.java @@ -0,0 +1,321 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Customizable app settings. + */ +@ApiModel(description = "Customizable app settings.") +@JsonPropertyOrder({ + AppSettings.JSON_PROPERTY_CONVERSATION_RETENTION_SECONDS, + AppSettings.JSON_PROPERTY_MASK_CREDIT_CARD_NUMBERS, + AppSettings.JSON_PROPERTY_USE_ANIMAL_NAMES, + AppSettings.JSON_PROPERTY_ECHO_POSTBACK, + AppSettings.JSON_PROPERTY_IGNORE_AUTO_CONVERSATION_START, + AppSettings.JSON_PROPERTY_MULTI_CONVO_ENABLED, + AppSettings.JSON_PROPERTY_ATTACHMENTS_ACCESS, + AppSettings.JSON_PROPERTY_ATTACHMENTS_TOKEN_EXPIRATION_SECONDS +}) + +public class AppSettings { + public static final String JSON_PROPERTY_CONVERSATION_RETENTION_SECONDS = "conversationRetentionSeconds"; + private Integer conversationRetentionSeconds; + + public static final String JSON_PROPERTY_MASK_CREDIT_CARD_NUMBERS = "maskCreditCardNumbers"; + private Boolean maskCreditCardNumbers; + + public static final String JSON_PROPERTY_USE_ANIMAL_NAMES = "useAnimalNames"; + private Boolean useAnimalNames; + + public static final String JSON_PROPERTY_ECHO_POSTBACK = "echoPostback"; + private Boolean echoPostback; + + public static final String JSON_PROPERTY_IGNORE_AUTO_CONVERSATION_START = "ignoreAutoConversationStart"; + private Boolean ignoreAutoConversationStart; + + public static final String JSON_PROPERTY_MULTI_CONVO_ENABLED = "multiConvoEnabled"; + private Boolean multiConvoEnabled; + + public static final String JSON_PROPERTY_ATTACHMENTS_ACCESS = "attachmentsAccess"; + private String attachmentsAccess; + + public static final String JSON_PROPERTY_ATTACHMENTS_TOKEN_EXPIRATION_SECONDS = "attachmentsTokenExpirationSeconds"; + private String attachmentsTokenExpirationSeconds; + + + public AppSettings conversationRetentionSeconds(Integer conversationRetentionSeconds) { + + this.conversationRetentionSeconds = conversationRetentionSeconds; + return this; + } + + /** + * Number of seconds of inactivity before a conversation’s messages will be automatically deleted. See [Conversation Retention Seconds](https://docs.smooch.io/rest/#conversation-retention-seconds) for more information. + * minimum: 0 + * @return conversationRetentionSeconds + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Number of seconds of inactivity before a conversation’s messages will be automatically deleted. See [Conversation Retention Seconds](https://docs.smooch.io/rest/#conversation-retention-seconds) for more information. ") + @JsonProperty(JSON_PROPERTY_CONVERSATION_RETENTION_SECONDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getConversationRetentionSeconds() { + return conversationRetentionSeconds; + } + + + public void setConversationRetentionSeconds(Integer conversationRetentionSeconds) { + this.conversationRetentionSeconds = conversationRetentionSeconds; + } + + + public AppSettings maskCreditCardNumbers(Boolean maskCreditCardNumbers) { + + this.maskCreditCardNumbers = maskCreditCardNumbers; + return this; + } + + /** + * A boolean specifying whether credit card numbers should be masked when sent through Sunshine Conversations. + * @return maskCreditCardNumbers + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A boolean specifying whether credit card numbers should be masked when sent through Sunshine Conversations. ") + @JsonProperty(JSON_PROPERTY_MASK_CREDIT_CARD_NUMBERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getMaskCreditCardNumbers() { + return maskCreditCardNumbers; + } + + + public void setMaskCreditCardNumbers(Boolean maskCreditCardNumbers) { + this.maskCreditCardNumbers = maskCreditCardNumbers; + } + + + public AppSettings useAnimalNames(Boolean useAnimalNames) { + + this.useAnimalNames = useAnimalNames; + return this; + } + + /** + * A boolean specifying whether animal names should be used for unnamed users. See the [user naming guide](https://docs.smooch.io/guide/receiving-messages/#message-author-name) for details. + * @return useAnimalNames + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A boolean specifying whether animal names should be used for unnamed users. See the [user naming guide](https://docs.smooch.io/guide/receiving-messages/#message-author-name) for details. ") + @JsonProperty(JSON_PROPERTY_USE_ANIMAL_NAMES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getUseAnimalNames() { + return useAnimalNames; + } + + + public void setUseAnimalNames(Boolean useAnimalNames) { + this.useAnimalNames = useAnimalNames; + } + + + public AppSettings echoPostback(Boolean echoPostback) { + + this.echoPostback = echoPostback; + return this; + } + + /** + * A boolean specifying whether a message should be added to the conversation history when a postback button is clicked. See [Echo Postbacks](https://docs.smooch.io/rest/#echo-postbacks) for more information. + * @return echoPostback + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A boolean specifying whether a message should be added to the conversation history when a postback button is clicked. See [Echo Postbacks](https://docs.smooch.io/rest/#echo-postbacks) for more information. ") + @JsonProperty(JSON_PROPERTY_ECHO_POSTBACK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getEchoPostback() { + return echoPostback; + } + + + public void setEchoPostback(Boolean echoPostback) { + this.echoPostback = echoPostback; + } + + + public AppSettings ignoreAutoConversationStart(Boolean ignoreAutoConversationStart) { + + this.ignoreAutoConversationStart = ignoreAutoConversationStart; + return this; + } + + /** + * A boolean specifying whether a non message event coming from a channel will trigger a [start conversation](https://docs.smooch.io/rest/#conversation-events) event and count as a monthly active user (MAU). <aside class=\"notice\">Calling <code>startConversation()</code> (or equivalent) from the Android, iOS or Web SDK will count as a MAU, regardless of the value of this setting.</aside> + * @return ignoreAutoConversationStart + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A boolean specifying whether a non message event coming from a channel will trigger a [start conversation](https://docs.smooch.io/rest/#conversation-events) event and count as a monthly active user (MAU). ") + @JsonProperty(JSON_PROPERTY_IGNORE_AUTO_CONVERSATION_START) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getIgnoreAutoConversationStart() { + return ignoreAutoConversationStart; + } + + + public void setIgnoreAutoConversationStart(Boolean ignoreAutoConversationStart) { + this.ignoreAutoConversationStart = ignoreAutoConversationStart; + } + + + public AppSettings multiConvoEnabled(Boolean multiConvoEnabled) { + + this.multiConvoEnabled = multiConvoEnabled; + return this; + } + + /** + * A boolean specifying whether users are allowed to be part of several conversations. Enabling `multiConvo` is **irreversible**. + * @return multiConvoEnabled + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A boolean specifying whether users are allowed to be part of several conversations. Enabling `multiConvo` is **irreversible**. ") + @JsonProperty(JSON_PROPERTY_MULTI_CONVO_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getMultiConvoEnabled() { + return multiConvoEnabled; + } + + + public void setMultiConvoEnabled(Boolean multiConvoEnabled) { + this.multiConvoEnabled = multiConvoEnabled; + } + + + public AppSettings attachmentsAccess(String attachmentsAccess) { + + this.attachmentsAccess = attachmentsAccess; + return this; + } + + /** + * A string specifying whether attachments should be stored in a publicly or privately accessible cloud storage. attachmentsAccess is set to public by default but can be modified to private. See <a href=\"https://docs.smooch.io/guide/private-attachments/\">Private Attachments</a> for more information. + * @return attachmentsAccess + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "public", value = "A string specifying whether attachments should be stored in a publicly or privately accessible cloud storage. attachmentsAccess is set to public by default but can be modified to private. See Private Attachments for more information. ") + @JsonProperty(JSON_PROPERTY_ATTACHMENTS_ACCESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAttachmentsAccess() { + return attachmentsAccess; + } + + + public void setAttachmentsAccess(String attachmentsAccess) { + this.attachmentsAccess = attachmentsAccess; + } + + + public AppSettings attachmentsTokenExpirationSeconds(String attachmentsTokenExpirationSeconds) { + + this.attachmentsTokenExpirationSeconds = attachmentsTokenExpirationSeconds; + return this; + } + + /** + * Number of seconds representing the expiration time of the generated media tokens for private attachments. The JWT will be valid for 2 hours by default. See See <a href=\"https://docs.smooch.io/guide/private-attachments/\">Private Attachments</a> for more information. + * @return attachmentsTokenExpirationSeconds + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "64028", value = "Number of seconds representing the expiration time of the generated media tokens for private attachments. The JWT will be valid for 2 hours by default. See See Private Attachments for more information. ") + @JsonProperty(JSON_PROPERTY_ATTACHMENTS_TOKEN_EXPIRATION_SECONDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAttachmentsTokenExpirationSeconds() { + return attachmentsTokenExpirationSeconds; + } + + + public void setAttachmentsTokenExpirationSeconds(String attachmentsTokenExpirationSeconds) { + this.attachmentsTokenExpirationSeconds = attachmentsTokenExpirationSeconds; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppSettings appSettings = (AppSettings) o; + return Objects.equals(this.conversationRetentionSeconds, appSettings.conversationRetentionSeconds) && + Objects.equals(this.maskCreditCardNumbers, appSettings.maskCreditCardNumbers) && + Objects.equals(this.useAnimalNames, appSettings.useAnimalNames) && + Objects.equals(this.echoPostback, appSettings.echoPostback) && + Objects.equals(this.ignoreAutoConversationStart, appSettings.ignoreAutoConversationStart) && + Objects.equals(this.multiConvoEnabled, appSettings.multiConvoEnabled) && + Objects.equals(this.attachmentsAccess, appSettings.attachmentsAccess) && + Objects.equals(this.attachmentsTokenExpirationSeconds, appSettings.attachmentsTokenExpirationSeconds); + } + + @Override + public int hashCode() { + return Objects.hash(conversationRetentionSeconds, maskCreditCardNumbers, useAnimalNames, echoPostback, ignoreAutoConversationStart, multiConvoEnabled, attachmentsAccess, attachmentsTokenExpirationSeconds); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppSettings {\n"); + sb.append(" conversationRetentionSeconds: ").append(toIndentedString(conversationRetentionSeconds)).append("\n"); + sb.append(" maskCreditCardNumbers: ").append(toIndentedString(maskCreditCardNumbers)).append("\n"); + sb.append(" useAnimalNames: ").append(toIndentedString(useAnimalNames)).append("\n"); + sb.append(" echoPostback: ").append(toIndentedString(echoPostback)).append("\n"); + sb.append(" ignoreAutoConversationStart: ").append(toIndentedString(ignoreAutoConversationStart)).append("\n"); + sb.append(" multiConvoEnabled: ").append(toIndentedString(multiConvoEnabled)).append("\n"); + sb.append(" attachmentsAccess: ").append(toIndentedString(attachmentsAccess)).append("\n"); + sb.append(" attachmentsTokenExpirationSeconds: ").append(toIndentedString(attachmentsTokenExpirationSeconds)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AppSubSchema.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppSubSchema.java new file mode 100644 index 00000000..edf60abe --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppSubSchema.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The app that triggered the events. + */ +@ApiModel(description = "The app that triggered the events.") +@JsonPropertyOrder({ + AppSubSchema.JSON_PROPERTY_ID +}) + +public class AppSubSchema { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + + public AppSubSchema id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the app. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5e4af71a81966cfff3ef6550", value = "The unique ID of the app.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppSubSchema appSubSchema = (AppSubSchema) o; + return Objects.equals(this.id, appSubSchema.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppSubSchema {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AppUpdateBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppUpdateBody.java new file mode 100644 index 00000000..f7742982 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppUpdateBody.java @@ -0,0 +1,178 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.AppSettings; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AppUpdateBody + */ +@JsonPropertyOrder({ + AppUpdateBody.JSON_PROPERTY_DISPLAY_NAME, + AppUpdateBody.JSON_PROPERTY_SETTINGS, + AppUpdateBody.JSON_PROPERTY_METADATA +}) + +public class AppUpdateBody { + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private String displayName = null; + + public static final String JSON_PROPERTY_SETTINGS = "settings"; + private AppSettings settings; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public AppUpdateBody displayName(String displayName) { + + this.displayName = displayName; + return this; + } + + /** + * The friendly name of the app. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "My App", value = "The friendly name of the app.") + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDisplayName() { + return displayName; + } + + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + + public AppUpdateBody settings(AppSettings settings) { + + this.settings = settings; + return this; + } + + /** + * Get settings + * @return settings + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SETTINGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AppSettings getSettings() { + return settings; + } + + + public void setSettings(AppSettings settings) { + this.settings = settings; + } + + + public AppUpdateBody metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppUpdateBody appUpdateBody = (AppUpdateBody) o; + return Objects.equals(this.displayName, appUpdateBody.displayName) && + Objects.equals(this.settings, appUpdateBody.settings) && + Objects.equals(this.metadata, appUpdateBody.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(displayName, settings, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppUpdateBody {\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Apple.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Apple.java new file mode 100644 index 00000000..20f432a2 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Apple.java @@ -0,0 +1,231 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Android; +import com.zendesk.sunshine_conversations_client.model.Apple; +import com.zendesk.sunshine_conversations_client.model.AppleAllOf; +import com.zendesk.sunshine_conversations_client.model.Custom; +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.Ios; +import com.zendesk.sunshine_conversations_client.model.Line; +import com.zendesk.sunshine_conversations_client.model.Mailgun; +import com.zendesk.sunshine_conversations_client.model.MessageBird; +import com.zendesk.sunshine_conversations_client.model.Messenger; +import com.zendesk.sunshine_conversations_client.model.Status; +import com.zendesk.sunshine_conversations_client.model.Telegram; +import com.zendesk.sunshine_conversations_client.model.Twilio; +import com.zendesk.sunshine_conversations_client.model.Twitter; +import com.zendesk.sunshine_conversations_client.model.Viber; +import com.zendesk.sunshine_conversations_client.model.Web; +import com.zendesk.sunshine_conversations_client.model.Whatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Apple + */ +@JsonPropertyOrder({ + Apple.JSON_PROPERTY_TYPE, + Apple.JSON_PROPERTY_BUSINESS_ID, + Apple.JSON_PROPERTY_API_SECRET, + Apple.JSON_PROPERTY_MSP_ID +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Android.class, name = "android"), + @JsonSubTypes.Type(value = Apple.class, name = "apple"), + @JsonSubTypes.Type(value = Custom.class, name = "custom"), + @JsonSubTypes.Type(value = Ios.class, name = "ios"), + @JsonSubTypes.Type(value = Line.class, name = "line"), + @JsonSubTypes.Type(value = Mailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messagebird"), + @JsonSubTypes.Type(value = Messenger.class, name = "messenger"), + @JsonSubTypes.Type(value = Telegram.class, name = "telegram"), + @JsonSubTypes.Type(value = Twilio.class, name = "twilio"), + @JsonSubTypes.Type(value = Twitter.class, name = "twitter"), + @JsonSubTypes.Type(value = Viber.class, name = "viber"), + @JsonSubTypes.Type(value = Web.class, name = "web"), + @JsonSubTypes.Type(value = Whatsapp.class, name = "whatsapp"), +}) + +public class Apple extends Integration { + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type = "apple"; + + public static final String JSON_PROPERTY_BUSINESS_ID = "businessId"; + private String businessId; + + public static final String JSON_PROPERTY_API_SECRET = "apiSecret"; + private String apiSecret; + + public static final String JSON_PROPERTY_MSP_ID = "mspId"; + private String mspId; + + + public Apple type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Apple businessId(String businessId) { + + this.businessId = businessId; + return this; + } + + /** + * Apple Business Chat ID. + * @return businessId + **/ + @ApiModelProperty(example = "2740f141-89c1-515f-07eb-1128dd73491", required = true, value = "Apple Business Chat ID.") + @JsonProperty(JSON_PROPERTY_BUSINESS_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getBusinessId() { + return businessId; + } + + + public void setBusinessId(String businessId) { + this.businessId = businessId; + } + + + public Apple apiSecret(String apiSecret) { + + this.apiSecret = apiSecret; + return this; + } + + /** + * Your Apple API secret which is tied to your Messaging Service Provider. + * @return apiSecret + **/ + @ApiModelProperty(example = "QLA//Z13paUYo/2tLReQa-43c5JEAASujGamiY/QTvs=", required = true, value = "Your Apple API secret which is tied to your Messaging Service Provider.") + @JsonProperty(JSON_PROPERTY_API_SECRET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getApiSecret() { + return apiSecret; + } + + + public void setApiSecret(String apiSecret) { + this.apiSecret = apiSecret; + } + + + public Apple mspId(String mspId) { + + this.mspId = mspId; + return this; + } + + /** + * Your Messaging Service Provider ID. + * @return mspId + **/ + @ApiModelProperty(example = "e7e495d5-bf78-531d-baf6-7f419f7fb592", required = true, value = "Your Messaging Service Provider ID.") + @JsonProperty(JSON_PROPERTY_MSP_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getMspId() { + return mspId; + } + + + public void setMspId(String mspId) { + this.mspId = mspId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Apple apple = (Apple) o; + return Objects.equals(this.type, apple.type) && + Objects.equals(this.businessId, apple.businessId) && + Objects.equals(this.apiSecret, apple.apiSecret) && + Objects.equals(this.mspId, apple.mspId) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, businessId, apiSecret, mspId, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Apple {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" businessId: ").append(toIndentedString(businessId)).append("\n"); + sb.append(" apiSecret: ").append(toIndentedString(apiSecret)).append("\n"); + sb.append(" mspId: ").append(toIndentedString(mspId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AppleAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppleAllOf.java new file mode 100644 index 00000000..e22d1ba3 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppleAllOf.java @@ -0,0 +1,193 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * To configure an Apple Business Chat integration, acquire the required information and call the Create Integration endpoint. + */ +@ApiModel(description = "To configure an Apple Business Chat integration, acquire the required information and call the Create Integration endpoint. ") +@JsonPropertyOrder({ + AppleAllOf.JSON_PROPERTY_TYPE, + AppleAllOf.JSON_PROPERTY_BUSINESS_ID, + AppleAllOf.JSON_PROPERTY_API_SECRET, + AppleAllOf.JSON_PROPERTY_MSP_ID +}) + +public class AppleAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "apple"; + + public static final String JSON_PROPERTY_BUSINESS_ID = "businessId"; + private String businessId; + + public static final String JSON_PROPERTY_API_SECRET = "apiSecret"; + private String apiSecret; + + public static final String JSON_PROPERTY_MSP_ID = "mspId"; + private String mspId; + + + public AppleAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public AppleAllOf businessId(String businessId) { + + this.businessId = businessId; + return this; + } + + /** + * Apple Business Chat ID. + * @return businessId + **/ + @ApiModelProperty(example = "2740f141-89c1-515f-07eb-1128dd73491", required = true, value = "Apple Business Chat ID.") + @JsonProperty(JSON_PROPERTY_BUSINESS_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getBusinessId() { + return businessId; + } + + + public void setBusinessId(String businessId) { + this.businessId = businessId; + } + + + public AppleAllOf apiSecret(String apiSecret) { + + this.apiSecret = apiSecret; + return this; + } + + /** + * Your Apple API secret which is tied to your Messaging Service Provider. + * @return apiSecret + **/ + @ApiModelProperty(example = "QLA//Z13paUYo/2tLReQa-43c5JEAASujGamiY/QTvs=", required = true, value = "Your Apple API secret which is tied to your Messaging Service Provider.") + @JsonProperty(JSON_PROPERTY_API_SECRET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getApiSecret() { + return apiSecret; + } + + + public void setApiSecret(String apiSecret) { + this.apiSecret = apiSecret; + } + + + public AppleAllOf mspId(String mspId) { + + this.mspId = mspId; + return this; + } + + /** + * Your Messaging Service Provider ID. + * @return mspId + **/ + @ApiModelProperty(example = "e7e495d5-bf78-531d-baf6-7f419f7fb592", required = true, value = "Your Messaging Service Provider ID.") + @JsonProperty(JSON_PROPERTY_MSP_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getMspId() { + return mspId; + } + + + public void setMspId(String mspId) { + this.mspId = mspId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppleAllOf appleAllOf = (AppleAllOf) o; + return Objects.equals(this.type, appleAllOf.type) && + Objects.equals(this.businessId, appleAllOf.businessId) && + Objects.equals(this.apiSecret, appleAllOf.apiSecret) && + Objects.equals(this.mspId, appleAllOf.mspId); + } + + @Override + public int hashCode() { + return Objects.hash(type, businessId, apiSecret, mspId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppleAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" businessId: ").append(toIndentedString(businessId)).append("\n"); + sb.append(" apiSecret: ").append(toIndentedString(apiSecret)).append("\n"); + sb.append(" mspId: ").append(toIndentedString(mspId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AppleUpdate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppleUpdate.java new file mode 100644 index 00000000..101fabad --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AppleUpdate.java @@ -0,0 +1,79 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdateBase; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdate; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AppleUpdate + */ +@JsonPropertyOrder({ +}) + +public class AppleUpdate extends IntegrationUpdateBase implements IntegrationUpdate { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppleUpdate {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentDeleteBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentDeleteBody.java new file mode 100644 index 00000000..43b4e059 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentDeleteBody.java @@ -0,0 +1,101 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AttachmentDeleteBody + */ +@JsonPropertyOrder({ + AttachmentDeleteBody.JSON_PROPERTY_MEDIA_URL +}) + +public class AttachmentDeleteBody { + public static final String JSON_PROPERTY_MEDIA_URL = "mediaUrl"; + private String mediaUrl; + + + public AttachmentDeleteBody mediaUrl(String mediaUrl) { + + this.mediaUrl = mediaUrl; + return this; + } + + /** + * The media URL used for a file or image message. + * @return mediaUrl + **/ + @ApiModelProperty(example = "https://s3.amazonaws.com/document.pdf", required = true, value = "The media URL used for a file or image message.") + @JsonProperty(JSON_PROPERTY_MEDIA_URL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getMediaUrl() { + return mediaUrl; + } + + + public void setMediaUrl(String mediaUrl) { + this.mediaUrl = mediaUrl; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AttachmentDeleteBody attachmentDeleteBody = (AttachmentDeleteBody) o; + return Objects.equals(this.mediaUrl, attachmentDeleteBody.mediaUrl); + } + + @Override + public int hashCode() { + return Objects.hash(mediaUrl); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AttachmentDeleteBody {\n"); + sb.append(" mediaUrl: ").append(toIndentedString(mediaUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentMediaTokenBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentMediaTokenBody.java new file mode 100644 index 00000000..d9b328cf --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentMediaTokenBody.java @@ -0,0 +1,108 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AttachmentMediaTokenBody + */ +@JsonPropertyOrder({ + AttachmentMediaTokenBody.JSON_PROPERTY_PATHS +}) + +public class AttachmentMediaTokenBody { + public static final String JSON_PROPERTY_PATHS = "paths"; + private List paths = new ArrayList(); + + + public AttachmentMediaTokenBody paths(List paths) { + + this.paths = paths; + return this; + } + + public AttachmentMediaTokenBody addPathsItem(String pathsItem) { + this.paths.add(pathsItem); + return this; + } + + /** + * An array of strings representing the list of attachment paths used to generate the media JWT. One token will be generated for each path. Each token will be valid for 2 hours by default. This value can be modified, see [App Settings](#operation/createApp) for more information. + * @return paths + **/ + @ApiModelProperty(required = true, value = "An array of strings representing the list of attachment paths used to generate the media JWT. One token will be generated for each path. Each token will be valid for 2 hours by default. This value can be modified, see [App Settings](#operation/createApp) for more information.") + @JsonProperty(JSON_PROPERTY_PATHS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getPaths() { + return paths; + } + + + public void setPaths(List paths) { + this.paths = paths; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AttachmentMediaTokenBody attachmentMediaTokenBody = (AttachmentMediaTokenBody) o; + return Objects.equals(this.paths, attachmentMediaTokenBody.paths); + } + + @Override + public int hashCode() { + return Objects.hash(paths); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AttachmentMediaTokenBody {\n"); + sb.append(" paths: ").append(toIndentedString(paths)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentMediaTokenResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentMediaTokenResponse.java new file mode 100644 index 00000000..6702158d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentMediaTokenResponse.java @@ -0,0 +1,113 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AttachmentMediaTokenResponse + */ +@JsonPropertyOrder({ + AttachmentMediaTokenResponse.JSON_PROPERTY_TOKENS +}) + +public class AttachmentMediaTokenResponse { + public static final String JSON_PROPERTY_TOKENS = "tokens"; + private Map tokens = null; + + + public AttachmentMediaTokenResponse tokens(Map tokens) { + + this.tokens = tokens; + return this; + } + + public AttachmentMediaTokenResponse putTokensItem(String key, String tokensItem) { + if (this.tokens == null) { + this.tokens = new HashMap(); + } + this.tokens.put(key, tokensItem); + return this; + } + + /** + * Object with key value pair where the key is the path and the value is the media JWT. + * @return tokens + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"/apps/5ec41c54fe13cc5ac404bedc\":\"eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCIsImtpZCI6IjM3NzdBNUM3LUI3QUQtNDEyMC1BNEVDLUNBNzk1ODlDRTYxNSJ9.eyJwYXRoIjoiL2FwcHMvNWVkYTk3ZDBhNmQ5ZmUwMDBmN2U2ODQyIiwiZXhwIjoxNTkzMjA2MzEzLCJpYXQiOjE1OTMxOTkxMTN9.R1i7e5YgRHv_QjUqUcP9c5xa4VgJ5aen675V84r1euCjNz165qqkZaep6of7aXNBKsZ29AI1CgbVt_nPn3ZsYTBc1cQ96ucqTv8tFR0FHf20-oR-_1egdyyLqJjxb0UI1wGZPGCP8mEs3mQwMu4lvZMF9vaty1Ye8wy-lPAPYFuZMb1rCES0QT6QUOAn45hAAfdT1zKqQ8ImV5eWVi6m0ENqV-JjExsiZ2mAMwyguDJ5yJUQLGKOV3f_Our1fVWfit5cGoMk-97o3009o628gVfSZVzPuvdNIfQOb0UUr_ELsI2qbY_Ju4REpSqYwdkjvSd3T20baf5K7_FGOrxPQitHAZojQAdlRK3mB-kC3IbVa93YFBcLK5UbRXnJYAo24UH828vU-MLgRrgzD6oVpcxNk8yyaLThJpTynO9Eoi0vKJ0m-_3A1ASKzYrR6ZZZWmRsFtZVtlpS21oYuO2tvS4EkbM8AhH4nh6V8oQUkQtvYIZKkEOadc0AFTjbv-le35hHLmHBZigUTRoZKokeglSDKr0FwDZylp7V3O8l6X0EhOU0BCoP1UYrEf8GjPdSLvu0Mno_k6hFw2Hx9DTdvnybZYroMkG31To2nmVhPglZ4FCswGV85HcqCcWQjhugFmB--9aE19G-OGOVFJfH6rFp0_cB4AxM9kSHQsWyuUs\"}", value = "Object with key value pair where the key is the path and the value is the media JWT.") + @JsonProperty(JSON_PROPERTY_TOKENS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getTokens() { + return tokens; + } + + + public void setTokens(Map tokens) { + this.tokens = tokens; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AttachmentMediaTokenResponse attachmentMediaTokenResponse = (AttachmentMediaTokenResponse) o; + return Objects.equals(this.tokens, attachmentMediaTokenResponse.tokens); + } + + @Override + public int hashCode() { + return Objects.hash(tokens); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AttachmentMediaTokenResponse {\n"); + sb.append(" tokens: ").append(toIndentedString(tokens)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentResponse.java new file mode 100644 index 00000000..a73f6f4d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentResponse.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.AttachmentSchema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AttachmentResponse + */ +@JsonPropertyOrder({ + AttachmentResponse.JSON_PROPERTY_ATTACHMENT +}) + +public class AttachmentResponse { + public static final String JSON_PROPERTY_ATTACHMENT = "attachment"; + private AttachmentSchema attachment = null; + + + public AttachmentResponse attachment(AttachmentSchema attachment) { + + this.attachment = attachment; + return this; + } + + /** + * The uploaded attachment object. + * @return attachment + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The uploaded attachment object.") + @JsonProperty(JSON_PROPERTY_ATTACHMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AttachmentSchema getAttachment() { + return attachment; + } + + + public void setAttachment(AttachmentSchema attachment) { + this.attachment = attachment; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AttachmentResponse attachmentResponse = (AttachmentResponse) o; + return Objects.equals(this.attachment, attachmentResponse.attachment); + } + + @Override + public int hashCode() { + return Objects.hash(attachment); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AttachmentResponse {\n"); + sb.append(" attachment: ").append(toIndentedString(attachment)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentSchema.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentSchema.java new file mode 100644 index 00000000..39b30d9e --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentSchema.java @@ -0,0 +1,133 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AttachmentSchema + */ +@JsonPropertyOrder({ + AttachmentSchema.JSON_PROPERTY_MEDIA_URL, + AttachmentSchema.JSON_PROPERTY_MEDIA_TYPE +}) + +public class AttachmentSchema { + public static final String JSON_PROPERTY_MEDIA_URL = "mediaUrl"; + private String mediaUrl; + + public static final String JSON_PROPERTY_MEDIA_TYPE = "mediaType"; + private String mediaType; + + + public AttachmentSchema mediaUrl(String mediaUrl) { + + this.mediaUrl = mediaUrl; + return this; + } + + /** + * Uploaded attachment’s url + * @return mediaUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "http://smooch.io/rocks.smooch.media-dev/apps/5ec41c54fe13cc5ac404bedc/conversations/c616a583e4c240a871818541/TmYMVQUBNsQRItX4fKf4aC-T/Screen%20Shot%202020-09-02%20at%204.04.41%20PM.png", value = "Uploaded attachment’s url") + @JsonProperty(JSON_PROPERTY_MEDIA_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMediaUrl() { + return mediaUrl; + } + + + public void setMediaUrl(String mediaUrl) { + this.mediaUrl = mediaUrl; + } + + + public AttachmentSchema mediaType(String mediaType) { + + this.mediaType = mediaType; + return this; + } + + /** + * Uploaded attachment's media type + * @return mediaType + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "image/png", value = "Uploaded attachment's media type") + @JsonProperty(JSON_PROPERTY_MEDIA_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMediaType() { + return mediaType; + } + + + public void setMediaType(String mediaType) { + this.mediaType = mediaType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AttachmentSchema attachmentSchema = (AttachmentSchema) o; + return Objects.equals(this.mediaUrl, attachmentSchema.mediaUrl) && + Objects.equals(this.mediaType, attachmentSchema.mediaType); + } + + @Override + public int hashCode() { + return Objects.hash(mediaUrl, mediaType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AttachmentSchema {\n"); + sb.append(" mediaUrl: ").append(toIndentedString(mediaUrl)).append("\n"); + sb.append(" mediaType: ").append(toIndentedString(mediaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentUploadBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentUploadBody.java new file mode 100644 index 00000000..8259d7c5 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AttachmentUploadBody.java @@ -0,0 +1,102 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * AttachmentUploadBody + */ +@JsonPropertyOrder({ + AttachmentUploadBody.JSON_PROPERTY_SOURCE +}) + +public class AttachmentUploadBody { + public static final String JSON_PROPERTY_SOURCE = "source"; + private File source; + + + public AttachmentUploadBody source(File source) { + + this.source = source; + return this; + } + + /** + * Get source + * @return source + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public File getSource() { + return source; + } + + + public void setSource(File source) { + this.source = source; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AttachmentUploadBody attachmentUploadBody = (AttachmentUploadBody) o; + return Objects.equals(this.source, attachmentUploadBody.source); + } + + @Override + public int hashCode() { + return Objects.hash(source); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AttachmentUploadBody {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Author.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Author.java new file mode 100644 index 00000000..ee126e7a --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Author.java @@ -0,0 +1,262 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The author of the message. + */ +@ApiModel(description = "The author of the message.") +@JsonPropertyOrder({ + Author.JSON_PROPERTY_TYPE, + Author.JSON_PROPERTY_USER_ID, + Author.JSON_PROPERTY_USER_EXTERNAL_ID, + Author.JSON_PROPERTY_DISPLAY_NAME, + Author.JSON_PROPERTY_AVATAR_URL +}) + +public class Author { + /** + * The type of the author. + */ + public enum TypeEnum { + BUSINESS("business"), + + USER("user"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public static final String JSON_PROPERTY_USER_ID = "userId"; + private String userId; + + public static final String JSON_PROPERTY_USER_EXTERNAL_ID = "userExternalId"; + private String userExternalId; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private String displayName; + + public static final String JSON_PROPERTY_AVATAR_URL = "avatarUrl"; + private URI avatarUrl = null; + + + public Author type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * The type of the author. + * @return type + **/ + @ApiModelProperty(example = "business", required = true, value = "The type of the author.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public Author userId(String userId) { + + this.userId = userId; + return this; + } + + /** + * The id of the user. Only supported when `type` is user. + * @return userId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5963c0d619a30a2e00de36b8", value = "The id of the user. Only supported when `type` is user.") + @JsonProperty(JSON_PROPERTY_USER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUserId() { + return userId; + } + + + public void setUserId(String userId) { + this.userId = userId; + } + + + public Author userExternalId(String userExternalId) { + + this.userExternalId = userExternalId; + return this; + } + + /** + * The externalId of the user. Only supported when `type` is user. + * @return userExternalId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your-own-id", value = "The externalId of the user. Only supported when `type` is user.") + @JsonProperty(JSON_PROPERTY_USER_EXTERNAL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUserExternalId() { + return userExternalId; + } + + + public void setUserExternalId(String userExternalId) { + this.userExternalId = userExternalId; + } + + + public Author displayName(String displayName) { + + this.displayName = displayName; + return this; + } + + /** + * The display name of the message author. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Steve", value = "The display name of the message author.") + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDisplayName() { + return displayName; + } + + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + + public Author avatarUrl(URI avatarUrl) { + + this.avatarUrl = avatarUrl; + return this; + } + + /** + * A custom message icon url. The image must be in either JPG, PNG, or GIF format + * @return avatarUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A custom message icon url. The image must be in either JPG, PNG, or GIF format") + @JsonProperty(JSON_PROPERTY_AVATAR_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public URI getAvatarUrl() { + return avatarUrl; + } + + + public void setAvatarUrl(URI avatarUrl) { + this.avatarUrl = avatarUrl; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Author author = (Author) o; + return Objects.equals(this.type, author.type) && + Objects.equals(this.userId, author.userId) && + Objects.equals(this.userExternalId, author.userExternalId) && + Objects.equals(this.displayName, author.displayName) && + Objects.equals(this.avatarUrl, author.avatarUrl); + } + + @Override + public int hashCode() { + return Objects.hash(type, userId, userExternalId, displayName, avatarUrl); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Author {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" userExternalId: ").append(toIndentedString(userExternalId)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" avatarUrl: ").append(toIndentedString(avatarUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/AuthorWebhook.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/AuthorWebhook.java new file mode 100644 index 00000000..e1cc088d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/AuthorWebhook.java @@ -0,0 +1,200 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.User; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The author of the activity. + */ +@ApiModel(description = "The author of the activity.") +@JsonPropertyOrder({ + AuthorWebhook.JSON_PROPERTY_TYPE, + AuthorWebhook.JSON_PROPERTY_USER_ID, + AuthorWebhook.JSON_PROPERTY_USER +}) + +public class AuthorWebhook { + /** + * The role of the message or activity. + */ + public enum TypeEnum { + BUSINESS("business"), + + USER("user"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public static final String JSON_PROPERTY_USER_ID = "userId"; + private String userId; + + public static final String JSON_PROPERTY_USER = "user"; + private User user = null; + + + public AuthorWebhook type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * The role of the message or activity. + * @return type + **/ + @ApiModelProperty(required = true, value = "The role of the message or activity.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public AuthorWebhook userId(String userId) { + + this.userId = userId; + return this; + } + + /** + * The id of the user. Only supported when role is `user`. + * @return userId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5963c0d619a30a2e00de36b8", value = "The id of the user. Only supported when role is `user`.") + @JsonProperty(JSON_PROPERTY_USER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUserId() { + return userId; + } + + + public void setUserId(String userId) { + this.userId = userId; + } + + + public AuthorWebhook user(User user) { + + this.user = user; + return this; + } + + /** + * Full profile of the user that authored the message or activity. It is used only in webhook payloads if the `includeFullUser` option is enabled. + * @return user + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Full profile of the user that authored the message or activity. It is used only in webhook payloads if the `includeFullUser` option is enabled.") + @JsonProperty(JSON_PROPERTY_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public User getUser() { + return user; + } + + + public void setUser(User user) { + this.user = user; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthorWebhook authorWebhook = (AuthorWebhook) o; + return Objects.equals(this.type, authorWebhook.type) && + Objects.equals(this.userId, authorWebhook.userId) && + Objects.equals(this.user, authorWebhook.user); + } + + @Override + public int hashCode() { + return Objects.hash(type, userId, user); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthorWebhook {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" user: ").append(toIndentedString(user)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Buy.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Buy.java new file mode 100644 index 00000000..38143e09 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Buy.java @@ -0,0 +1,241 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.zendesk.sunshine_conversations_client.model.Action; +import com.zendesk.sunshine_conversations_client.model.ActionSubset; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Buy + */ +@JsonPropertyOrder({ + Buy.JSON_PROPERTY_TYPE, + Buy.JSON_PROPERTY_TEXT, + Buy.JSON_PROPERTY_AMOUNT, + Buy.JSON_PROPERTY_CURRENCY, + Buy.JSON_PROPERTY_METADATA +}) + +public class Buy implements Action, ActionSubset { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "buy"; + + public static final String JSON_PROPERTY_TEXT = "text"; + private String text; + + public static final String JSON_PROPERTY_AMOUNT = "amount"; + private Integer amount; + + public static final String JSON_PROPERTY_CURRENCY = "currency"; + private String currency; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public Buy type(String type) { + + this.type = type; + return this; + } + + /** + * The type of action. + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of action.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Buy text(String text) { + + this.text = text; + return this; + } + + /** + * The button text. + * @return text + **/ + @ApiModelProperty(example = "Buy vinegar", required = true, value = "The button text.") + @JsonProperty(JSON_PROPERTY_TEXT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public Buy amount(Integer amount) { + + this.amount = amount; + return this; + } + + /** + * The amount being charged. It needs to be specified in cents and is an integer (9.99$ -> 999). + * @return amount + **/ + @ApiModelProperty(example = "8000", required = true, value = "The amount being charged. It needs to be specified in cents and is an integer (9.99$ -> 999).") + @JsonProperty(JSON_PROPERTY_AMOUNT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Integer getAmount() { + return amount; + } + + + public void setAmount(Integer amount) { + this.amount = amount; + } + + + public Buy currency(String currency) { + + this.currency = currency; + return this; + } + + /** + * An ISO 4217 standard currency code in lowercase. Used for actions of type buy. + * @return currency + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "CAD", value = "An ISO 4217 standard currency code in lowercase. Used for actions of type buy.") + @JsonProperty(JSON_PROPERTY_CURRENCY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCurrency() { + return currency; + } + + + public void setCurrency(String currency) { + this.currency = currency; + } + + + public Buy metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Buy buy = (Buy) o; + return Objects.equals(this.type, buy.type) && + Objects.equals(this.text, buy.text) && + Objects.equals(this.amount, buy.amount) && + Objects.equals(this.currency, buy.currency) && + Objects.equals(this.metadata, buy.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(type, text, amount, currency, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Buy {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); + sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/CarouselMessage.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/CarouselMessage.java new file mode 100644 index 00000000..c48c1552 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/CarouselMessage.java @@ -0,0 +1,199 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.CarouselMessageDisplaySettings; +import com.zendesk.sunshine_conversations_client.model.Item; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.zendesk.sunshine_conversations_client.model.Content; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.math.BigDecimal; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Carousel messages are a horizontally scrollable set of items that may each contain text, an image, and message actions. Not all messaging channels fully support carousel messages; currently only Facebook Messenger, LINE, Telegram, Viber, the Web Messenger, the Android SDK and the iOS SDK cover the full functionality. For all other platforms a carousel message is rendered as raw text. The raw text fallback does not include any images or postback message actions. + */ +@ApiModel(description = "Carousel messages are a horizontally scrollable set of items that may each contain text, an image, and message actions. Not all messaging channels fully support carousel messages; currently only Facebook Messenger, LINE, Telegram, Viber, the Web Messenger, the Android SDK and the iOS SDK cover the full functionality. For all other platforms a carousel message is rendered as raw text. The raw text fallback does not include any images or postback message actions.") +@JsonPropertyOrder({ + CarouselMessage.JSON_PROPERTY_TYPE, + CarouselMessage.JSON_PROPERTY_TEXT, + CarouselMessage.JSON_PROPERTY_ITEMS, + CarouselMessage.JSON_PROPERTY_DISPLAY_SETTINGS +}) + +public class CarouselMessage implements Content { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "carousel"; + + public static final String JSON_PROPERTY_TEXT = "text"; + private String text; + + public static final String JSON_PROPERTY_ITEMS = "items"; + private List items = new ArrayList(); + + public static final String JSON_PROPERTY_DISPLAY_SETTINGS = "displaySettings"; + private CarouselMessageDisplaySettings displaySettings; + + + public CarouselMessage type(String type) { + + this.type = type; + return this; + } + + /** + * The type of message. + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of message.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + /** + * The fallback text message used when carousel messages are not supported by the channel. + * @return text + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The fallback text message used when carousel messages are not supported by the channel.") + @JsonProperty(JSON_PROPERTY_TEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getText() { + return text; + } + + + + + public CarouselMessage items(List items) { + + this.items = items; + return this; + } + + public CarouselMessage addItemsItem(Item itemsItem) { + this.items.add(itemsItem); + return this; + } + + /** + * An array of objects representing the items associated with the message. Only present in carousel and list type messages. + * @return items + **/ + @ApiModelProperty(required = true, value = "An array of objects representing the items associated with the message. Only present in carousel and list type messages.") + @JsonProperty(JSON_PROPERTY_ITEMS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getItems() { + return items; + } + + + public void setItems(List items) { + this.items = items; + } + + + public CarouselMessage displaySettings(CarouselMessageDisplaySettings displaySettings) { + + this.displaySettings = displaySettings; + return this; + } + + /** + * Get displaySettings + * @return displaySettings + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DISPLAY_SETTINGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public CarouselMessageDisplaySettings getDisplaySettings() { + return displaySettings; + } + + + public void setDisplaySettings(CarouselMessageDisplaySettings displaySettings) { + this.displaySettings = displaySettings; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CarouselMessage carouselMessage = (CarouselMessage) o; + return Objects.equals(this.type, carouselMessage.type) && + Objects.equals(this.text, carouselMessage.text) && + Objects.equals(this.items, carouselMessage.items) && + Objects.equals(this.displaySettings, carouselMessage.displaySettings); + } + + @Override + public int hashCode() { + return Objects.hash(type, text, items, displaySettings); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CarouselMessage {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" displaySettings: ").append(toIndentedString(displaySettings)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/CarouselMessageDisplaySettings.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/CarouselMessageDisplaySettings.java new file mode 100644 index 00000000..d213530f --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/CarouselMessageDisplaySettings.java @@ -0,0 +1,138 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Settings to adjust the carousel layout. + */ +@ApiModel(description = "Settings to adjust the carousel layout.") +@JsonPropertyOrder({ + CarouselMessageDisplaySettings.JSON_PROPERTY_IMAGE_ASPECT_RATIO +}) + +public class CarouselMessageDisplaySettings { + /** + * Specifies how to display all carousel images. Valid values are horizontal (default) and square. Only supported in Facebook Messenger, Web Messenger, Android SDK and iOS SDK carousels. + */ + public enum ImageAspectRatioEnum { + HORIZONTAL("horizontal"), + + SQUARE("square"); + + private String value; + + ImageAspectRatioEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ImageAspectRatioEnum fromValue(String value) { + for (ImageAspectRatioEnum b : ImageAspectRatioEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_IMAGE_ASPECT_RATIO = "imageAspectRatio"; + private ImageAspectRatioEnum imageAspectRatio; + + + public CarouselMessageDisplaySettings imageAspectRatio(ImageAspectRatioEnum imageAspectRatio) { + + this.imageAspectRatio = imageAspectRatio; + return this; + } + + /** + * Specifies how to display all carousel images. Valid values are horizontal (default) and square. Only supported in Facebook Messenger, Web Messenger, Android SDK and iOS SDK carousels. + * @return imageAspectRatio + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specifies how to display all carousel images. Valid values are horizontal (default) and square. Only supported in Facebook Messenger, Web Messenger, Android SDK and iOS SDK carousels.") + @JsonProperty(JSON_PROPERTY_IMAGE_ASPECT_RATIO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ImageAspectRatioEnum getImageAspectRatio() { + return imageAspectRatio; + } + + + public void setImageAspectRatio(ImageAspectRatioEnum imageAspectRatio) { + this.imageAspectRatio = imageAspectRatio; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CarouselMessageDisplaySettings carouselMessageDisplaySettings = (CarouselMessageDisplaySettings) o; + return Objects.equals(this.imageAspectRatio, carouselMessageDisplaySettings.imageAspectRatio); + } + + @Override + public int hashCode() { + return Objects.hash(imageAspectRatio); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CarouselMessageDisplaySettings {\n"); + sb.append(" imageAspectRatio: ").append(toIndentedString(imageAspectRatio)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Client.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Client.java new file mode 100644 index 00000000..8c7b6a1f --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Client.java @@ -0,0 +1,536 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ClientType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Client + */ +@JsonPropertyOrder({ + Client.JSON_PROPERTY_ID, + Client.JSON_PROPERTY_TYPE, + Client.JSON_PROPERTY_STATUS, + Client.JSON_PROPERTY_INTEGRATION_ID, + Client.JSON_PROPERTY_EXTERNAL_ID, + Client.JSON_PROPERTY_LAST_SEEN, + Client.JSON_PROPERTY_LINKED_AT, + Client.JSON_PROPERTY_DISPLAY_NAME, + Client.JSON_PROPERTY_AVATAR_URL, + Client.JSON_PROPERTY_INFO, + Client.JSON_PROPERTY_RAW +}) + +public class Client { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ClientType type; + + /** + * The client status. Indicates if the client is able to receive messages or not. Can be pending, inactive, active, or blocked. + */ + public enum StatusEnum { + ACTIVE("active"), + + BLOCKED("blocked"), + + INACTIVE("inactive"), + + PENDING("pending"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + private StatusEnum status; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integrationId"; + private JsonNullable integrationId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_EXTERNAL_ID = "externalId"; + private JsonNullable externalId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_LAST_SEEN = "lastSeen"; + private JsonNullable lastSeen = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_LINKED_AT = "linkedAt"; + private JsonNullable linkedAt = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private JsonNullable displayName = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_AVATAR_URL = "avatarUrl"; + private JsonNullable avatarUrl = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_INFO = "info"; + private JsonNullable info = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_RAW = "raw"; + private JsonNullable raw = JsonNullable.undefined(); + + + public Client id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the client. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5c9a34160c89726709136733", value = "The unique ID of the client.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Client type(ClientType type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ClientType getType() { + return type; + } + + + public void setType(ClientType type) { + this.type = type; + } + + + public Client status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The client status. Indicates if the client is able to receive messages or not. Can be pending, inactive, active, or blocked. + * @return status + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "active", value = "The client status. Indicates if the client is able to receive messages or not. Can be pending, inactive, active, or blocked.") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public Client integrationId(String integrationId) { + this.integrationId = JsonNullable.of(integrationId); + + return this; + } + + /** + * The ID of the integration that the client was created for. Unused for clients of type sdk, as they incorporate multiple integrations. + * @return integrationId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "582dedf230e788746891281a", value = "The ID of the integration that the client was created for. Unused for clients of type sdk, as they incorporate multiple integrations.") + @JsonIgnore + + public String getIntegrationId() { + return integrationId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getIntegrationId_JsonNullable() { + return integrationId; + } + + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + public void setIntegrationId_JsonNullable(JsonNullable integrationId) { + this.integrationId = integrationId; + } + + public void setIntegrationId(String integrationId) { + this.integrationId = JsonNullable.of(integrationId); + } + + + public Client externalId(String externalId) { + this.externalId = JsonNullable.of(externalId); + + return this; + } + + /** + * The ID of the user on an external channel. For example, the user’s phone number for Twilio, or their page-scoped user ID for Facebook Messenger. Applies only to non-SDK clients. + * @return externalId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your-own-id", value = "The ID of the user on an external channel. For example, the user’s phone number for Twilio, or their page-scoped user ID for Facebook Messenger. Applies only to non-SDK clients.") + @JsonIgnore + + public String getExternalId() { + return externalId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EXTERNAL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getExternalId_JsonNullable() { + return externalId; + } + + @JsonProperty(JSON_PROPERTY_EXTERNAL_ID) + public void setExternalId_JsonNullable(JsonNullable externalId) { + this.externalId = externalId; + } + + public void setExternalId(String externalId) { + this.externalId = JsonNullable.of(externalId); + } + + + public Client lastSeen(String lastSeen) { + this.lastSeen = JsonNullable.of(lastSeen); + + return this; + } + + /** + * A datetime string with the format `YYYY-MM-DDThh:mm:ss.SSSZ` representing the last time the user interacted with this client. + * @return lastSeen + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2020-08-20T16:13:07.462Z", value = "A datetime string with the format `YYYY-MM-DDThh:mm:ss.SSSZ` representing the last time the user interacted with this client.") + @JsonIgnore + + public String getLastSeen() { + return lastSeen.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LAST_SEEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getLastSeen_JsonNullable() { + return lastSeen; + } + + @JsonProperty(JSON_PROPERTY_LAST_SEEN) + public void setLastSeen_JsonNullable(JsonNullable lastSeen) { + this.lastSeen = lastSeen; + } + + public void setLastSeen(String lastSeen) { + this.lastSeen = JsonNullable.of(lastSeen); + } + + + public Client linkedAt(String linkedAt) { + this.linkedAt = JsonNullable.of(linkedAt); + + return this; + } + + /** + * A timestamp signifying when the client was added to the user. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return linkedAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2020-06-23T14:33:47.492Z", value = "A timestamp signifying when the client was added to the user. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonIgnore + + public String getLinkedAt() { + return linkedAt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LINKED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getLinkedAt_JsonNullable() { + return linkedAt; + } + + @JsonProperty(JSON_PROPERTY_LINKED_AT) + public void setLinkedAt_JsonNullable(JsonNullable linkedAt) { + this.linkedAt = linkedAt; + } + + public void setLinkedAt(String linkedAt) { + this.linkedAt = JsonNullable.of(linkedAt); + } + + + public Client displayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + + return this; + } + + /** + * The user's display name on the channel. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Steve", value = "The user's display name on the channel.") + @JsonIgnore + + public String getDisplayName() { + return displayName.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDisplayName_JsonNullable() { + return displayName; + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + public void setDisplayName_JsonNullable(JsonNullable displayName) { + this.displayName = displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + } + + + public Client avatarUrl(URI avatarUrl) { + this.avatarUrl = JsonNullable.of(avatarUrl); + + return this; + } + + /** + * The URL for the user's avatar on the channel. + * @return avatarUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The URL for the user's avatar on the channel.") + @JsonIgnore + + public URI getAvatarUrl() { + return avatarUrl.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_AVATAR_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAvatarUrl_JsonNullable() { + return avatarUrl; + } + + @JsonProperty(JSON_PROPERTY_AVATAR_URL) + public void setAvatarUrl_JsonNullable(JsonNullable avatarUrl) { + this.avatarUrl = avatarUrl; + } + + public void setAvatarUrl(URI avatarUrl) { + this.avatarUrl = JsonNullable.of(avatarUrl); + } + + + public Client info(Object info) { + this.info = JsonNullable.of(info); + + return this; + } + + /** + * A flat curated object with properties that vary for each client platform. All keys are optional and not guaranteed to be available. + * @return info + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A flat curated object with properties that vary for each client platform. All keys are optional and not guaranteed to be available.") + @JsonIgnore + + public Object getInfo() { + return info.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INFO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getInfo_JsonNullable() { + return info; + } + + @JsonProperty(JSON_PROPERTY_INFO) + public void setInfo_JsonNullable(JsonNullable info) { + this.info = info; + } + + public void setInfo(Object info) { + this.info = JsonNullable.of(info); + } + + + public Client raw(Object raw) { + this.raw = JsonNullable.of(raw); + + return this; + } + + /** + * An object with raw properties that vary for each client platform. All keys are optional and not guaranteed to be available. + * @return raw + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "An object with raw properties that vary for each client platform. All keys are optional and not guaranteed to be available.") + @JsonIgnore + + public Object getRaw() { + return raw.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_RAW) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getRaw_JsonNullable() { + return raw; + } + + @JsonProperty(JSON_PROPERTY_RAW) + public void setRaw_JsonNullable(JsonNullable raw) { + this.raw = raw; + } + + public void setRaw(Object raw) { + this.raw = JsonNullable.of(raw); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(this.id, client.id) && + Objects.equals(this.type, client.type) && + Objects.equals(this.status, client.status) && + Objects.equals(this.integrationId, client.integrationId) && + Objects.equals(this.externalId, client.externalId) && + Objects.equals(this.lastSeen, client.lastSeen) && + Objects.equals(this.linkedAt, client.linkedAt) && + Objects.equals(this.displayName, client.displayName) && + Objects.equals(this.avatarUrl, client.avatarUrl) && + Objects.equals(this.info, client.info) && + Objects.equals(this.raw, client.raw); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, status, integrationId, externalId, lastSeen, linkedAt, displayName, avatarUrl, info, raw); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" externalId: ").append(toIndentedString(externalId)).append("\n"); + sb.append(" lastSeen: ").append(toIndentedString(lastSeen)).append("\n"); + sb.append(" linkedAt: ").append(toIndentedString(linkedAt)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" avatarUrl: ").append(toIndentedString(avatarUrl)).append("\n"); + sb.append(" info: ").append(toIndentedString(info)).append("\n"); + sb.append(" raw: ").append(toIndentedString(raw)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ClientAssociation.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ClientAssociation.java new file mode 100644 index 00000000..d8f150fe --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ClientAssociation.java @@ -0,0 +1,134 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ClientType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ClientAssociation + */ +@JsonPropertyOrder({ + ClientAssociation.JSON_PROPERTY_TYPE, + ClientAssociation.JSON_PROPERTY_CLIENT_ID +}) + +public class ClientAssociation { + public static final String JSON_PROPERTY_TYPE = "type"; + private ClientType type; + + public static final String JSON_PROPERTY_CLIENT_ID = "clientId"; + private String clientId; + + + public ClientAssociation type(ClientType type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ClientType getType() { + return type; + } + + + public void setType(ClientType type) { + this.type = type; + } + + + public ClientAssociation clientId(String clientId) { + + this.clientId = clientId; + return this; + } + + /** + * The id of the client being referenced. + * @return clientId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "42589ad070d43be9b00ff7e5", value = "The id of the client being referenced.") + @JsonProperty(JSON_PROPERTY_CLIENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getClientId() { + return clientId; + } + + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClientAssociation clientAssociation = (ClientAssociation) o; + return Objects.equals(this.type, clientAssociation.type) && + Objects.equals(this.clientId, clientAssociation.clientId); + } + + @Override + public int hashCode() { + return Objects.hash(type, clientId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClientAssociation {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ClientCreate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ClientCreate.java new file mode 100644 index 00000000..f4eb8955 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ClientCreate.java @@ -0,0 +1,164 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Confirmation; +import com.zendesk.sunshine_conversations_client.model.MatchCriteria; +import com.zendesk.sunshine_conversations_client.model.Target; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ClientCreate + */ +@JsonPropertyOrder({ + ClientCreate.JSON_PROPERTY_MATCH_CRITERIA, + ClientCreate.JSON_PROPERTY_CONFIRMATION, + ClientCreate.JSON_PROPERTY_TARGET +}) + +public class ClientCreate { + public static final String JSON_PROPERTY_MATCH_CRITERIA = "matchCriteria"; + private MatchCriteria matchCriteria = null; + + public static final String JSON_PROPERTY_CONFIRMATION = "confirmation"; + private Confirmation confirmation; + + public static final String JSON_PROPERTY_TARGET = "target"; + private Target target; + + + public ClientCreate matchCriteria(MatchCriteria matchCriteria) { + + this.matchCriteria = matchCriteria; + return this; + } + + /** + * Get matchCriteria + * @return matchCriteria + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_MATCH_CRITERIA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public MatchCriteria getMatchCriteria() { + return matchCriteria; + } + + + public void setMatchCriteria(MatchCriteria matchCriteria) { + this.matchCriteria = matchCriteria; + } + + + public ClientCreate confirmation(Confirmation confirmation) { + + this.confirmation = confirmation; + return this; + } + + /** + * Get confirmation + * @return confirmation + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CONFIRMATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Confirmation getConfirmation() { + return confirmation; + } + + + public void setConfirmation(Confirmation confirmation) { + this.confirmation = confirmation; + } + + + public ClientCreate target(Target target) { + + this.target = target; + return this; + } + + /** + * Get target + * @return target + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_TARGET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Target getTarget() { + return target; + } + + + public void setTarget(Target target) { + this.target = target; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClientCreate clientCreate = (ClientCreate) o; + return Objects.equals(this.matchCriteria, clientCreate.matchCriteria) && + Objects.equals(this.confirmation, clientCreate.confirmation) && + Objects.equals(this.target, clientCreate.target); + } + + @Override + public int hashCode() { + return Objects.hash(matchCriteria, confirmation, target); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClientCreate {\n"); + sb.append(" matchCriteria: ").append(toIndentedString(matchCriteria)).append("\n"); + sb.append(" confirmation: ").append(toIndentedString(confirmation)).append("\n"); + sb.append(" target: ").append(toIndentedString(target)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ClientListResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ClientListResponse.java new file mode 100644 index 00000000..8e9d4e07 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ClientListResponse.java @@ -0,0 +1,177 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Client; +import com.zendesk.sunshine_conversations_client.model.Links; +import com.zendesk.sunshine_conversations_client.model.Meta; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ClientListResponse + */ +@JsonPropertyOrder({ + ClientListResponse.JSON_PROPERTY_CLIENTS, + ClientListResponse.JSON_PROPERTY_META, + ClientListResponse.JSON_PROPERTY_LINKS +}) + +public class ClientListResponse { + public static final String JSON_PROPERTY_CLIENTS = "clients"; + private List clients = null; + + public static final String JSON_PROPERTY_META = "meta"; + private Meta meta; + + public static final String JSON_PROPERTY_LINKS = "links"; + private Links links; + + + public ClientListResponse clients(List clients) { + + this.clients = clients; + return this; + } + + public ClientListResponse addClientsItem(Client clientsItem) { + if (this.clients == null) { + this.clients = new ArrayList(); + } + this.clients.add(clientsItem); + return this; + } + + /** + * List of returned clients. + * @return clients + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of returned clients.") + @JsonProperty(JSON_PROPERTY_CLIENTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getClients() { + return clients; + } + + + public void setClients(List clients) { + this.clients = clients; + } + + + public ClientListResponse meta(Meta meta) { + + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Meta getMeta() { + return meta; + } + + + public void setMeta(Meta meta) { + this.meta = meta; + } + + + public ClientListResponse links(Links links) { + + this.links = links; + return this; + } + + /** + * Get links + * @return links + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LINKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Links getLinks() { + return links; + } + + + public void setLinks(Links links) { + this.links = links; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClientListResponse clientListResponse = (ClientListResponse) o; + return Objects.equals(this.clients, clientListResponse.clients) && + Objects.equals(this.meta, clientListResponse.meta) && + Objects.equals(this.links, clientListResponse.links); + } + + @Override + public int hashCode() { + return Objects.hash(clients, meta, links); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClientListResponse {\n"); + sb.append(" clients: ").append(toIndentedString(clients)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ClientResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ClientResponse.java new file mode 100644 index 00000000..91196c81 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ClientResponse.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Client; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ClientResponse + */ +@JsonPropertyOrder({ + ClientResponse.JSON_PROPERTY_CLIENT +}) + +public class ClientResponse { + public static final String JSON_PROPERTY_CLIENT = "client"; + private Client client; + + + public ClientResponse client(Client client) { + + this.client = client; + return this; + } + + /** + * Get client + * @return client + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CLIENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Client getClient() { + return client; + } + + + public void setClient(Client client) { + this.client = client; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClientResponse clientResponse = (ClientResponse) o; + return Objects.equals(this.client, clientResponse.client); + } + + @Override + public int hashCode() { + return Objects.hash(client); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClientResponse {\n"); + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ClientType.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ClientType.java new file mode 100644 index 00000000..e2260f9a --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ClientType.java @@ -0,0 +1,77 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * The type of integration that the client represents. Can be any of the supported integration types, or sdk for integrations of type ios, android, and web. + */ +public enum ClientType { + + LINE("line"), + + MAILGUN("mailgun"), + + MESSAGEBIRD("messagebird"), + + MESSENGER("messenger"), + + SDK("sdk"), + + TELEGRAM("telegram"), + + TWILIO("twilio"), + + TWITTER("twitter"), + + VIBER("viber"), + + WECHAT("wechat"), + + WHATSAPP("whatsapp"); + + private String value; + + ClientType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ClientType fromValue(String value) { + for (ClientType b : ClientType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Confirmation.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Confirmation.java new file mode 100644 index 00000000..fd4264fb --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Confirmation.java @@ -0,0 +1,171 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.MessagePost; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The confirmation options of the link request. + */ +@ApiModel(description = "The confirmation options of the link request.") +@JsonPropertyOrder({ + Confirmation.JSON_PROPERTY_TYPE, + Confirmation.JSON_PROPERTY_MESSAGE +}) + +public class Confirmation { + /** + * The type of confirmation. + */ + public enum TypeEnum { + IMMEDIATE("immediate"), + + USERACTIVITY("userActivity"), + + PROMPT("prompt"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private MessagePost message = null; + + + public Confirmation type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * The type of confirmation. + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of confirmation.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public Confirmation message(MessagePost message) { + + this.message = message; + return this; + } + + /** + * The message used to reach out to the user, if desired. Messages sent via this method can only be of type text and image. If actions are included they can only be of type link. The confirmation message will not be added to the user’s conversation. + * @return message + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The message used to reach out to the user, if desired. Messages sent via this method can only be of type text and image. If actions are included they can only be of type link. The confirmation message will not be added to the user’s conversation.") + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public MessagePost getMessage() { + return message; + } + + + public void setMessage(MessagePost message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Confirmation confirmation = (Confirmation) o; + return Objects.equals(this.type, confirmation.type) && + Objects.equals(this.message, confirmation.message); + } + + @Override + public int hashCode() { + return Objects.hash(type, message); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Confirmation {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Content.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Content.java new file mode 100644 index 00000000..5779d84d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Content.java @@ -0,0 +1,70 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ActionSubset; +import com.zendesk.sunshine_conversations_client.model.CarouselMessage; +import com.zendesk.sunshine_conversations_client.model.CarouselMessageDisplaySettings; +import com.zendesk.sunshine_conversations_client.model.Field; +import com.zendesk.sunshine_conversations_client.model.FileMessage; +import com.zendesk.sunshine_conversations_client.model.FormMessage; +import com.zendesk.sunshine_conversations_client.model.FormResponseMessage; +import com.zendesk.sunshine_conversations_client.model.ImageMessage; +import com.zendesk.sunshine_conversations_client.model.Item; +import com.zendesk.sunshine_conversations_client.model.ListMessage; +import com.zendesk.sunshine_conversations_client.model.LocationMessage; +import com.zendesk.sunshine_conversations_client.model.LocationMessageCoordinates; +import com.zendesk.sunshine_conversations_client.model.LocationMessageLocation; +import com.zendesk.sunshine_conversations_client.model.TextMessage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CarouselMessage.class, name = "carousel"), + @JsonSubTypes.Type(value = CarouselMessage.class, name = "carouselMessage"), + @JsonSubTypes.Type(value = FileMessage.class, name = "file"), + @JsonSubTypes.Type(value = FileMessage.class, name = "fileMessage"), + @JsonSubTypes.Type(value = FormMessage.class, name = "form"), + @JsonSubTypes.Type(value = FormMessage.class, name = "formMessage"), + @JsonSubTypes.Type(value = FormResponseMessage.class, name = "formResponse"), + @JsonSubTypes.Type(value = FormResponseMessage.class, name = "formResponseMessage"), + @JsonSubTypes.Type(value = ImageMessage.class, name = "image"), + @JsonSubTypes.Type(value = ImageMessage.class, name = "imageMessage"), + @JsonSubTypes.Type(value = ListMessage.class, name = "list"), + @JsonSubTypes.Type(value = ListMessage.class, name = "listMessage"), + @JsonSubTypes.Type(value = LocationMessage.class, name = "location"), + @JsonSubTypes.Type(value = LocationMessage.class, name = "locationMessage"), + @JsonSubTypes.Type(value = TextMessage.class, name = "text"), + @JsonSubTypes.Type(value = TextMessage.class, name = "textMessage"), +}) + +public interface Content { + public String getType(); +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Conversation.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Conversation.java new file mode 100644 index 00000000..15cf9d63 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Conversation.java @@ -0,0 +1,490 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationAllOf; +import com.zendesk.sunshine_conversations_client.model.ConversationTruncated; +import com.zendesk.sunshine_conversations_client.model.ConversationType; +import com.zendesk.sunshine_conversations_client.model.SwitchboardIntegrationWebhook; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Conversation + */ +@JsonPropertyOrder({ + Conversation.JSON_PROPERTY_ID, + Conversation.JSON_PROPERTY_TYPE, + Conversation.JSON_PROPERTY_ACTIVE_SWITCHBOARD_INTEGRATION, + Conversation.JSON_PROPERTY_PENDING_SWITCHBOARD_INTEGRATION, + Conversation.JSON_PROPERTY_IS_DEFAULT, + Conversation.JSON_PROPERTY_DISPLAY_NAME, + Conversation.JSON_PROPERTY_DESCRIPTION, + Conversation.JSON_PROPERTY_ICON_URL, + Conversation.JSON_PROPERTY_METADATA, + Conversation.JSON_PROPERTY_BUSINESS_LAST_READ, + Conversation.JSON_PROPERTY_LAST_UPDATED_AT +}) + +public class Conversation { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ConversationType type; + + public static final String JSON_PROPERTY_ACTIVE_SWITCHBOARD_INTEGRATION = "activeSwitchboardIntegration"; + private JsonNullable activeSwitchboardIntegration = JsonNullable.of(null); + + public static final String JSON_PROPERTY_PENDING_SWITCHBOARD_INTEGRATION = "pendingSwitchboardIntegration"; + private JsonNullable pendingSwitchboardIntegration = JsonNullable.of(null); + + public static final String JSON_PROPERTY_IS_DEFAULT = "isDefault"; + private Boolean isDefault; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private String displayName = null; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ICON_URL = "iconUrl"; + private JsonNullable iconUrl = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_BUSINESS_LAST_READ = "businessLastRead"; + private JsonNullable businessLastRead = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_LAST_UPDATED_AT = "lastUpdatedAt"; + private JsonNullable lastUpdatedAt = JsonNullable.undefined(); + + + public Conversation id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the conversation. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "c93bb9c14dde8ffb94564eae", value = "The unique ID of the conversation.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Conversation type(ConversationType type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationType getType() { + return type; + } + + + public void setType(ConversationType type) { + this.type = type; + } + + + public Conversation activeSwitchboardIntegration(SwitchboardIntegrationWebhook activeSwitchboardIntegration) { + this.activeSwitchboardIntegration = JsonNullable.of(activeSwitchboardIntegration); + + return this; + } + + /** + * The current switchboard integration that is in control of the conversation. This field is omitted if no `activeSwitchboardIntegration` exists for the conversation. + * @return activeSwitchboardIntegration + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The current switchboard integration that is in control of the conversation. This field is omitted if no `activeSwitchboardIntegration` exists for the conversation.") + @JsonIgnore + + public SwitchboardIntegrationWebhook getActiveSwitchboardIntegration() { + return activeSwitchboardIntegration.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ACTIVE_SWITCHBOARD_INTEGRATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getActiveSwitchboardIntegration_JsonNullable() { + return activeSwitchboardIntegration; + } + + @JsonProperty(JSON_PROPERTY_ACTIVE_SWITCHBOARD_INTEGRATION) + public void setActiveSwitchboardIntegration_JsonNullable(JsonNullable activeSwitchboardIntegration) { + this.activeSwitchboardIntegration = activeSwitchboardIntegration; + } + + public void setActiveSwitchboardIntegration(SwitchboardIntegrationWebhook activeSwitchboardIntegration) { + this.activeSwitchboardIntegration = JsonNullable.of(activeSwitchboardIntegration); + } + + + public Conversation pendingSwitchboardIntegration(SwitchboardIntegrationWebhook pendingSwitchboardIntegration) { + this.pendingSwitchboardIntegration = JsonNullable.of(pendingSwitchboardIntegration); + + return this; + } + + /** + * The switchboard integration that is awaiting control. This field is omitted if no switchboard integration has been previously offered control. + * @return pendingSwitchboardIntegration + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The switchboard integration that is awaiting control. This field is omitted if no switchboard integration has been previously offered control.") + @JsonIgnore + + public SwitchboardIntegrationWebhook getPendingSwitchboardIntegration() { + return pendingSwitchboardIntegration.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PENDING_SWITCHBOARD_INTEGRATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getPendingSwitchboardIntegration_JsonNullable() { + return pendingSwitchboardIntegration; + } + + @JsonProperty(JSON_PROPERTY_PENDING_SWITCHBOARD_INTEGRATION) + public void setPendingSwitchboardIntegration_JsonNullable(JsonNullable pendingSwitchboardIntegration) { + this.pendingSwitchboardIntegration = pendingSwitchboardIntegration; + } + + public void setPendingSwitchboardIntegration(SwitchboardIntegrationWebhook pendingSwitchboardIntegration) { + this.pendingSwitchboardIntegration = JsonNullable.of(pendingSwitchboardIntegration); + } + + + public Conversation isDefault(Boolean isDefault) { + + this.isDefault = isDefault; + return this; + } + + /** + * Whether the conversation is the default conversation for the user. Will be true for the first personal conversation created for the user, and false in all other cases. + * @return isDefault + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "false", value = "Whether the conversation is the default conversation for the user. Will be true for the first personal conversation created for the user, and false in all other cases. ") + @JsonProperty(JSON_PROPERTY_IS_DEFAULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getIsDefault() { + return isDefault; + } + + + public void setIsDefault(Boolean isDefault) { + this.isDefault = isDefault; + } + + + public Conversation displayName(String displayName) { + + this.displayName = displayName; + return this; + } + + /** + * A friendly name for the conversation, may be displayed to the business or the user. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "My conversation", value = "A friendly name for the conversation, may be displayed to the business or the user. ") + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDisplayName() { + return displayName; + } + + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + + public Conversation description(String description) { + this.description = JsonNullable.of(description); + + return this; + } + + /** + * A short text describing the conversation. + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Conversation between Rogers and Carl.", value = "A short text describing the conversation.") + @JsonIgnore + + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(String description) { + this.description = JsonNullable.of(description); + } + + + public Conversation iconUrl(URI iconUrl) { + this.iconUrl = JsonNullable.of(iconUrl); + + return this; + } + + /** + * A custom conversation icon url. The image must be in either JPG, PNG, or GIF format + * @return iconUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://www.gravatar.com/image.jpg", value = "A custom conversation icon url. The image must be in either JPG, PNG, or GIF format") + @JsonIgnore + + public URI getIconUrl() { + return iconUrl.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ICON_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getIconUrl_JsonNullable() { + return iconUrl; + } + + @JsonProperty(JSON_PROPERTY_ICON_URL) + public void setIconUrl_JsonNullable(JsonNullable iconUrl) { + this.iconUrl = iconUrl; + } + + public void setIconUrl(URI iconUrl) { + this.iconUrl = JsonNullable.of(iconUrl); + } + + + public Conversation metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + public Conversation businessLastRead(String businessLastRead) { + this.businessLastRead = JsonNullable.of(businessLastRead); + + return this; + } + + /** + * A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the moment the conversation was last marked as read with role business. + * @return businessLastRead + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2020-06-23T14:33:47.492Z", value = "A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the moment the conversation was last marked as read with role business. ") + @JsonIgnore + + public String getBusinessLastRead() { + return businessLastRead.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_BUSINESS_LAST_READ) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getBusinessLastRead_JsonNullable() { + return businessLastRead; + } + + @JsonProperty(JSON_PROPERTY_BUSINESS_LAST_READ) + public void setBusinessLastRead_JsonNullable(JsonNullable businessLastRead) { + this.businessLastRead = businessLastRead; + } + + public void setBusinessLastRead(String businessLastRead) { + this.businessLastRead = JsonNullable.of(businessLastRead); + } + + + public Conversation lastUpdatedAt(String lastUpdatedAt) { + this.lastUpdatedAt = JsonNullable.of(lastUpdatedAt); + + return this; + } + + /** + * A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the moment the last message was received in the conversation, or the creation time if no messages have been received yet. + * @return lastUpdatedAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2020-06-26T14:33:47.120Z", value = "A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the moment the last message was received in the conversation, or the creation time if no messages have been received yet. ") + @JsonIgnore + + public String getLastUpdatedAt() { + return lastUpdatedAt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LAST_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getLastUpdatedAt_JsonNullable() { + return lastUpdatedAt; + } + + @JsonProperty(JSON_PROPERTY_LAST_UPDATED_AT) + public void setLastUpdatedAt_JsonNullable(JsonNullable lastUpdatedAt) { + this.lastUpdatedAt = lastUpdatedAt; + } + + public void setLastUpdatedAt(String lastUpdatedAt) { + this.lastUpdatedAt = JsonNullable.of(lastUpdatedAt); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Conversation conversation = (Conversation) o; + return Objects.equals(this.id, conversation.id) && + Objects.equals(this.type, conversation.type) && + Objects.equals(this.activeSwitchboardIntegration, conversation.activeSwitchboardIntegration) && + Objects.equals(this.pendingSwitchboardIntegration, conversation.pendingSwitchboardIntegration) && + Objects.equals(this.isDefault, conversation.isDefault) && + Objects.equals(this.displayName, conversation.displayName) && + Objects.equals(this.description, conversation.description) && + Objects.equals(this.iconUrl, conversation.iconUrl) && + Objects.equals(this.metadata, conversation.metadata) && + Objects.equals(this.businessLastRead, conversation.businessLastRead) && + Objects.equals(this.lastUpdatedAt, conversation.lastUpdatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, activeSwitchboardIntegration, pendingSwitchboardIntegration, isDefault, displayName, description, iconUrl, metadata, businessLastRead, lastUpdatedAt); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Conversation {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" activeSwitchboardIntegration: ").append(toIndentedString(activeSwitchboardIntegration)).append("\n"); + sb.append(" pendingSwitchboardIntegration: ").append(toIndentedString(pendingSwitchboardIntegration)).append("\n"); + sb.append(" isDefault: ").append(toIndentedString(isDefault)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" iconUrl: ").append(toIndentedString(iconUrl)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" businessLastRead: ").append(toIndentedString(businessLastRead)).append("\n"); + sb.append(" lastUpdatedAt: ").append(toIndentedString(lastUpdatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationAllOf.java new file mode 100644 index 00000000..1dd329e3 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationAllOf.java @@ -0,0 +1,342 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationAllOf + */ +@JsonPropertyOrder({ + ConversationAllOf.JSON_PROPERTY_IS_DEFAULT, + ConversationAllOf.JSON_PROPERTY_DISPLAY_NAME, + ConversationAllOf.JSON_PROPERTY_DESCRIPTION, + ConversationAllOf.JSON_PROPERTY_ICON_URL, + ConversationAllOf.JSON_PROPERTY_METADATA, + ConversationAllOf.JSON_PROPERTY_BUSINESS_LAST_READ, + ConversationAllOf.JSON_PROPERTY_LAST_UPDATED_AT +}) + +public class ConversationAllOf { + public static final String JSON_PROPERTY_IS_DEFAULT = "isDefault"; + private Boolean isDefault; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private String displayName = null; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ICON_URL = "iconUrl"; + private JsonNullable iconUrl = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_BUSINESS_LAST_READ = "businessLastRead"; + private JsonNullable businessLastRead = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_LAST_UPDATED_AT = "lastUpdatedAt"; + private JsonNullable lastUpdatedAt = JsonNullable.undefined(); + + + public ConversationAllOf isDefault(Boolean isDefault) { + + this.isDefault = isDefault; + return this; + } + + /** + * Whether the conversation is the default conversation for the user. Will be true for the first personal conversation created for the user, and false in all other cases. + * @return isDefault + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "false", value = "Whether the conversation is the default conversation for the user. Will be true for the first personal conversation created for the user, and false in all other cases. ") + @JsonProperty(JSON_PROPERTY_IS_DEFAULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getIsDefault() { + return isDefault; + } + + + public void setIsDefault(Boolean isDefault) { + this.isDefault = isDefault; + } + + + public ConversationAllOf displayName(String displayName) { + + this.displayName = displayName; + return this; + } + + /** + * A friendly name for the conversation, may be displayed to the business or the user. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "My conversation", value = "A friendly name for the conversation, may be displayed to the business or the user. ") + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDisplayName() { + return displayName; + } + + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + + public ConversationAllOf description(String description) { + this.description = JsonNullable.of(description); + + return this; + } + + /** + * A short text describing the conversation. + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Conversation between Rogers and Carl.", value = "A short text describing the conversation.") + @JsonIgnore + + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(String description) { + this.description = JsonNullable.of(description); + } + + + public ConversationAllOf iconUrl(URI iconUrl) { + this.iconUrl = JsonNullable.of(iconUrl); + + return this; + } + + /** + * A custom conversation icon url. The image must be in either JPG, PNG, or GIF format + * @return iconUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://www.gravatar.com/image.jpg", value = "A custom conversation icon url. The image must be in either JPG, PNG, or GIF format") + @JsonIgnore + + public URI getIconUrl() { + return iconUrl.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ICON_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getIconUrl_JsonNullable() { + return iconUrl; + } + + @JsonProperty(JSON_PROPERTY_ICON_URL) + public void setIconUrl_JsonNullable(JsonNullable iconUrl) { + this.iconUrl = iconUrl; + } + + public void setIconUrl(URI iconUrl) { + this.iconUrl = JsonNullable.of(iconUrl); + } + + + public ConversationAllOf metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + public ConversationAllOf businessLastRead(String businessLastRead) { + this.businessLastRead = JsonNullable.of(businessLastRead); + + return this; + } + + /** + * A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the moment the conversation was last marked as read with role business. + * @return businessLastRead + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2020-06-23T14:33:47.492Z", value = "A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the moment the conversation was last marked as read with role business. ") + @JsonIgnore + + public String getBusinessLastRead() { + return businessLastRead.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_BUSINESS_LAST_READ) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getBusinessLastRead_JsonNullable() { + return businessLastRead; + } + + @JsonProperty(JSON_PROPERTY_BUSINESS_LAST_READ) + public void setBusinessLastRead_JsonNullable(JsonNullable businessLastRead) { + this.businessLastRead = businessLastRead; + } + + public void setBusinessLastRead(String businessLastRead) { + this.businessLastRead = JsonNullable.of(businessLastRead); + } + + + public ConversationAllOf lastUpdatedAt(String lastUpdatedAt) { + this.lastUpdatedAt = JsonNullable.of(lastUpdatedAt); + + return this; + } + + /** + * A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the moment the last message was received in the conversation, or the creation time if no messages have been received yet. + * @return lastUpdatedAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2020-06-26T14:33:47.120Z", value = "A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the moment the last message was received in the conversation, or the creation time if no messages have been received yet. ") + @JsonIgnore + + public String getLastUpdatedAt() { + return lastUpdatedAt.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LAST_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getLastUpdatedAt_JsonNullable() { + return lastUpdatedAt; + } + + @JsonProperty(JSON_PROPERTY_LAST_UPDATED_AT) + public void setLastUpdatedAt_JsonNullable(JsonNullable lastUpdatedAt) { + this.lastUpdatedAt = lastUpdatedAt; + } + + public void setLastUpdatedAt(String lastUpdatedAt) { + this.lastUpdatedAt = JsonNullable.of(lastUpdatedAt); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationAllOf conversationAllOf = (ConversationAllOf) o; + return Objects.equals(this.isDefault, conversationAllOf.isDefault) && + Objects.equals(this.displayName, conversationAllOf.displayName) && + Objects.equals(this.description, conversationAllOf.description) && + Objects.equals(this.iconUrl, conversationAllOf.iconUrl) && + Objects.equals(this.metadata, conversationAllOf.metadata) && + Objects.equals(this.businessLastRead, conversationAllOf.businessLastRead) && + Objects.equals(this.lastUpdatedAt, conversationAllOf.lastUpdatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(isDefault, displayName, description, iconUrl, metadata, businessLastRead, lastUpdatedAt); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationAllOf {\n"); + sb.append(" isDefault: ").append(toIndentedString(isDefault)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" iconUrl: ").append(toIndentedString(iconUrl)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" businessLastRead: ").append(toIndentedString(businessLastRead)).append("\n"); + sb.append(" lastUpdatedAt: ").append(toIndentedString(lastUpdatedAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationCreateBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationCreateBody.java new file mode 100644 index 00000000..6ac4b295 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationCreateBody.java @@ -0,0 +1,302 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationType; +import com.zendesk.sunshine_conversations_client.model.ParticipantSubSchema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationCreateBody + */ +@JsonPropertyOrder({ + ConversationCreateBody.JSON_PROPERTY_TYPE, + ConversationCreateBody.JSON_PROPERTY_PARTICIPANTS, + ConversationCreateBody.JSON_PROPERTY_DISPLAY_NAME, + ConversationCreateBody.JSON_PROPERTY_DESCRIPTION, + ConversationCreateBody.JSON_PROPERTY_ICON_URL, + ConversationCreateBody.JSON_PROPERTY_METADATA +}) + +public class ConversationCreateBody { + public static final String JSON_PROPERTY_TYPE = "type"; + private ConversationType type; + + public static final String JSON_PROPERTY_PARTICIPANTS = "participants"; + private List participants = null; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private String displayName = null; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ICON_URL = "iconUrl"; + private JsonNullable iconUrl = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public ConversationCreateBody type(ConversationType type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public ConversationType getType() { + return type; + } + + + public void setType(ConversationType type) { + this.type = type; + } + + + public ConversationCreateBody participants(List participants) { + + this.participants = participants; + return this; + } + + public ConversationCreateBody addParticipantsItem(ParticipantSubSchema participantsItem) { + if (this.participants == null) { + this.participants = new ArrayList(); + } + this.participants.add(participantsItem); + return this; + } + + /** + * The users participating in the conversation. For `personal` conversations, this field is required with a length of exactly 1. For `sdkGroup` conversations, must have a length less than or equal to 10. Can be omitted to have a conversation with no participants if the type is `sdkGroup`. + * @return participants + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The users participating in the conversation. For `personal` conversations, this field is required with a length of exactly 1. For `sdkGroup` conversations, must have a length less than or equal to 10. Can be omitted to have a conversation with no participants if the type is `sdkGroup`. ") + @JsonProperty(JSON_PROPERTY_PARTICIPANTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getParticipants() { + return participants; + } + + + public void setParticipants(List participants) { + this.participants = participants; + } + + + public ConversationCreateBody displayName(String displayName) { + + this.displayName = displayName; + return this; + } + + /** + * A friendly name for the conversation, may be displayed to the business or the user. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "My conversation", value = "A friendly name for the conversation, may be displayed to the business or the user. ") + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDisplayName() { + return displayName; + } + + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + + public ConversationCreateBody description(String description) { + this.description = JsonNullable.of(description); + + return this; + } + + /** + * A short text describing the conversation. + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Conversation between Rogers and Carl.", value = "A short text describing the conversation.") + @JsonIgnore + + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(String description) { + this.description = JsonNullable.of(description); + } + + + public ConversationCreateBody iconUrl(URI iconUrl) { + this.iconUrl = JsonNullable.of(iconUrl); + + return this; + } + + /** + * A custom conversation icon url. The image must be in either JPG, PNG, or GIF format + * @return iconUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://www.gravatar.com/image.jpg", value = "A custom conversation icon url. The image must be in either JPG, PNG, or GIF format") + @JsonIgnore + + public URI getIconUrl() { + return iconUrl.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ICON_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getIconUrl_JsonNullable() { + return iconUrl; + } + + @JsonProperty(JSON_PROPERTY_ICON_URL) + public void setIconUrl_JsonNullable(JsonNullable iconUrl) { + this.iconUrl = iconUrl; + } + + public void setIconUrl(URI iconUrl) { + this.iconUrl = JsonNullable.of(iconUrl); + } + + + public ConversationCreateBody metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationCreateBody conversationCreateBody = (ConversationCreateBody) o; + return Objects.equals(this.type, conversationCreateBody.type) && + Objects.equals(this.participants, conversationCreateBody.participants) && + Objects.equals(this.displayName, conversationCreateBody.displayName) && + Objects.equals(this.description, conversationCreateBody.description) && + Objects.equals(this.iconUrl, conversationCreateBody.iconUrl) && + Objects.equals(this.metadata, conversationCreateBody.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(type, participants, displayName, description, iconUrl, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationCreateBody {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" participants: ").append(toIndentedString(participants)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" iconUrl: ").append(toIndentedString(iconUrl)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationCreateEvent.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationCreateEvent.java new file mode 100644 index 00000000..39b53359 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationCreateEvent.java @@ -0,0 +1,198 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationCreateEventAllOf; +import com.zendesk.sunshine_conversations_client.model.ConversationCreateEventAllOfPayload; +import com.zendesk.sunshine_conversations_client.model.EventSubSchema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationCreateEvent + */ +@JsonPropertyOrder({ + ConversationCreateEvent.JSON_PROPERTY_ID, + ConversationCreateEvent.JSON_PROPERTY_TYPE, + ConversationCreateEvent.JSON_PROPERTY_CREATED_AT, + ConversationCreateEvent.JSON_PROPERTY_PAYLOAD +}) + +public class ConversationCreateEvent { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private ConversationCreateEventAllOfPayload payload; + + + public ConversationCreateEvent id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public ConversationCreateEvent type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ConversationCreateEvent createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public ConversationCreateEvent payload(ConversationCreateEventAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationCreateEventAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(ConversationCreateEventAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationCreateEvent conversationCreateEvent = (ConversationCreateEvent) o; + return Objects.equals(this.id, conversationCreateEvent.id) && + Objects.equals(this.type, conversationCreateEvent.type) && + Objects.equals(this.createdAt, conversationCreateEvent.createdAt) && + Objects.equals(this.payload, conversationCreateEvent.payload); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationCreateEvent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationCreateEventAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationCreateEventAllOf.java new file mode 100644 index 00000000..a83d3f6a --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationCreateEventAllOf.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationCreateEventAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationCreateEventAllOf + */ +@JsonPropertyOrder({ + ConversationCreateEventAllOf.JSON_PROPERTY_PAYLOAD +}) + +public class ConversationCreateEventAllOf { + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private ConversationCreateEventAllOfPayload payload; + + + public ConversationCreateEventAllOf payload(ConversationCreateEventAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationCreateEventAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(ConversationCreateEventAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationCreateEventAllOf conversationCreateEventAllOf = (ConversationCreateEventAllOf) o; + return Objects.equals(this.payload, conversationCreateEventAllOf.payload); + } + + @Override + public int hashCode() { + return Objects.hash(payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationCreateEventAllOf {\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationCreateEventAllOfPayload.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationCreateEventAllOfPayload.java new file mode 100644 index 00000000..a72c660a --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationCreateEventAllOfPayload.java @@ -0,0 +1,297 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationTruncated; +import com.zendesk.sunshine_conversations_client.model.Referral; +import com.zendesk.sunshine_conversations_client.model.SourceWebhook; +import com.zendesk.sunshine_conversations_client.model.User; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The payload of the event. The contents of this object depend on the type of event. + */ +@ApiModel(description = "The payload of the event. The contents of this object depend on the type of event.") +@JsonPropertyOrder({ + ConversationCreateEventAllOfPayload.JSON_PROPERTY_CONVERSATION, + ConversationCreateEventAllOfPayload.JSON_PROPERTY_CREATION_REASON, + ConversationCreateEventAllOfPayload.JSON_PROPERTY_SOURCE, + ConversationCreateEventAllOfPayload.JSON_PROPERTY_USER, + ConversationCreateEventAllOfPayload.JSON_PROPERTY_REFERRAL +}) + +public class ConversationCreateEventAllOfPayload { + public static final String JSON_PROPERTY_CONVERSATION = "conversation"; + private ConversationTruncated conversation = null; + + /** + * The reason why the conversation was created, if applicable. * `linkRequest` - The conversation was created in order to generate a link request to transfer the user to a different channel. * `message` - The conversation was created because a message was sent. * `none` - The conversation was not created for a specific purpose. Used primarily when a conversation is created via the Create Conversation API. * `notification` - The conversation was created by a call to the Notification API. * `prechatCapture` - The conversation was created because the user completed a prechat capture form in the Web Messenger. * `startConversation` - The conversation was created because of a call to the startConversation API on one of the SDK integrations, or a start conversation event was triggered from a messaging channel. + */ + public enum CreationReasonEnum { + LINKREQUEST("linkRequest"), + + MESSAGE("message"), + + NONE("none"), + + NOTIFICATION("notification"), + + PRECHATCAPTURE("prechatCapture"), + + STARTCONVERSATION("startConversation"); + + private String value; + + CreationReasonEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static CreationReasonEnum fromValue(String value) { + for (CreationReasonEnum b : CreationReasonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_CREATION_REASON = "creationReason"; + private CreationReasonEnum creationReason; + + public static final String JSON_PROPERTY_SOURCE = "source"; + private SourceWebhook source = null; + + public static final String JSON_PROPERTY_USER = "user"; + private JsonNullable user = JsonNullable.of(null); + + public static final String JSON_PROPERTY_REFERRAL = "referral"; + private JsonNullable referral = JsonNullable.of(null); + + + public ConversationCreateEventAllOfPayload conversation(ConversationTruncated conversation) { + + this.conversation = conversation; + return this; + } + + /** + * The conversation that was created. + * @return conversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The conversation that was created.") + @JsonProperty(JSON_PROPERTY_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationTruncated getConversation() { + return conversation; + } + + + public void setConversation(ConversationTruncated conversation) { + this.conversation = conversation; + } + + + public ConversationCreateEventAllOfPayload creationReason(CreationReasonEnum creationReason) { + + this.creationReason = creationReason; + return this; + } + + /** + * The reason why the conversation was created, if applicable. * `linkRequest` - The conversation was created in order to generate a link request to transfer the user to a different channel. * `message` - The conversation was created because a message was sent. * `none` - The conversation was not created for a specific purpose. Used primarily when a conversation is created via the Create Conversation API. * `notification` - The conversation was created by a call to the Notification API. * `prechatCapture` - The conversation was created because the user completed a prechat capture form in the Web Messenger. * `startConversation` - The conversation was created because of a call to the startConversation API on one of the SDK integrations, or a start conversation event was triggered from a messaging channel. + * @return creationReason + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The reason why the conversation was created, if applicable. * `linkRequest` - The conversation was created in order to generate a link request to transfer the user to a different channel. * `message` - The conversation was created because a message was sent. * `none` - The conversation was not created for a specific purpose. Used primarily when a conversation is created via the Create Conversation API. * `notification` - The conversation was created by a call to the Notification API. * `prechatCapture` - The conversation was created because the user completed a prechat capture form in the Web Messenger. * `startConversation` - The conversation was created because of a call to the startConversation API on one of the SDK integrations, or a start conversation event was triggered from a messaging channel. ") + @JsonProperty(JSON_PROPERTY_CREATION_REASON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public CreationReasonEnum getCreationReason() { + return creationReason; + } + + + public void setCreationReason(CreationReasonEnum creationReason) { + this.creationReason = creationReason; + } + + + public ConversationCreateEventAllOfPayload source(SourceWebhook source) { + + this.source = source; + return this; + } + + /** + * The source of the creation. + * @return source + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The source of the creation.") + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SourceWebhook getSource() { + return source; + } + + + public void setSource(SourceWebhook source) { + this.source = source; + } + + + public ConversationCreateEventAllOfPayload user(User user) { + this.user = JsonNullable.of(user); + + return this; + } + + /** + * The user associated with the conversation. Only present if the created conversation was of type personal. For sdkGroup conversations, the list of participants can be fetched using the List Participants API, if required. + * @return user + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The user associated with the conversation. Only present if the created conversation was of type personal. For sdkGroup conversations, the list of participants can be fetched using the List Participants API, if required.") + @JsonIgnore + + public User getUser() { + return user.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getUser_JsonNullable() { + return user; + } + + @JsonProperty(JSON_PROPERTY_USER) + public void setUser_JsonNullable(JsonNullable user) { + this.user = user; + } + + public void setUser(User user) { + this.user = JsonNullable.of(user); + } + + + public ConversationCreateEventAllOfPayload referral(Referral referral) { + this.referral = JsonNullable.of(referral); + + return this; + } + + /** + * Referral information, if applicable. + * @return referral + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Referral information, if applicable.") + @JsonIgnore + + public Referral getReferral() { + return referral.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_REFERRAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getReferral_JsonNullable() { + return referral; + } + + @JsonProperty(JSON_PROPERTY_REFERRAL) + public void setReferral_JsonNullable(JsonNullable referral) { + this.referral = referral; + } + + public void setReferral(Referral referral) { + this.referral = JsonNullable.of(referral); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationCreateEventAllOfPayload conversationCreateEventAllOfPayload = (ConversationCreateEventAllOfPayload) o; + return Objects.equals(this.conversation, conversationCreateEventAllOfPayload.conversation) && + Objects.equals(this.creationReason, conversationCreateEventAllOfPayload.creationReason) && + Objects.equals(this.source, conversationCreateEventAllOfPayload.source) && + Objects.equals(this.user, conversationCreateEventAllOfPayload.user) && + Objects.equals(this.referral, conversationCreateEventAllOfPayload.referral); + } + + @Override + public int hashCode() { + return Objects.hash(conversation, creationReason, source, user, referral); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationCreateEventAllOfPayload {\n"); + sb.append(" conversation: ").append(toIndentedString(conversation)).append("\n"); + sb.append(" creationReason: ").append(toIndentedString(creationReason)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" user: ").append(toIndentedString(user)).append("\n"); + sb.append(" referral: ").append(toIndentedString(referral)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationListFilter.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationListFilter.java new file mode 100644 index 00000000..dbec79c0 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationListFilter.java @@ -0,0 +1,133 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationListFilter + */ +@JsonPropertyOrder({ + ConversationListFilter.JSON_PROPERTY_USER_ID, + ConversationListFilter.JSON_PROPERTY_USER_EXTERNAL_ID +}) + +public class ConversationListFilter { + public static final String JSON_PROPERTY_USER_ID = "userId"; + private String userId; + + public static final String JSON_PROPERTY_USER_EXTERNAL_ID = "userExternalId"; + private String userExternalId; + + + public ConversationListFilter userId(String userId) { + + this.userId = userId; + return this; + } + + /** + * The user's id. One of `userId` or `userExternalId` is required, but not both. + * @return userId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The user's id. One of `userId` or `userExternalId` is required, but not both.") + @JsonProperty(JSON_PROPERTY_USER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUserId() { + return userId; + } + + + public void setUserId(String userId) { + this.userId = userId; + } + + + public ConversationListFilter userExternalId(String userExternalId) { + + this.userExternalId = userExternalId; + return this; + } + + /** + * The external Id of the user. One of `userId` or `userExternalId` is required, but not both. + * @return userExternalId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The external Id of the user. One of `userId` or `userExternalId` is required, but not both.") + @JsonProperty(JSON_PROPERTY_USER_EXTERNAL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUserExternalId() { + return userExternalId; + } + + + public void setUserExternalId(String userExternalId) { + this.userExternalId = userExternalId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationListFilter conversationListFilter = (ConversationListFilter) o; + return Objects.equals(this.userId, conversationListFilter.userId) && + Objects.equals(this.userExternalId, conversationListFilter.userExternalId); + } + + @Override + public int hashCode() { + return Objects.hash(userId, userExternalId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationListFilter {\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" userExternalId: ").append(toIndentedString(userExternalId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationListResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationListResponse.java new file mode 100644 index 00000000..f1e67a4f --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationListResponse.java @@ -0,0 +1,177 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Conversation; +import com.zendesk.sunshine_conversations_client.model.Links; +import com.zendesk.sunshine_conversations_client.model.Meta; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationListResponse + */ +@JsonPropertyOrder({ + ConversationListResponse.JSON_PROPERTY_CONVERSATIONS, + ConversationListResponse.JSON_PROPERTY_META, + ConversationListResponse.JSON_PROPERTY_LINKS +}) + +public class ConversationListResponse { + public static final String JSON_PROPERTY_CONVERSATIONS = "conversations"; + private List conversations = null; + + public static final String JSON_PROPERTY_META = "meta"; + private Meta meta; + + public static final String JSON_PROPERTY_LINKS = "links"; + private Links links; + + + public ConversationListResponse conversations(List conversations) { + + this.conversations = conversations; + return this; + } + + public ConversationListResponse addConversationsItem(Conversation conversationsItem) { + if (this.conversations == null) { + this.conversations = new ArrayList(); + } + this.conversations.add(conversationsItem); + return this; + } + + /** + * List of returned conversations. + * @return conversations + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of returned conversations.") + @JsonProperty(JSON_PROPERTY_CONVERSATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getConversations() { + return conversations; + } + + + public void setConversations(List conversations) { + this.conversations = conversations; + } + + + public ConversationListResponse meta(Meta meta) { + + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Meta getMeta() { + return meta; + } + + + public void setMeta(Meta meta) { + this.meta = meta; + } + + + public ConversationListResponse links(Links links) { + + this.links = links; + return this; + } + + /** + * Get links + * @return links + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LINKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Links getLinks() { + return links; + } + + + public void setLinks(Links links) { + this.links = links; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationListResponse conversationListResponse = (ConversationListResponse) o; + return Objects.equals(this.conversations, conversationListResponse.conversations) && + Objects.equals(this.meta, conversationListResponse.meta) && + Objects.equals(this.links, conversationListResponse.links); + } + + @Override + public int hashCode() { + return Objects.hash(conversations, meta, links); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationListResponse {\n"); + sb.append(" conversations: ").append(toIndentedString(conversations)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryChannelEvent.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryChannelEvent.java new file mode 100644 index 00000000..908c27d0 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryChannelEvent.java @@ -0,0 +1,198 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationMessageDeliveryChannelEventAllOf; +import com.zendesk.sunshine_conversations_client.model.ConversationMessageDeliveryPayload; +import com.zendesk.sunshine_conversations_client.model.EventSubSchema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationMessageDeliveryChannelEvent + */ +@JsonPropertyOrder({ + ConversationMessageDeliveryChannelEvent.JSON_PROPERTY_ID, + ConversationMessageDeliveryChannelEvent.JSON_PROPERTY_TYPE, + ConversationMessageDeliveryChannelEvent.JSON_PROPERTY_CREATED_AT, + ConversationMessageDeliveryChannelEvent.JSON_PROPERTY_PAYLOAD +}) + +public class ConversationMessageDeliveryChannelEvent { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private ConversationMessageDeliveryPayload payload; + + + public ConversationMessageDeliveryChannelEvent id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public ConversationMessageDeliveryChannelEvent type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ConversationMessageDeliveryChannelEvent createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public ConversationMessageDeliveryChannelEvent payload(ConversationMessageDeliveryPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationMessageDeliveryPayload getPayload() { + return payload; + } + + + public void setPayload(ConversationMessageDeliveryPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationMessageDeliveryChannelEvent conversationMessageDeliveryChannelEvent = (ConversationMessageDeliveryChannelEvent) o; + return Objects.equals(this.id, conversationMessageDeliveryChannelEvent.id) && + Objects.equals(this.type, conversationMessageDeliveryChannelEvent.type) && + Objects.equals(this.createdAt, conversationMessageDeliveryChannelEvent.createdAt) && + Objects.equals(this.payload, conversationMessageDeliveryChannelEvent.payload); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationMessageDeliveryChannelEvent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryChannelEventAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryChannelEventAllOf.java new file mode 100644 index 00000000..a1f487c3 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryChannelEventAllOf.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationMessageDeliveryPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationMessageDeliveryChannelEventAllOf + */ +@JsonPropertyOrder({ + ConversationMessageDeliveryChannelEventAllOf.JSON_PROPERTY_PAYLOAD +}) + +public class ConversationMessageDeliveryChannelEventAllOf { + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private ConversationMessageDeliveryPayload payload; + + + public ConversationMessageDeliveryChannelEventAllOf payload(ConversationMessageDeliveryPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationMessageDeliveryPayload getPayload() { + return payload; + } + + + public void setPayload(ConversationMessageDeliveryPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationMessageDeliveryChannelEventAllOf conversationMessageDeliveryChannelEventAllOf = (ConversationMessageDeliveryChannelEventAllOf) o; + return Objects.equals(this.payload, conversationMessageDeliveryChannelEventAllOf.payload); + } + + @Override + public int hashCode() { + return Objects.hash(payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationMessageDeliveryChannelEventAllOf {\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryFailureEvent.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryFailureEvent.java new file mode 100644 index 00000000..d7cf0aa2 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryFailureEvent.java @@ -0,0 +1,198 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationMessageDeliveryFailureEventAllOf; +import com.zendesk.sunshine_conversations_client.model.ConversationMessageDeliveryPayload; +import com.zendesk.sunshine_conversations_client.model.EventSubSchema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationMessageDeliveryFailureEvent + */ +@JsonPropertyOrder({ + ConversationMessageDeliveryFailureEvent.JSON_PROPERTY_ID, + ConversationMessageDeliveryFailureEvent.JSON_PROPERTY_TYPE, + ConversationMessageDeliveryFailureEvent.JSON_PROPERTY_CREATED_AT, + ConversationMessageDeliveryFailureEvent.JSON_PROPERTY_PAYLOAD +}) + +public class ConversationMessageDeliveryFailureEvent { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private ConversationMessageDeliveryPayload payload = null; + + + public ConversationMessageDeliveryFailureEvent id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public ConversationMessageDeliveryFailureEvent type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ConversationMessageDeliveryFailureEvent createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public ConversationMessageDeliveryFailureEvent payload(ConversationMessageDeliveryPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationMessageDeliveryPayload getPayload() { + return payload; + } + + + public void setPayload(ConversationMessageDeliveryPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationMessageDeliveryFailureEvent conversationMessageDeliveryFailureEvent = (ConversationMessageDeliveryFailureEvent) o; + return Objects.equals(this.id, conversationMessageDeliveryFailureEvent.id) && + Objects.equals(this.type, conversationMessageDeliveryFailureEvent.type) && + Objects.equals(this.createdAt, conversationMessageDeliveryFailureEvent.createdAt) && + Objects.equals(this.payload, conversationMessageDeliveryFailureEvent.payload); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationMessageDeliveryFailureEvent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryFailureEventAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryFailureEventAllOf.java new file mode 100644 index 00000000..f2cf7f07 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryFailureEventAllOf.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationMessageDeliveryPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationMessageDeliveryFailureEventAllOf + */ +@JsonPropertyOrder({ + ConversationMessageDeliveryFailureEventAllOf.JSON_PROPERTY_PAYLOAD +}) + +public class ConversationMessageDeliveryFailureEventAllOf { + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private ConversationMessageDeliveryPayload payload = null; + + + public ConversationMessageDeliveryFailureEventAllOf payload(ConversationMessageDeliveryPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationMessageDeliveryPayload getPayload() { + return payload; + } + + + public void setPayload(ConversationMessageDeliveryPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationMessageDeliveryFailureEventAllOf conversationMessageDeliveryFailureEventAllOf = (ConversationMessageDeliveryFailureEventAllOf) o; + return Objects.equals(this.payload, conversationMessageDeliveryFailureEventAllOf.payload); + } + + @Override + public int hashCode() { + return Objects.hash(payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationMessageDeliveryFailureEventAllOf {\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryPayload.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryPayload.java new file mode 100644 index 00000000..26640085 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryPayload.java @@ -0,0 +1,290 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationMessageDeliveryPayloadDestination; +import com.zendesk.sunshine_conversations_client.model.ConversationMessageDeliveryPayloadExternalMessages; +import com.zendesk.sunshine_conversations_client.model.ConversationMessageDeliveryPayloadMessage; +import com.zendesk.sunshine_conversations_client.model.ConversationTruncated; +import com.zendesk.sunshine_conversations_client.model.User; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The payload of the event. The contents of this object depend on the type of event. + */ +@ApiModel(description = "The payload of the event. The contents of this object depend on the type of event.") +@JsonPropertyOrder({ + ConversationMessageDeliveryPayload.JSON_PROPERTY_USER, + ConversationMessageDeliveryPayload.JSON_PROPERTY_CONVERSATION, + ConversationMessageDeliveryPayload.JSON_PROPERTY_MESSAGE, + ConversationMessageDeliveryPayload.JSON_PROPERTY_DESTINATION, + ConversationMessageDeliveryPayload.JSON_PROPERTY_EXTERNAL_MESSAGES, + ConversationMessageDeliveryPayload.JSON_PROPERTY_IS_FINAL_EVENT +}) + +public class ConversationMessageDeliveryPayload { + public static final String JSON_PROPERTY_USER = "user"; + private User user = null; + + public static final String JSON_PROPERTY_CONVERSATION = "conversation"; + private ConversationTruncated conversation = null; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private ConversationMessageDeliveryPayloadMessage message; + + public static final String JSON_PROPERTY_DESTINATION = "destination"; + private ConversationMessageDeliveryPayloadDestination destination; + + public static final String JSON_PROPERTY_EXTERNAL_MESSAGES = "externalMessages"; + private JsonNullable> externalMessages = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_IS_FINAL_EVENT = "isFinalEvent"; + private Boolean isFinalEvent; + + + public ConversationMessageDeliveryPayload user(User user) { + + this.user = user; + return this; + } + + /** + * The user associated with the conversation. + * @return user + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The user associated with the conversation.") + @JsonProperty(JSON_PROPERTY_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public User getUser() { + return user; + } + + + public void setUser(User user) { + this.user = user; + } + + + public ConversationMessageDeliveryPayload conversation(ConversationTruncated conversation) { + + this.conversation = conversation; + return this; + } + + /** + * The conversation in which the message was sent. + * @return conversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The conversation in which the message was sent.") + @JsonProperty(JSON_PROPERTY_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationTruncated getConversation() { + return conversation; + } + + + public void setConversation(ConversationTruncated conversation) { + this.conversation = conversation; + } + + + public ConversationMessageDeliveryPayload message(ConversationMessageDeliveryPayloadMessage message) { + + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationMessageDeliveryPayloadMessage getMessage() { + return message; + } + + + public void setMessage(ConversationMessageDeliveryPayloadMessage message) { + this.message = message; + } + + + public ConversationMessageDeliveryPayload destination(ConversationMessageDeliveryPayloadDestination destination) { + + this.destination = destination; + return this; + } + + /** + * Get destination + * @return destination + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DESTINATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationMessageDeliveryPayloadDestination getDestination() { + return destination; + } + + + public void setDestination(ConversationMessageDeliveryPayloadDestination destination) { + this.destination = destination; + } + + + public ConversationMessageDeliveryPayload externalMessages(List externalMessages) { + this.externalMessages = JsonNullable.>of(externalMessages); + + return this; + } + + public ConversationMessageDeliveryPayload addExternalMessagesItem(ConversationMessageDeliveryPayloadExternalMessages externalMessagesItem) { + if (this.externalMessages == null || !this.externalMessages.isPresent()) { + this.externalMessages = JsonNullable.>of(new ArrayList()); + } + try { + this.externalMessages.get().add(externalMessagesItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * An array of objects representing the third-party messages associated with the event. The order of the external messages is not guaranteed to be the same across the different triggers. Note that some channels don’t expose message IDs, in which case this field will be unset. + * @return externalMessages + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "An array of objects representing the third-party messages associated with the event. The order of the external messages is not guaranteed to be the same across the different triggers. Note that some channels don’t expose message IDs, in which case this field will be unset.") + @JsonIgnore + + public List getExternalMessages() { + return externalMessages.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EXTERNAL_MESSAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getExternalMessages_JsonNullable() { + return externalMessages; + } + + @JsonProperty(JSON_PROPERTY_EXTERNAL_MESSAGES) + public void setExternalMessages_JsonNullable(JsonNullable> externalMessages) { + this.externalMessages = externalMessages; + } + + public void setExternalMessages(List externalMessages) { + this.externalMessages = JsonNullable.>of(externalMessages); + } + + + public ConversationMessageDeliveryPayload isFinalEvent(Boolean isFinalEvent) { + + this.isFinalEvent = isFinalEvent; + return this; + } + + /** + * A boolean indicating whether the webhook is the final one for the `message.id` and `destination.type` pair. + * @return isFinalEvent + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A boolean indicating whether the webhook is the final one for the `message.id` and `destination.type` pair.") + @JsonProperty(JSON_PROPERTY_IS_FINAL_EVENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getIsFinalEvent() { + return isFinalEvent; + } + + + public void setIsFinalEvent(Boolean isFinalEvent) { + this.isFinalEvent = isFinalEvent; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationMessageDeliveryPayload conversationMessageDeliveryPayload = (ConversationMessageDeliveryPayload) o; + return Objects.equals(this.user, conversationMessageDeliveryPayload.user) && + Objects.equals(this.conversation, conversationMessageDeliveryPayload.conversation) && + Objects.equals(this.message, conversationMessageDeliveryPayload.message) && + Objects.equals(this.destination, conversationMessageDeliveryPayload.destination) && + Objects.equals(this.externalMessages, conversationMessageDeliveryPayload.externalMessages) && + Objects.equals(this.isFinalEvent, conversationMessageDeliveryPayload.isFinalEvent); + } + + @Override + public int hashCode() { + return Objects.hash(user, conversation, message, destination, externalMessages, isFinalEvent); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationMessageDeliveryPayload {\n"); + sb.append(" user: ").append(toIndentedString(user)).append("\n"); + sb.append(" conversation: ").append(toIndentedString(conversation)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append(" externalMessages: ").append(toIndentedString(externalMessages)).append("\n"); + sb.append(" isFinalEvent: ").append(toIndentedString(isFinalEvent)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryPayloadDestination.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryPayloadDestination.java new file mode 100644 index 00000000..25afe196 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryPayloadDestination.java @@ -0,0 +1,134 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * A nested object representing the destination of the message. + */ +@ApiModel(description = "A nested object representing the destination of the message.") +@JsonPropertyOrder({ + ConversationMessageDeliveryPayloadDestination.JSON_PROPERTY_TYPE, + ConversationMessageDeliveryPayloadDestination.JSON_PROPERTY_INTEGRATION_ID +}) + +public class ConversationMessageDeliveryPayloadDestination { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integrationId"; + private String integrationId; + + + public ConversationMessageDeliveryPayloadDestination type(String type) { + + this.type = type; + return this; + } + + /** + * An identifier for the channel to which a message was sent to. May include one of \"web\", \"ios\", \"android\", \"messenger\", \"viber\", \"telegram\", \"wechat\", \"line\", \"twilio\", \"api\", \"notification\", or any other channel. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "An identifier for the channel to which a message was sent to. May include one of \"web\", \"ios\", \"android\", \"messenger\", \"viber\", \"telegram\", \"wechat\", \"line\", \"twilio\", \"api\", \"notification\", or any other channel.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ConversationMessageDeliveryPayloadDestination integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * Identifier indicating which integration the message was sent to. + * @return integrationId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Identifier indicating which integration the message was sent to.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getIntegrationId() { + return integrationId; + } + + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationMessageDeliveryPayloadDestination conversationMessageDeliveryPayloadDestination = (ConversationMessageDeliveryPayloadDestination) o; + return Objects.equals(this.type, conversationMessageDeliveryPayloadDestination.type) && + Objects.equals(this.integrationId, conversationMessageDeliveryPayloadDestination.integrationId); + } + + @Override + public int hashCode() { + return Objects.hash(type, integrationId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationMessageDeliveryPayloadDestination {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryPayloadExternalMessages.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryPayloadExternalMessages.java new file mode 100644 index 00000000..2d4c846b --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryPayloadExternalMessages.java @@ -0,0 +1,102 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationMessageDeliveryPayloadExternalMessages + */ +@JsonPropertyOrder({ + ConversationMessageDeliveryPayloadExternalMessages.JSON_PROPERTY_ID +}) + +public class ConversationMessageDeliveryPayloadExternalMessages { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + + public ConversationMessageDeliveryPayloadExternalMessages id(String id) { + + this.id = id; + return this; + } + + /** + * A string representing the ID of the external message. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A string representing the ID of the external message.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationMessageDeliveryPayloadExternalMessages conversationMessageDeliveryPayloadExternalMessages = (ConversationMessageDeliveryPayloadExternalMessages) o; + return Objects.equals(this.id, conversationMessageDeliveryPayloadExternalMessages.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationMessageDeliveryPayloadExternalMessages {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryPayloadMessage.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryPayloadMessage.java new file mode 100644 index 00000000..18cd07ee --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryPayloadMessage.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The message that was sent. + */ +@ApiModel(description = "The message that was sent.") +@JsonPropertyOrder({ + ConversationMessageDeliveryPayloadMessage.JSON_PROPERTY_ID +}) + +public class ConversationMessageDeliveryPayloadMessage { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + + public ConversationMessageDeliveryPayloadMessage id(String id) { + + this.id = id; + return this; + } + + /** + * A string representing the ID of the message. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A string representing the ID of the message.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationMessageDeliveryPayloadMessage conversationMessageDeliveryPayloadMessage = (ConversationMessageDeliveryPayloadMessage) o; + return Objects.equals(this.id, conversationMessageDeliveryPayloadMessage.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationMessageDeliveryPayloadMessage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryUserEvent.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryUserEvent.java new file mode 100644 index 00000000..d0566690 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageDeliveryUserEvent.java @@ -0,0 +1,198 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationMessageDeliveryChannelEventAllOf; +import com.zendesk.sunshine_conversations_client.model.ConversationMessageDeliveryPayload; +import com.zendesk.sunshine_conversations_client.model.EventSubSchema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationMessageDeliveryUserEvent + */ +@JsonPropertyOrder({ + ConversationMessageDeliveryUserEvent.JSON_PROPERTY_ID, + ConversationMessageDeliveryUserEvent.JSON_PROPERTY_TYPE, + ConversationMessageDeliveryUserEvent.JSON_PROPERTY_CREATED_AT, + ConversationMessageDeliveryUserEvent.JSON_PROPERTY_PAYLOAD +}) + +public class ConversationMessageDeliveryUserEvent { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private ConversationMessageDeliveryPayload payload; + + + public ConversationMessageDeliveryUserEvent id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public ConversationMessageDeliveryUserEvent type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ConversationMessageDeliveryUserEvent createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public ConversationMessageDeliveryUserEvent payload(ConversationMessageDeliveryPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationMessageDeliveryPayload getPayload() { + return payload; + } + + + public void setPayload(ConversationMessageDeliveryPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationMessageDeliveryUserEvent conversationMessageDeliveryUserEvent = (ConversationMessageDeliveryUserEvent) o; + return Objects.equals(this.id, conversationMessageDeliveryUserEvent.id) && + Objects.equals(this.type, conversationMessageDeliveryUserEvent.type) && + Objects.equals(this.createdAt, conversationMessageDeliveryUserEvent.createdAt) && + Objects.equals(this.payload, conversationMessageDeliveryUserEvent.payload); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationMessageDeliveryUserEvent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageEvent.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageEvent.java new file mode 100644 index 00000000..2997ea44 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageEvent.java @@ -0,0 +1,198 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationMessageEventAllOf; +import com.zendesk.sunshine_conversations_client.model.ConversationMessageEventAllOfPayload; +import com.zendesk.sunshine_conversations_client.model.EventSubSchema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationMessageEvent + */ +@JsonPropertyOrder({ + ConversationMessageEvent.JSON_PROPERTY_ID, + ConversationMessageEvent.JSON_PROPERTY_TYPE, + ConversationMessageEvent.JSON_PROPERTY_CREATED_AT, + ConversationMessageEvent.JSON_PROPERTY_PAYLOAD +}) + +public class ConversationMessageEvent { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private ConversationMessageEventAllOfPayload payload; + + + public ConversationMessageEvent id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public ConversationMessageEvent type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ConversationMessageEvent createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public ConversationMessageEvent payload(ConversationMessageEventAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationMessageEventAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(ConversationMessageEventAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationMessageEvent conversationMessageEvent = (ConversationMessageEvent) o; + return Objects.equals(this.id, conversationMessageEvent.id) && + Objects.equals(this.type, conversationMessageEvent.type) && + Objects.equals(this.createdAt, conversationMessageEvent.createdAt) && + Objects.equals(this.payload, conversationMessageEvent.payload); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationMessageEvent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageEventAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageEventAllOf.java new file mode 100644 index 00000000..d56b1d24 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageEventAllOf.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationMessageEventAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationMessageEventAllOf + */ +@JsonPropertyOrder({ + ConversationMessageEventAllOf.JSON_PROPERTY_PAYLOAD +}) + +public class ConversationMessageEventAllOf { + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private ConversationMessageEventAllOfPayload payload; + + + public ConversationMessageEventAllOf payload(ConversationMessageEventAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationMessageEventAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(ConversationMessageEventAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationMessageEventAllOf conversationMessageEventAllOf = (ConversationMessageEventAllOf) o; + return Objects.equals(this.payload, conversationMessageEventAllOf.payload); + } + + @Override + public int hashCode() { + return Objects.hash(payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationMessageEventAllOf {\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageEventAllOfPayload.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageEventAllOfPayload.java new file mode 100644 index 00000000..a31164ff --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationMessageEventAllOfPayload.java @@ -0,0 +1,177 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationTruncated; +import com.zendesk.sunshine_conversations_client.model.Message; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The payload of the event. The contents of this object depend on the type of event. + */ +@ApiModel(description = "The payload of the event. The contents of this object depend on the type of event.") +@JsonPropertyOrder({ + ConversationMessageEventAllOfPayload.JSON_PROPERTY_CONVERSATION, + ConversationMessageEventAllOfPayload.JSON_PROPERTY_MESSAGE, + ConversationMessageEventAllOfPayload.JSON_PROPERTY_RECENT_NOTIFICATIONS +}) + +public class ConversationMessageEventAllOfPayload { + public static final String JSON_PROPERTY_CONVERSATION = "conversation"; + private ConversationTruncated conversation = null; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private Message message = null; + + public static final String JSON_PROPERTY_RECENT_NOTIFICATIONS = "recentNotifications"; + private List recentNotifications = null; + + + public ConversationMessageEventAllOfPayload conversation(ConversationTruncated conversation) { + + this.conversation = conversation; + return this; + } + + /** + * The conversation in which the message was sent. + * @return conversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The conversation in which the message was sent.") + @JsonProperty(JSON_PROPERTY_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationTruncated getConversation() { + return conversation; + } + + + public void setConversation(ConversationTruncated conversation) { + this.conversation = conversation; + } + + + public ConversationMessageEventAllOfPayload message(Message message) { + + this.message = message; + return this; + } + + /** + * The message that was sent. + * @return message + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The message that was sent.") + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Message getMessage() { + return message; + } + + + public void setMessage(Message message) { + this.message = message; + } + + + public ConversationMessageEventAllOfPayload recentNotifications(List recentNotifications) { + + this.recentNotifications = recentNotifications; + return this; + } + + public ConversationMessageEventAllOfPayload addRecentNotificationsItem(Message recentNotificationsItem) { + if (this.recentNotifications == null) { + this.recentNotifications = new ArrayList(); + } + this.recentNotifications.add(recentNotificationsItem); + return this; + } + + /** + * Messages sent with the Notification API since the last user message. + * @return recentNotifications + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Messages sent with the Notification API since the last user message.") + @JsonProperty(JSON_PROPERTY_RECENT_NOTIFICATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getRecentNotifications() { + return recentNotifications; + } + + + public void setRecentNotifications(List recentNotifications) { + this.recentNotifications = recentNotifications; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationMessageEventAllOfPayload conversationMessageEventAllOfPayload = (ConversationMessageEventAllOfPayload) o; + return Objects.equals(this.conversation, conversationMessageEventAllOfPayload.conversation) && + Objects.equals(this.message, conversationMessageEventAllOfPayload.message) && + Objects.equals(this.recentNotifications, conversationMessageEventAllOfPayload.recentNotifications); + } + + @Override + public int hashCode() { + return Objects.hash(conversation, message, recentNotifications); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationMessageEventAllOfPayload {\n"); + sb.append(" conversation: ").append(toIndentedString(conversation)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" recentNotifications: ").append(toIndentedString(recentNotifications)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationPostbackEvent.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationPostbackEvent.java new file mode 100644 index 00000000..9699f2ff --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationPostbackEvent.java @@ -0,0 +1,198 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationPostbackEventAllOf; +import com.zendesk.sunshine_conversations_client.model.ConversationPostbackEventAllOfPayload; +import com.zendesk.sunshine_conversations_client.model.EventSubSchema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationPostbackEvent + */ +@JsonPropertyOrder({ + ConversationPostbackEvent.JSON_PROPERTY_ID, + ConversationPostbackEvent.JSON_PROPERTY_TYPE, + ConversationPostbackEvent.JSON_PROPERTY_CREATED_AT, + ConversationPostbackEvent.JSON_PROPERTY_PAYLOAD +}) + +public class ConversationPostbackEvent { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private ConversationPostbackEventAllOfPayload payload; + + + public ConversationPostbackEvent id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public ConversationPostbackEvent type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ConversationPostbackEvent createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public ConversationPostbackEvent payload(ConversationPostbackEventAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationPostbackEventAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(ConversationPostbackEventAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationPostbackEvent conversationPostbackEvent = (ConversationPostbackEvent) o; + return Objects.equals(this.id, conversationPostbackEvent.id) && + Objects.equals(this.type, conversationPostbackEvent.type) && + Objects.equals(this.createdAt, conversationPostbackEvent.createdAt) && + Objects.equals(this.payload, conversationPostbackEvent.payload); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationPostbackEvent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationPostbackEventAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationPostbackEventAllOf.java new file mode 100644 index 00000000..715ab3df --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationPostbackEventAllOf.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationPostbackEventAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationPostbackEventAllOf + */ +@JsonPropertyOrder({ + ConversationPostbackEventAllOf.JSON_PROPERTY_PAYLOAD +}) + +public class ConversationPostbackEventAllOf { + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private ConversationPostbackEventAllOfPayload payload; + + + public ConversationPostbackEventAllOf payload(ConversationPostbackEventAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationPostbackEventAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(ConversationPostbackEventAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationPostbackEventAllOf conversationPostbackEventAllOf = (ConversationPostbackEventAllOf) o; + return Objects.equals(this.payload, conversationPostbackEventAllOf.payload); + } + + @Override + public int hashCode() { + return Objects.hash(payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationPostbackEventAllOf {\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationPostbackEventAllOfPayload.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationPostbackEventAllOfPayload.java new file mode 100644 index 00000000..32354e39 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationPostbackEventAllOfPayload.java @@ -0,0 +1,200 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationTruncated; +import com.zendesk.sunshine_conversations_client.model.PostbackWebhook; +import com.zendesk.sunshine_conversations_client.model.SourceWebhook; +import com.zendesk.sunshine_conversations_client.model.User; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The payload of the event. The contents of this object depend on the type of event. + */ +@ApiModel(description = "The payload of the event. The contents of this object depend on the type of event.") +@JsonPropertyOrder({ + ConversationPostbackEventAllOfPayload.JSON_PROPERTY_POSTBACK, + ConversationPostbackEventAllOfPayload.JSON_PROPERTY_CONVERSATION, + ConversationPostbackEventAllOfPayload.JSON_PROPERTY_USER, + ConversationPostbackEventAllOfPayload.JSON_PROPERTY_SOURCE +}) + +public class ConversationPostbackEventAllOfPayload { + public static final String JSON_PROPERTY_POSTBACK = "postback"; + private PostbackWebhook postback = null; + + public static final String JSON_PROPERTY_CONVERSATION = "conversation"; + private ConversationTruncated conversation = null; + + public static final String JSON_PROPERTY_USER = "user"; + private User user = null; + + public static final String JSON_PROPERTY_SOURCE = "source"; + private SourceWebhook source = null; + + + public ConversationPostbackEventAllOfPayload postback(PostbackWebhook postback) { + + this.postback = postback; + return this; + } + + /** + * The postback associated with the event. + * @return postback + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The postback associated with the event.") + @JsonProperty(JSON_PROPERTY_POSTBACK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public PostbackWebhook getPostback() { + return postback; + } + + + public void setPostback(PostbackWebhook postback) { + this.postback = postback; + } + + + public ConversationPostbackEventAllOfPayload conversation(ConversationTruncated conversation) { + + this.conversation = conversation; + return this; + } + + /** + * The conversation linked to the postback. + * @return conversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The conversation linked to the postback.") + @JsonProperty(JSON_PROPERTY_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationTruncated getConversation() { + return conversation; + } + + + public void setConversation(ConversationTruncated conversation) { + this.conversation = conversation; + } + + + public ConversationPostbackEventAllOfPayload user(User user) { + + this.user = user; + return this; + } + + /** + * The user that triggered the postback. + * @return user + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The user that triggered the postback.") + @JsonProperty(JSON_PROPERTY_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public User getUser() { + return user; + } + + + public void setUser(User user) { + this.user = user; + } + + + public ConversationPostbackEventAllOfPayload source(SourceWebhook source) { + + this.source = source; + return this; + } + + /** + * The source of the postback. + * @return source + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The source of the postback.") + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SourceWebhook getSource() { + return source; + } + + + public void setSource(SourceWebhook source) { + this.source = source; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationPostbackEventAllOfPayload conversationPostbackEventAllOfPayload = (ConversationPostbackEventAllOfPayload) o; + return Objects.equals(this.postback, conversationPostbackEventAllOfPayload.postback) && + Objects.equals(this.conversation, conversationPostbackEventAllOfPayload.conversation) && + Objects.equals(this.user, conversationPostbackEventAllOfPayload.user) && + Objects.equals(this.source, conversationPostbackEventAllOfPayload.source); + } + + @Override + public int hashCode() { + return Objects.hash(postback, conversation, user, source); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationPostbackEventAllOfPayload {\n"); + sb.append(" postback: ").append(toIndentedString(postback)).append("\n"); + sb.append(" conversation: ").append(toIndentedString(conversation)).append("\n"); + sb.append(" user: ").append(toIndentedString(user)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationReadEvent.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationReadEvent.java new file mode 100644 index 00000000..0fe0bb63 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationReadEvent.java @@ -0,0 +1,198 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationReadEventAllOf; +import com.zendesk.sunshine_conversations_client.model.ConversationReadEventAllOfPayload; +import com.zendesk.sunshine_conversations_client.model.EventSubSchema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationReadEvent + */ +@JsonPropertyOrder({ + ConversationReadEvent.JSON_PROPERTY_ID, + ConversationReadEvent.JSON_PROPERTY_TYPE, + ConversationReadEvent.JSON_PROPERTY_CREATED_AT, + ConversationReadEvent.JSON_PROPERTY_PAYLOAD +}) + +public class ConversationReadEvent { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private ConversationReadEventAllOfPayload payload; + + + public ConversationReadEvent id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public ConversationReadEvent type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ConversationReadEvent createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public ConversationReadEvent payload(ConversationReadEventAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationReadEventAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(ConversationReadEventAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationReadEvent conversationReadEvent = (ConversationReadEvent) o; + return Objects.equals(this.id, conversationReadEvent.id) && + Objects.equals(this.type, conversationReadEvent.type) && + Objects.equals(this.createdAt, conversationReadEvent.createdAt) && + Objects.equals(this.payload, conversationReadEvent.payload); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationReadEvent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationReadEventAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationReadEventAllOf.java new file mode 100644 index 00000000..c6867652 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationReadEventAllOf.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationReadEventAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationReadEventAllOf + */ +@JsonPropertyOrder({ + ConversationReadEventAllOf.JSON_PROPERTY_PAYLOAD +}) + +public class ConversationReadEventAllOf { + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private ConversationReadEventAllOfPayload payload; + + + public ConversationReadEventAllOf payload(ConversationReadEventAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationReadEventAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(ConversationReadEventAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationReadEventAllOf conversationReadEventAllOf = (ConversationReadEventAllOf) o; + return Objects.equals(this.payload, conversationReadEventAllOf.payload); + } + + @Override + public int hashCode() { + return Objects.hash(payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationReadEventAllOf {\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationReadEventAllOfPayload.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationReadEventAllOfPayload.java new file mode 100644 index 00000000..a80b04e1 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationReadEventAllOfPayload.java @@ -0,0 +1,136 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Activity; +import com.zendesk.sunshine_conversations_client.model.ConversationTruncated; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The payload of the event. The contents of this object depend on the type of event. + */ +@ApiModel(description = "The payload of the event. The contents of this object depend on the type of event.") +@JsonPropertyOrder({ + ConversationReadEventAllOfPayload.JSON_PROPERTY_CONVERSATION, + ConversationReadEventAllOfPayload.JSON_PROPERTY_ACTIVITY +}) + +public class ConversationReadEventAllOfPayload { + public static final String JSON_PROPERTY_CONVERSATION = "conversation"; + private ConversationTruncated conversation = null; + + public static final String JSON_PROPERTY_ACTIVITY = "activity"; + private Activity activity = null; + + + public ConversationReadEventAllOfPayload conversation(ConversationTruncated conversation) { + + this.conversation = conversation; + return this; + } + + /** + * The conversation in which the message was read. + * @return conversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The conversation in which the message was read.") + @JsonProperty(JSON_PROPERTY_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationTruncated getConversation() { + return conversation; + } + + + public void setConversation(ConversationTruncated conversation) { + this.conversation = conversation; + } + + + public ConversationReadEventAllOfPayload activity(Activity activity) { + + this.activity = activity; + return this; + } + + /** + * The activity that was sent. + * @return activity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The activity that was sent.") + @JsonProperty(JSON_PROPERTY_ACTIVITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Activity getActivity() { + return activity; + } + + + public void setActivity(Activity activity) { + this.activity = activity; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationReadEventAllOfPayload conversationReadEventAllOfPayload = (ConversationReadEventAllOfPayload) o; + return Objects.equals(this.conversation, conversationReadEventAllOfPayload.conversation) && + Objects.equals(this.activity, conversationReadEventAllOfPayload.activity); + } + + @Override + public int hashCode() { + return Objects.hash(conversation, activity); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationReadEventAllOfPayload {\n"); + sb.append(" conversation: ").append(toIndentedString(conversation)).append("\n"); + sb.append(" activity: ").append(toIndentedString(activity)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationResponse.java new file mode 100644 index 00000000..1a46842a --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationResponse.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Conversation; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationResponse + */ +@JsonPropertyOrder({ + ConversationResponse.JSON_PROPERTY_CONVERSATION +}) + +public class ConversationResponse { + public static final String JSON_PROPERTY_CONVERSATION = "conversation"; + private Conversation conversation = null; + + + public ConversationResponse conversation(Conversation conversation) { + + this.conversation = conversation; + return this; + } + + /** + * The conversation. + * @return conversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The conversation.") + @JsonProperty(JSON_PROPERTY_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Conversation getConversation() { + return conversation; + } + + + public void setConversation(Conversation conversation) { + this.conversation = conversation; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationResponse conversationResponse = (ConversationResponse) o; + return Objects.equals(this.conversation, conversationResponse.conversation); + } + + @Override + public int hashCode() { + return Objects.hash(conversation); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationResponse {\n"); + sb.append(" conversation: ").append(toIndentedString(conversation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationTruncated.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationTruncated.java new file mode 100644 index 00000000..eb17a683 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationTruncated.java @@ -0,0 +1,220 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationType; +import com.zendesk.sunshine_conversations_client.model.SwitchboardIntegrationWebhook; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationTruncated + */ +@JsonPropertyOrder({ + ConversationTruncated.JSON_PROPERTY_ID, + ConversationTruncated.JSON_PROPERTY_TYPE, + ConversationTruncated.JSON_PROPERTY_ACTIVE_SWITCHBOARD_INTEGRATION, + ConversationTruncated.JSON_PROPERTY_PENDING_SWITCHBOARD_INTEGRATION +}) + +public class ConversationTruncated { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ConversationType type; + + public static final String JSON_PROPERTY_ACTIVE_SWITCHBOARD_INTEGRATION = "activeSwitchboardIntegration"; + private JsonNullable activeSwitchboardIntegration = JsonNullable.of(null); + + public static final String JSON_PROPERTY_PENDING_SWITCHBOARD_INTEGRATION = "pendingSwitchboardIntegration"; + private JsonNullable pendingSwitchboardIntegration = JsonNullable.of(null); + + + public ConversationTruncated id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the conversation. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "c93bb9c14dde8ffb94564eae", value = "The unique ID of the conversation.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public ConversationTruncated type(ConversationType type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationType getType() { + return type; + } + + + public void setType(ConversationType type) { + this.type = type; + } + + + public ConversationTruncated activeSwitchboardIntegration(SwitchboardIntegrationWebhook activeSwitchboardIntegration) { + this.activeSwitchboardIntegration = JsonNullable.of(activeSwitchboardIntegration); + + return this; + } + + /** + * The current switchboard integration that is in control of the conversation. This field is omitted if no `activeSwitchboardIntegration` exists for the conversation. + * @return activeSwitchboardIntegration + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The current switchboard integration that is in control of the conversation. This field is omitted if no `activeSwitchboardIntegration` exists for the conversation.") + @JsonIgnore + + public SwitchboardIntegrationWebhook getActiveSwitchboardIntegration() { + return activeSwitchboardIntegration.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ACTIVE_SWITCHBOARD_INTEGRATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getActiveSwitchboardIntegration_JsonNullable() { + return activeSwitchboardIntegration; + } + + @JsonProperty(JSON_PROPERTY_ACTIVE_SWITCHBOARD_INTEGRATION) + public void setActiveSwitchboardIntegration_JsonNullable(JsonNullable activeSwitchboardIntegration) { + this.activeSwitchboardIntegration = activeSwitchboardIntegration; + } + + public void setActiveSwitchboardIntegration(SwitchboardIntegrationWebhook activeSwitchboardIntegration) { + this.activeSwitchboardIntegration = JsonNullable.of(activeSwitchboardIntegration); + } + + + public ConversationTruncated pendingSwitchboardIntegration(SwitchboardIntegrationWebhook pendingSwitchboardIntegration) { + this.pendingSwitchboardIntegration = JsonNullable.of(pendingSwitchboardIntegration); + + return this; + } + + /** + * The switchboard integration that is awaiting control. This field is omitted if no switchboard integration has been previously offered control. + * @return pendingSwitchboardIntegration + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The switchboard integration that is awaiting control. This field is omitted if no switchboard integration has been previously offered control.") + @JsonIgnore + + public SwitchboardIntegrationWebhook getPendingSwitchboardIntegration() { + return pendingSwitchboardIntegration.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PENDING_SWITCHBOARD_INTEGRATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getPendingSwitchboardIntegration_JsonNullable() { + return pendingSwitchboardIntegration; + } + + @JsonProperty(JSON_PROPERTY_PENDING_SWITCHBOARD_INTEGRATION) + public void setPendingSwitchboardIntegration_JsonNullable(JsonNullable pendingSwitchboardIntegration) { + this.pendingSwitchboardIntegration = pendingSwitchboardIntegration; + } + + public void setPendingSwitchboardIntegration(SwitchboardIntegrationWebhook pendingSwitchboardIntegration) { + this.pendingSwitchboardIntegration = JsonNullable.of(pendingSwitchboardIntegration); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationTruncated conversationTruncated = (ConversationTruncated) o; + return Objects.equals(this.id, conversationTruncated.id) && + Objects.equals(this.type, conversationTruncated.type) && + Objects.equals(this.activeSwitchboardIntegration, conversationTruncated.activeSwitchboardIntegration) && + Objects.equals(this.pendingSwitchboardIntegration, conversationTruncated.pendingSwitchboardIntegration); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, activeSwitchboardIntegration, pendingSwitchboardIntegration); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationTruncated {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" activeSwitchboardIntegration: ").append(toIndentedString(activeSwitchboardIntegration)).append("\n"); + sb.append(" pendingSwitchboardIntegration: ").append(toIndentedString(pendingSwitchboardIntegration)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationType.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationType.java new file mode 100644 index 00000000..fbfcf590 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationType.java @@ -0,0 +1,59 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * The type of the conversation. + */ +public enum ConversationType { + + PERSONAL("personal"), + + SDKGROUP("sdkGroup"); + + private String value; + + ConversationType(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ConversationType fromValue(String value) { + for (ConversationType b : ConversationType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationTypingEvent.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationTypingEvent.java new file mode 100644 index 00000000..7fb88e63 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationTypingEvent.java @@ -0,0 +1,198 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationTypingEventAllOf; +import com.zendesk.sunshine_conversations_client.model.ConversationTypingEventAllOfPayload; +import com.zendesk.sunshine_conversations_client.model.EventSubSchema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationTypingEvent + */ +@JsonPropertyOrder({ + ConversationTypingEvent.JSON_PROPERTY_ID, + ConversationTypingEvent.JSON_PROPERTY_TYPE, + ConversationTypingEvent.JSON_PROPERTY_CREATED_AT, + ConversationTypingEvent.JSON_PROPERTY_PAYLOAD +}) + +public class ConversationTypingEvent { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private ConversationTypingEventAllOfPayload payload; + + + public ConversationTypingEvent id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public ConversationTypingEvent type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ConversationTypingEvent createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public ConversationTypingEvent payload(ConversationTypingEventAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationTypingEventAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(ConversationTypingEventAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationTypingEvent conversationTypingEvent = (ConversationTypingEvent) o; + return Objects.equals(this.id, conversationTypingEvent.id) && + Objects.equals(this.type, conversationTypingEvent.type) && + Objects.equals(this.createdAt, conversationTypingEvent.createdAt) && + Objects.equals(this.payload, conversationTypingEvent.payload); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationTypingEvent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationTypingEventAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationTypingEventAllOf.java new file mode 100644 index 00000000..3f02b5b2 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationTypingEventAllOf.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationTypingEventAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationTypingEventAllOf + */ +@JsonPropertyOrder({ + ConversationTypingEventAllOf.JSON_PROPERTY_PAYLOAD +}) + +public class ConversationTypingEventAllOf { + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private ConversationTypingEventAllOfPayload payload; + + + public ConversationTypingEventAllOf payload(ConversationTypingEventAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationTypingEventAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(ConversationTypingEventAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationTypingEventAllOf conversationTypingEventAllOf = (ConversationTypingEventAllOf) o; + return Objects.equals(this.payload, conversationTypingEventAllOf.payload); + } + + @Override + public int hashCode() { + return Objects.hash(payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationTypingEventAllOf {\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationTypingEventAllOfPayload.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationTypingEventAllOfPayload.java new file mode 100644 index 00000000..a40716dd --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationTypingEventAllOfPayload.java @@ -0,0 +1,136 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Activity; +import com.zendesk.sunshine_conversations_client.model.ConversationTruncated; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The payload of the event. The contents of this object depend on the type of event. + */ +@ApiModel(description = "The payload of the event. The contents of this object depend on the type of event.") +@JsonPropertyOrder({ + ConversationTypingEventAllOfPayload.JSON_PROPERTY_CONVERSATION, + ConversationTypingEventAllOfPayload.JSON_PROPERTY_ACTIVITY +}) + +public class ConversationTypingEventAllOfPayload { + public static final String JSON_PROPERTY_CONVERSATION = "conversation"; + private ConversationTruncated conversation = null; + + public static final String JSON_PROPERTY_ACTIVITY = "activity"; + private Activity activity = null; + + + public ConversationTypingEventAllOfPayload conversation(ConversationTruncated conversation) { + + this.conversation = conversation; + return this; + } + + /** + * The conversation in which the activity was sent. + * @return conversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The conversation in which the activity was sent.") + @JsonProperty(JSON_PROPERTY_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationTruncated getConversation() { + return conversation; + } + + + public void setConversation(ConversationTruncated conversation) { + this.conversation = conversation; + } + + + public ConversationTypingEventAllOfPayload activity(Activity activity) { + + this.activity = activity; + return this; + } + + /** + * The activity that was sent. + * @return activity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The activity that was sent.") + @JsonProperty(JSON_PROPERTY_ACTIVITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Activity getActivity() { + return activity; + } + + + public void setActivity(Activity activity) { + this.activity = activity; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationTypingEventAllOfPayload conversationTypingEventAllOfPayload = (ConversationTypingEventAllOfPayload) o; + return Objects.equals(this.conversation, conversationTypingEventAllOfPayload.conversation) && + Objects.equals(this.activity, conversationTypingEventAllOfPayload.activity); + } + + @Override + public int hashCode() { + return Objects.hash(conversation, activity); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationTypingEventAllOfPayload {\n"); + sb.append(" conversation: ").append(toIndentedString(conversation)).append("\n"); + sb.append(" activity: ").append(toIndentedString(activity)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationUpdateBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationUpdateBody.java new file mode 100644 index 00000000..eb827f80 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ConversationUpdateBody.java @@ -0,0 +1,229 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ConversationUpdateBody + */ +@JsonPropertyOrder({ + ConversationUpdateBody.JSON_PROPERTY_DISPLAY_NAME, + ConversationUpdateBody.JSON_PROPERTY_DESCRIPTION, + ConversationUpdateBody.JSON_PROPERTY_ICON_URL, + ConversationUpdateBody.JSON_PROPERTY_METADATA +}) + +public class ConversationUpdateBody { + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private String displayName = null; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ICON_URL = "iconUrl"; + private JsonNullable iconUrl = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public ConversationUpdateBody displayName(String displayName) { + + this.displayName = displayName; + return this; + } + + /** + * A friendly name for the conversation, may be displayed to the business or the user. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "My conversation", value = "A friendly name for the conversation, may be displayed to the business or the user. ") + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDisplayName() { + return displayName; + } + + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + + public ConversationUpdateBody description(String description) { + this.description = JsonNullable.of(description); + + return this; + } + + /** + * A short text describing the conversation. + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Conversation between Rogers and Carl.", value = "A short text describing the conversation.") + @JsonIgnore + + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(String description) { + this.description = JsonNullable.of(description); + } + + + public ConversationUpdateBody iconUrl(URI iconUrl) { + this.iconUrl = JsonNullable.of(iconUrl); + + return this; + } + + /** + * A custom conversation icon url. The image must be in either JPG, PNG, or GIF format + * @return iconUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://www.gravatar.com/image.jpg", value = "A custom conversation icon url. The image must be in either JPG, PNG, or GIF format") + @JsonIgnore + + public URI getIconUrl() { + return iconUrl.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ICON_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getIconUrl_JsonNullable() { + return iconUrl; + } + + @JsonProperty(JSON_PROPERTY_ICON_URL) + public void setIconUrl_JsonNullable(JsonNullable iconUrl) { + this.iconUrl = iconUrl; + } + + public void setIconUrl(URI iconUrl) { + this.iconUrl = JsonNullable.of(iconUrl); + } + + + public ConversationUpdateBody metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConversationUpdateBody conversationUpdateBody = (ConversationUpdateBody) o; + return Objects.equals(this.displayName, conversationUpdateBody.displayName) && + Objects.equals(this.description, conversationUpdateBody.description) && + Objects.equals(this.iconUrl, conversationUpdateBody.iconUrl) && + Objects.equals(this.metadata, conversationUpdateBody.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(displayName, description, iconUrl, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConversationUpdateBody {\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" iconUrl: ").append(toIndentedString(iconUrl)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Custom.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Custom.java new file mode 100644 index 00000000..d18cc541 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Custom.java @@ -0,0 +1,179 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Android; +import com.zendesk.sunshine_conversations_client.model.Apple; +import com.zendesk.sunshine_conversations_client.model.Custom; +import com.zendesk.sunshine_conversations_client.model.CustomAllOf; +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.Ios; +import com.zendesk.sunshine_conversations_client.model.Line; +import com.zendesk.sunshine_conversations_client.model.Mailgun; +import com.zendesk.sunshine_conversations_client.model.MessageBird; +import com.zendesk.sunshine_conversations_client.model.Messenger; +import com.zendesk.sunshine_conversations_client.model.Status; +import com.zendesk.sunshine_conversations_client.model.Telegram; +import com.zendesk.sunshine_conversations_client.model.Twilio; +import com.zendesk.sunshine_conversations_client.model.Twitter; +import com.zendesk.sunshine_conversations_client.model.Viber; +import com.zendesk.sunshine_conversations_client.model.Web; +import com.zendesk.sunshine_conversations_client.model.Webhook; +import com.zendesk.sunshine_conversations_client.model.Whatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Custom + */ +@JsonPropertyOrder({ + Custom.JSON_PROPERTY_TYPE, + Custom.JSON_PROPERTY_WEBHOOKS +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Android.class, name = "android"), + @JsonSubTypes.Type(value = Apple.class, name = "apple"), + @JsonSubTypes.Type(value = Custom.class, name = "custom"), + @JsonSubTypes.Type(value = Ios.class, name = "ios"), + @JsonSubTypes.Type(value = Line.class, name = "line"), + @JsonSubTypes.Type(value = Mailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messagebird"), + @JsonSubTypes.Type(value = Messenger.class, name = "messenger"), + @JsonSubTypes.Type(value = Telegram.class, name = "telegram"), + @JsonSubTypes.Type(value = Twilio.class, name = "twilio"), + @JsonSubTypes.Type(value = Twitter.class, name = "twitter"), + @JsonSubTypes.Type(value = Viber.class, name = "viber"), + @JsonSubTypes.Type(value = Web.class, name = "web"), + @JsonSubTypes.Type(value = Whatsapp.class, name = "whatsapp"), +}) + +public class Custom extends Integration { + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type = "custom"; + + public static final String JSON_PROPERTY_WEBHOOKS = "webhooks"; + private List webhooks = new ArrayList(); + + + public Custom type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Custom webhooks(List webhooks) { + + this.webhooks = webhooks; + return this; + } + + public Custom addWebhooksItem(Webhook webhooksItem) { + this.webhooks.add(webhooksItem); + return this; + } + + /** + * An array of webhooks associated with the custom integration. + * @return webhooks + **/ + @ApiModelProperty(required = true, value = "An array of webhooks associated with the custom integration.") + @JsonProperty(JSON_PROPERTY_WEBHOOKS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getWebhooks() { + return webhooks; + } + + + public void setWebhooks(List webhooks) { + this.webhooks = webhooks; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Custom custom = (Custom) o; + return Objects.equals(this.type, custom.type) && + Objects.equals(this.webhooks, custom.webhooks) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, webhooks, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Custom {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" webhooks: ").append(toIndentedString(webhooks)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/CustomAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/CustomAllOf.java new file mode 100644 index 00000000..a4437253 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/CustomAllOf.java @@ -0,0 +1,140 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Webhook; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * CustomAllOf + */ +@JsonPropertyOrder({ + CustomAllOf.JSON_PROPERTY_TYPE, + CustomAllOf.JSON_PROPERTY_WEBHOOKS +}) + +public class CustomAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "custom"; + + public static final String JSON_PROPERTY_WEBHOOKS = "webhooks"; + private List webhooks = new ArrayList(); + + + public CustomAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CustomAllOf webhooks(List webhooks) { + + this.webhooks = webhooks; + return this; + } + + public CustomAllOf addWebhooksItem(Webhook webhooksItem) { + this.webhooks.add(webhooksItem); + return this; + } + + /** + * An array of webhooks associated with the custom integration. + * @return webhooks + **/ + @ApiModelProperty(required = true, value = "An array of webhooks associated with the custom integration.") + @JsonProperty(JSON_PROPERTY_WEBHOOKS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getWebhooks() { + return webhooks; + } + + + public void setWebhooks(List webhooks) { + this.webhooks = webhooks; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CustomAllOf customAllOf = (CustomAllOf) o; + return Objects.equals(this.type, customAllOf.type) && + Objects.equals(this.webhooks, customAllOf.webhooks); + } + + @Override + public int hashCode() { + return Objects.hash(type, webhooks); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" webhooks: ").append(toIndentedString(webhooks)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/CustomUpdate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/CustomUpdate.java new file mode 100644 index 00000000..1e8294ae --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/CustomUpdate.java @@ -0,0 +1,79 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdateBase; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdate; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * CustomUpdate + */ +@JsonPropertyOrder({ +}) + +public class CustomUpdate extends IntegrationUpdateBase implements IntegrationUpdate { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CustomUpdate {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Destination.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Destination.java new file mode 100644 index 00000000..eb374539 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Destination.java @@ -0,0 +1,37 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.IntegrationId; +import com.zendesk.sunshine_conversations_client.model.IntegrationType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "", visible = true) +@JsonSubTypes({ +}) + +public interface Destination { +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Device.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Device.java new file mode 100644 index 00000000..313c2207 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Device.java @@ -0,0 +1,486 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Device + */ +@JsonPropertyOrder({ + Device.JSON_PROPERTY_ID, + Device.JSON_PROPERTY_TYPE, + Device.JSON_PROPERTY_GUID, + Device.JSON_PROPERTY_CLIENT_ID, + Device.JSON_PROPERTY_STATUS, + Device.JSON_PROPERTY_INTEGRATION_ID, + Device.JSON_PROPERTY_LAST_SEEN, + Device.JSON_PROPERTY_PUSH_NOTIFICATION_TOKEN, + Device.JSON_PROPERTY_INFO, + Device.JSON_PROPERTY_APP_VERSION +}) + +public class Device { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + /** + * The type of integration that the device represents. + */ + public enum TypeEnum { + ANDROID("android"), + + IOS("ios"), + + WEB("web"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public static final String JSON_PROPERTY_GUID = "guid"; + private String guid; + + public static final String JSON_PROPERTY_CLIENT_ID = "clientId"; + private String clientId; + + /** + * The device status. Indicates if the device will receive push notifications or not. + */ + public enum StatusEnum { + ACTIVE("active"), + + INACTIVE("inactive"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_STATUS = "status"; + private StatusEnum status; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integrationId"; + private String integrationId; + + public static final String JSON_PROPERTY_LAST_SEEN = "lastSeen"; + private String lastSeen; + + public static final String JSON_PROPERTY_PUSH_NOTIFICATION_TOKEN = "pushNotificationToken"; + private JsonNullable pushNotificationToken = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_INFO = "info"; + private JsonNullable info = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_APP_VERSION = "appVersion"; + private JsonNullable appVersion = JsonNullable.undefined(); + + + public Device id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the device. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "de13bee15b51033b34162411", value = "The unique ID of the device.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Device type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * The type of integration that the device represents. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration that the device represents.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public Device guid(String guid) { + + this.guid = guid; + return this; + } + + /** + * A unique identifier for the device, generated client-side by the SDK. + * @return guid + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A unique identifier for the device, generated client-side by the SDK.") + @JsonProperty(JSON_PROPERTY_GUID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getGuid() { + return guid; + } + + + public void setGuid(String guid) { + this.guid = guid; + } + + + public Device clientId(String clientId) { + + this.clientId = clientId; + return this; + } + + /** + * The id of the client to which this device is associated. + * @return clientId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The id of the client to which this device is associated.") + @JsonProperty(JSON_PROPERTY_CLIENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getClientId() { + return clientId; + } + + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + + public Device status(StatusEnum status) { + + this.status = status; + return this; + } + + /** + * The device status. Indicates if the device will receive push notifications or not. + * @return status + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The device status. Indicates if the device will receive push notifications or not.") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public StatusEnum getStatus() { + return status; + } + + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + public Device integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * The ID of the integration that the device was created for. + * @return integrationId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The ID of the integration that the device was created for.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getIntegrationId() { + return integrationId; + } + + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + + public Device lastSeen(String lastSeen) { + + this.lastSeen = lastSeen; + return this; + } + + /** + * A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the last time the user interacted with this device. + * @return lastSeen + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the last time the user interacted with this device.") + @JsonProperty(JSON_PROPERTY_LAST_SEEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getLastSeen() { + return lastSeen; + } + + + public void setLastSeen(String lastSeen) { + this.lastSeen = lastSeen; + } + + + public Device pushNotificationToken(String pushNotificationToken) { + this.pushNotificationToken = JsonNullable.of(pushNotificationToken); + + return this; + } + + /** + * The token used for push notifications on Android and iOS devices. + * @return pushNotificationToken + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The token used for push notifications on Android and iOS devices.") + @JsonIgnore + + public String getPushNotificationToken() { + return pushNotificationToken.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_PUSH_NOTIFICATION_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getPushNotificationToken_JsonNullable() { + return pushNotificationToken; + } + + @JsonProperty(JSON_PROPERTY_PUSH_NOTIFICATION_TOKEN) + public void setPushNotificationToken_JsonNullable(JsonNullable pushNotificationToken) { + this.pushNotificationToken = pushNotificationToken; + } + + public void setPushNotificationToken(String pushNotificationToken) { + this.pushNotificationToken = JsonNullable.of(pushNotificationToken); + } + + + public Device info(Object info) { + this.info = JsonNullable.of(info); + + return this; + } + + /** + * A flat curated object with properties that vary for each SDK platform. All keys are optional and not guaranteed to be available. + * @return info + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A flat curated object with properties that vary for each SDK platform. All keys are optional and not guaranteed to be available.") + @JsonIgnore + + public Object getInfo() { + return info.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INFO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getInfo_JsonNullable() { + return info; + } + + @JsonProperty(JSON_PROPERTY_INFO) + public void setInfo_JsonNullable(JsonNullable info) { + this.info = info; + } + + public void setInfo(Object info) { + this.info = JsonNullable.of(info); + } + + + public Device appVersion(String appVersion) { + this.appVersion = JsonNullable.of(appVersion); + + return this; + } + + /** + * Version of the mobile app in which the SDK is embedded. Not applicable for devices of type web. + * @return appVersion + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Version of the mobile app in which the SDK is embedded. Not applicable for devices of type web.") + @JsonIgnore + + public String getAppVersion() { + return appVersion.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_APP_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAppVersion_JsonNullable() { + return appVersion; + } + + @JsonProperty(JSON_PROPERTY_APP_VERSION) + public void setAppVersion_JsonNullable(JsonNullable appVersion) { + this.appVersion = appVersion; + } + + public void setAppVersion(String appVersion) { + this.appVersion = JsonNullable.of(appVersion); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Device device = (Device) o; + return Objects.equals(this.id, device.id) && + Objects.equals(this.type, device.type) && + Objects.equals(this.guid, device.guid) && + Objects.equals(this.clientId, device.clientId) && + Objects.equals(this.status, device.status) && + Objects.equals(this.integrationId, device.integrationId) && + Objects.equals(this.lastSeen, device.lastSeen) && + Objects.equals(this.pushNotificationToken, device.pushNotificationToken) && + Objects.equals(this.info, device.info) && + Objects.equals(this.appVersion, device.appVersion); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, guid, clientId, status, integrationId, lastSeen, pushNotificationToken, info, appVersion); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Device {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" guid: ").append(toIndentedString(guid)).append("\n"); + sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" lastSeen: ").append(toIndentedString(lastSeen)).append("\n"); + sb.append(" pushNotificationToken: ").append(toIndentedString(pushNotificationToken)).append("\n"); + sb.append(" info: ").append(toIndentedString(info)).append("\n"); + sb.append(" appVersion: ").append(toIndentedString(appVersion)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/EventSubSchema.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/EventSubSchema.java new file mode 100644 index 00000000..462aa47d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/EventSubSchema.java @@ -0,0 +1,164 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * EventSubSchema + */ +@JsonPropertyOrder({ + EventSubSchema.JSON_PROPERTY_ID, + EventSubSchema.JSON_PROPERTY_TYPE, + EventSubSchema.JSON_PROPERTY_CREATED_AT +}) + +public class EventSubSchema { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + + public EventSubSchema id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public EventSubSchema type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public EventSubSchema createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EventSubSchema eventSubSchema = (EventSubSchema) o; + return Objects.equals(this.id, eventSubSchema.id) && + Objects.equals(this.type, eventSubSchema.type) && + Objects.equals(this.createdAt, eventSubSchema.createdAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventSubSchema {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ExtraChannelOptions.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ExtraChannelOptions.java new file mode 100644 index 00000000..7cdf3408 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ExtraChannelOptions.java @@ -0,0 +1,104 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ExtraChannelOptionsMessenger; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Extra options to pass directly to the channel API. + */ +@ApiModel(description = "Extra options to pass directly to the channel API.") +@JsonPropertyOrder({ + ExtraChannelOptions.JSON_PROPERTY_MESSENGER +}) + +public class ExtraChannelOptions { + public static final String JSON_PROPERTY_MESSENGER = "messenger"; + private ExtraChannelOptionsMessenger messenger; + + + public ExtraChannelOptions messenger(ExtraChannelOptionsMessenger messenger) { + + this.messenger = messenger; + return this; + } + + /** + * Get messenger + * @return messenger + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MESSENGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ExtraChannelOptionsMessenger getMessenger() { + return messenger; + } + + + public void setMessenger(ExtraChannelOptionsMessenger messenger) { + this.messenger = messenger; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExtraChannelOptions extraChannelOptions = (ExtraChannelOptions) o; + return Objects.equals(this.messenger, extraChannelOptions.messenger); + } + + @Override + public int hashCode() { + return Objects.hash(messenger); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExtraChannelOptions {\n"); + sb.append(" messenger: ").append(toIndentedString(messenger)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ExtraChannelOptionsMessenger.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ExtraChannelOptionsMessenger.java new file mode 100644 index 00000000..260f9e68 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ExtraChannelOptionsMessenger.java @@ -0,0 +1,167 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Messenger channel options. + */ +@ApiModel(description = "Messenger channel options.") +@JsonPropertyOrder({ + ExtraChannelOptionsMessenger.JSON_PROPERTY_MESSENGER_EXTENSIONS, + ExtraChannelOptionsMessenger.JSON_PROPERTY_WEBVIEW_SHARE_BUTTON +}) + +public class ExtraChannelOptionsMessenger { + public static final String JSON_PROPERTY_MESSENGER_EXTENSIONS = "messenger_extensions"; + private Boolean messengerExtensions = false; + + /** + * For webview type actions, a string value indicating if the share button should be hidden. [More Info](https://developers.facebook.com/docs/messenger-platform/reference/buttons/url). + */ + public enum WebviewShareButtonEnum { + HIDE("hide"); + + private String value; + + WebviewShareButtonEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static WebviewShareButtonEnum fromValue(String value) { + for (WebviewShareButtonEnum b : WebviewShareButtonEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_WEBVIEW_SHARE_BUTTON = "webview_share_button"; + private WebviewShareButtonEnum webviewShareButton; + + + public ExtraChannelOptionsMessenger messengerExtensions(Boolean messengerExtensions) { + + this.messengerExtensions = messengerExtensions; + return this; + } + + /** + * For webview type actions, a boolean value indicating whether the URL should be loaded with Messenger Extensions enabled. [More info](https://developers.facebook.com/docs/messenger-platform/send-api-reference/url-button). + * @return messengerExtensions + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "false", value = "For webview type actions, a boolean value indicating whether the URL should be loaded with Messenger Extensions enabled. [More info](https://developers.facebook.com/docs/messenger-platform/send-api-reference/url-button).") + @JsonProperty(JSON_PROPERTY_MESSENGER_EXTENSIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getMessengerExtensions() { + return messengerExtensions; + } + + + public void setMessengerExtensions(Boolean messengerExtensions) { + this.messengerExtensions = messengerExtensions; + } + + + public ExtraChannelOptionsMessenger webviewShareButton(WebviewShareButtonEnum webviewShareButton) { + + this.webviewShareButton = webviewShareButton; + return this; + } + + /** + * For webview type actions, a string value indicating if the share button should be hidden. [More Info](https://developers.facebook.com/docs/messenger-platform/reference/buttons/url). + * @return webviewShareButton + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "For webview type actions, a string value indicating if the share button should be hidden. [More Info](https://developers.facebook.com/docs/messenger-platform/reference/buttons/url).") + @JsonProperty(JSON_PROPERTY_WEBVIEW_SHARE_BUTTON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public WebviewShareButtonEnum getWebviewShareButton() { + return webviewShareButton; + } + + + public void setWebviewShareButton(WebviewShareButtonEnum webviewShareButton) { + this.webviewShareButton = webviewShareButton; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExtraChannelOptionsMessenger extraChannelOptionsMessenger = (ExtraChannelOptionsMessenger) o; + return Objects.equals(this.messengerExtensions, extraChannelOptionsMessenger.messengerExtensions) && + Objects.equals(this.webviewShareButton, extraChannelOptionsMessenger.webviewShareButton); + } + + @Override + public int hashCode() { + return Objects.hash(messengerExtensions, webviewShareButton); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExtraChannelOptionsMessenger {\n"); + sb.append(" messengerExtensions: ").append(toIndentedString(messengerExtensions)).append("\n"); + sb.append(" webviewShareButton: ").append(toIndentedString(webviewShareButton)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Field.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Field.java new file mode 100644 index 00000000..4d5fbd4c --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Field.java @@ -0,0 +1,438 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Properties that can be expected to receive inside a form or formResponse message field. + */ +@ApiModel(description = "Properties that can be expected to receive inside a form or formResponse message field. ") +@JsonPropertyOrder({ + Field.JSON_PROPERTY_TYPE, + Field.JSON_PROPERTY_NAME, + Field.JSON_PROPERTY_LABEL, + Field.JSON_PROPERTY_PLACEHOLDER, + Field.JSON_PROPERTY_MIN_SIZE, + Field.JSON_PROPERTY_MAX_SIZE, + Field.JSON_PROPERTY_TEXT, + Field.JSON_PROPERTY_EMAIL, + Field.JSON_PROPERTY_SELECT, + Field.JSON_PROPERTY_OPTIONS +}) + +public class Field { + /** + * The field type. + */ + public enum TypeEnum { + EMAIL("email"), + + SELECT("select"), + + TEXT("text"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_LABEL = "label"; + private String label; + + public static final String JSON_PROPERTY_PLACEHOLDER = "placeholder"; + private String placeholder; + + public static final String JSON_PROPERTY_MIN_SIZE = "minSize"; + private Integer minSize = 1; + + public static final String JSON_PROPERTY_MAX_SIZE = "maxSize"; + private Integer maxSize = 128; + + public static final String JSON_PROPERTY_TEXT = "text"; + private String text; + + public static final String JSON_PROPERTY_EMAIL = "email"; + private String email; + + public static final String JSON_PROPERTY_SELECT = "select"; + private List select = null; + + public static final String JSON_PROPERTY_OPTIONS = "options"; + private List options = null; + + + public Field type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * The field type. + * @return type + **/ + @ApiModelProperty(required = true, value = "The field type.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public Field name(String name) { + + this.name = name; + return this; + } + + /** + * The name of the field. Must be unique per form or formResponse. + * @return name + **/ + @ApiModelProperty(required = true, value = "The name of the field. Must be unique per form or formResponse.") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public Field label(String label) { + + this.label = label; + return this; + } + + /** + * The label of the field. What the field is displayed as on Web Messenger. + * @return label + **/ + @ApiModelProperty(required = true, value = "The label of the field. What the field is displayed as on Web Messenger.") + @JsonProperty(JSON_PROPERTY_LABEL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getLabel() { + return label; + } + + + public void setLabel(String label) { + this.label = label; + } + + + public Field placeholder(String placeholder) { + + this.placeholder = placeholder; + return this; + } + + /** + * Placeholder text for the field. form message only. + * @return placeholder + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Placeholder text for the field. form message only.") + @JsonProperty(JSON_PROPERTY_PLACEHOLDER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPlaceholder() { + return placeholder; + } + + + public void setPlaceholder(String placeholder) { + this.placeholder = placeholder; + } + + + public Field minSize(Integer minSize) { + + this.minSize = minSize; + return this; + } + + /** + * The minimum allowed length for the response for a field of type text. form message only. + * minimum: 1 + * maximum: 128 + * @return minSize + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The minimum allowed length for the response for a field of type text. form message only.") + @JsonProperty(JSON_PROPERTY_MIN_SIZE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getMinSize() { + return minSize; + } + + + public void setMinSize(Integer minSize) { + this.minSize = minSize; + } + + + public Field maxSize(Integer maxSize) { + + this.maxSize = maxSize; + return this; + } + + /** + * The maximum allowed length for the response for a field of type text. form message only. + * minimum: 1 + * maximum: 128 + * @return maxSize + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The maximum allowed length for the response for a field of type text. form message only.") + @JsonProperty(JSON_PROPERTY_MAX_SIZE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getMaxSize() { + return maxSize; + } + + + public void setMaxSize(Integer maxSize) { + this.maxSize = maxSize; + } + + + public Field text(String text) { + + this.text = text; + return this; + } + + /** + * Specifies the response for a text field. + * @return text + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specifies the response for a text field.") + @JsonProperty(JSON_PROPERTY_TEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public Field email(String email) { + + this.email = email; + return this; + } + + /** + * Specifies the response for a email field. + * @return email + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specifies the response for a email field.") + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getEmail() { + return email; + } + + + public void setEmail(String email) { + this.email = email; + } + + + public Field select(List select) { + + this.select = select; + return this; + } + + public Field addSelectItem(Object selectItem) { + if (this.select == null) { + this.select = new ArrayList(); + } + this.select.add(selectItem); + return this; + } + + /** + * Array of objects representing the response for a field of type select. form and formResponse messages only. + * @return select + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Array of objects representing the response for a field of type select. form and formResponse messages only.") + @JsonProperty(JSON_PROPERTY_SELECT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getSelect() { + return select; + } + + + public void setSelect(List select) { + this.select = select; + } + + + public Field options(List options) { + + this.options = options; + return this; + } + + public Field addOptionsItem(Object optionsItem) { + if (this.options == null) { + this.options = new ArrayList(); + } + this.options.add(optionsItem); + return this; + } + + /** + * Array of objects representing options for a field of type select. + * @return options + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Array of objects representing options for a field of type select.") + @JsonProperty(JSON_PROPERTY_OPTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getOptions() { + return options; + } + + + public void setOptions(List options) { + this.options = options; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Field field = (Field) o; + return Objects.equals(this.type, field.type) && + Objects.equals(this.name, field.name) && + Objects.equals(this.label, field.label) && + Objects.equals(this.placeholder, field.placeholder) && + Objects.equals(this.minSize, field.minSize) && + Objects.equals(this.maxSize, field.maxSize) && + Objects.equals(this.text, field.text) && + Objects.equals(this.email, field.email) && + Objects.equals(this.select, field.select) && + Objects.equals(this.options, field.options); + } + + @Override + public int hashCode() { + return Objects.hash(type, name, label, placeholder, minSize, maxSize, text, email, select, options); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Field {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append(" placeholder: ").append(toIndentedString(placeholder)).append("\n"); + sb.append(" minSize: ").append(toIndentedString(minSize)).append("\n"); + sb.append(" maxSize: ").append(toIndentedString(maxSize)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" select: ").append(toIndentedString(select)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/FileMessage.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/FileMessage.java new file mode 100644 index 00000000..74179b9d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/FileMessage.java @@ -0,0 +1,214 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.net.URI; +import com.zendesk.sunshine_conversations_client.model.Content; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * FileMessage + */ +@JsonPropertyOrder({ + FileMessage.JSON_PROPERTY_TYPE, + FileMessage.JSON_PROPERTY_TEXT, + FileMessage.JSON_PROPERTY_MEDIA_URL, + FileMessage.JSON_PROPERTY_MEDIA_SIZE, + FileMessage.JSON_PROPERTY_MEDIA_TYPE +}) + +public class FileMessage implements Content { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "file"; + + public static final String JSON_PROPERTY_TEXT = "text"; + private String text; + + public static final String JSON_PROPERTY_MEDIA_URL = "mediaUrl"; + private URI mediaUrl; + + public static final String JSON_PROPERTY_MEDIA_SIZE = "mediaSize"; + private BigDecimal mediaSize; + + public static final String JSON_PROPERTY_MEDIA_TYPE = "mediaType"; + private String mediaType; + + + public FileMessage type(String type) { + + this.type = type; + return this; + } + + /** + * The type of message. + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of message.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public FileMessage text(String text) { + + this.text = text; + return this; + } + + /** + * The text content of the message. + * @return text + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The text content of the message.") + @JsonProperty(JSON_PROPERTY_TEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public FileMessage mediaUrl(URI mediaUrl) { + + this.mediaUrl = mediaUrl; + return this; + } + + /** + * The URL for media, such as an image, attached to the message. + * @return mediaUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The URL for media, such as an image, attached to the message.") + @JsonProperty(JSON_PROPERTY_MEDIA_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public URI getMediaUrl() { + return mediaUrl; + } + + + public void setMediaUrl(URI mediaUrl) { + this.mediaUrl = mediaUrl; + } + + + /** + * The size of the media. + * @return mediaSize + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The size of the media.") + @JsonProperty(JSON_PROPERTY_MEDIA_SIZE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getMediaSize() { + return mediaSize; + } + + + + + /** + * The media type of the file. + * @return mediaType + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The media type of the file.") + @JsonProperty(JSON_PROPERTY_MEDIA_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMediaType() { + return mediaType; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileMessage fileMessage = (FileMessage) o; + return Objects.equals(this.type, fileMessage.type) && + Objects.equals(this.text, fileMessage.text) && + Objects.equals(this.mediaUrl, fileMessage.mediaUrl) && + Objects.equals(this.mediaSize, fileMessage.mediaSize) && + Objects.equals(this.mediaType, fileMessage.mediaType); + } + + @Override + public int hashCode() { + return Objects.hash(type, text, mediaUrl, mediaSize, mediaType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileMessage {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" mediaUrl: ").append(toIndentedString(mediaUrl)).append("\n"); + sb.append(" mediaSize: ").append(toIndentedString(mediaSize)).append("\n"); + sb.append(" mediaType: ").append(toIndentedString(mediaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/FormMessage.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/FormMessage.java new file mode 100644 index 00000000..aec835ad --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/FormMessage.java @@ -0,0 +1,176 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Field; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.zendesk.sunshine_conversations_client.model.Content; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.math.BigDecimal; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * A form type message without text or actions. + */ +@ApiModel(description = "A form type message without text or actions.") +@JsonPropertyOrder({ + FormMessage.JSON_PROPERTY_TYPE, + FormMessage.JSON_PROPERTY_BLOCK_CHAT_INPUT, + FormMessage.JSON_PROPERTY_FIELDS +}) + +public class FormMessage implements Content { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "form"; + + public static final String JSON_PROPERTY_BLOCK_CHAT_INPUT = "blockChatInput"; + private Boolean blockChatInput; + + public static final String JSON_PROPERTY_FIELDS = "fields"; + private List fields = new ArrayList(); + + + public FormMessage type(String type) { + + this.type = type; + return this; + } + + /** + * The type of message. + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of message.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public FormMessage blockChatInput(Boolean blockChatInput) { + + this.blockChatInput = blockChatInput; + return this; + } + + /** + * true if the message should block the chat input on Web Messenger. form message only. + * @return blockChatInput + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "true if the message should block the chat input on Web Messenger. form message only.") + @JsonProperty(JSON_PROPERTY_BLOCK_CHAT_INPUT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getBlockChatInput() { + return blockChatInput; + } + + + public void setBlockChatInput(Boolean blockChatInput) { + this.blockChatInput = blockChatInput; + } + + + public FormMessage fields(List fields) { + + this.fields = fields; + return this; + } + + public FormMessage addFieldsItem(Field fieldsItem) { + this.fields.add(fieldsItem); + return this; + } + + /** + * An array of objects representing fields associated with the message. Only present in form and formResponse messages. + * @return fields + **/ + @ApiModelProperty(required = true, value = "An array of objects representing fields associated with the message. Only present in form and formResponse messages.") + @JsonProperty(JSON_PROPERTY_FIELDS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getFields() { + return fields; + } + + + public void setFields(List fields) { + this.fields = fields; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormMessage formMessage = (FormMessage) o; + return Objects.equals(this.type, formMessage.type) && + Objects.equals(this.blockChatInput, formMessage.blockChatInput) && + Objects.equals(this.fields, formMessage.fields); + } + + @Override + public int hashCode() { + return Objects.hash(type, blockChatInput, fields); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormMessage {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" blockChatInput: ").append(toIndentedString(blockChatInput)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/FormResponseMessage.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/FormResponseMessage.java new file mode 100644 index 00000000..c80bdde5 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/FormResponseMessage.java @@ -0,0 +1,167 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Field; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.zendesk.sunshine_conversations_client.model.Content; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.math.BigDecimal; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * A formResponse type message is a response to a form type message. formResponse type messages are only supported as responses to form messages on Web Messenger and cannot be sent via the API. + */ +@ApiModel(description = "A formResponse type message is a response to a form type message. formResponse type messages are only supported as responses to form messages on Web Messenger and cannot be sent via the API.") +@JsonPropertyOrder({ + FormResponseMessage.JSON_PROPERTY_TYPE, + FormResponseMessage.JSON_PROPERTY_FIELDS, + FormResponseMessage.JSON_PROPERTY_TEXT_FALLBACK +}) + +public class FormResponseMessage implements Content { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "formResponse"; + + public static final String JSON_PROPERTY_FIELDS = "fields"; + private List fields = new ArrayList(); + + public static final String JSON_PROPERTY_TEXT_FALLBACK = "textFallback"; + private String textFallback; + + + public FormResponseMessage type(String type) { + + this.type = type; + return this; + } + + /** + * The type of message. + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of message.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public FormResponseMessage fields(List fields) { + + this.fields = fields; + return this; + } + + public FormResponseMessage addFieldsItem(Field fieldsItem) { + this.fields.add(fieldsItem); + return this; + } + + /** + * Array of field objects that contain the submitted fields. + * @return fields + **/ + @ApiModelProperty(required = true, value = "Array of field objects that contain the submitted fields.") + @JsonProperty(JSON_PROPERTY_FIELDS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getFields() { + return fields; + } + + + public void setFields(List fields) { + this.fields = fields; + } + + + /** + * A string containing the `label: value` of all fields, each separated by a newline character. + * @return textFallback + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A string containing the `label: value` of all fields, each separated by a newline character.") + @JsonProperty(JSON_PROPERTY_TEXT_FALLBACK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getTextFallback() { + return textFallback; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormResponseMessage formResponseMessage = (FormResponseMessage) o; + return Objects.equals(this.type, formResponseMessage.type) && + Objects.equals(this.fields, formResponseMessage.fields) && + Objects.equals(this.textFallback, formResponseMessage.textFallback); + } + + @Override + public int hashCode() { + return Objects.hash(type, fields, textFallback); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormResponseMessage {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append(" textFallback: ").append(toIndentedString(textFallback)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ImageMessage.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ImageMessage.java new file mode 100644 index 00000000..d1847cfa --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ImageMessage.java @@ -0,0 +1,210 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Action; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import com.zendesk.sunshine_conversations_client.model.Content; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ImageMessage + */ +@JsonPropertyOrder({ + ImageMessage.JSON_PROPERTY_TYPE, + ImageMessage.JSON_PROPERTY_TEXT, + ImageMessage.JSON_PROPERTY_ACTIONS, + ImageMessage.JSON_PROPERTY_MEDIA_URL +}) + +public class ImageMessage implements Content { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "image"; + + public static final String JSON_PROPERTY_TEXT = "text"; + private String text; + + public static final String JSON_PROPERTY_ACTIONS = "actions"; + private List actions = null; + + public static final String JSON_PROPERTY_MEDIA_URL = "mediaUrl"; + private URI mediaUrl; + + + public ImageMessage type(String type) { + + this.type = type; + return this; + } + + /** + * The type of message. + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of message.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ImageMessage text(String text) { + + this.text = text; + return this; + } + + /** + * The text content of the message. Optional only if actions are provided. + * @return text + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The text content of the message. Optional only if actions are provided.") + @JsonProperty(JSON_PROPERTY_TEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public ImageMessage actions(List actions) { + + this.actions = actions; + return this; + } + + public ImageMessage addActionsItem(Action actionsItem) { + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actionsItem); + return this; + } + + /** + * Array of message actions. + * @return actions + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Array of message actions.") + @JsonProperty(JSON_PROPERTY_ACTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getActions() { + return actions; + } + + + public void setActions(List actions) { + this.actions = actions; + } + + + public ImageMessage mediaUrl(URI mediaUrl) { + + this.mediaUrl = mediaUrl; + return this; + } + + /** + * The URL for media, such as an image, attached to the message. + * @return mediaUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The URL for media, such as an image, attached to the message.") + @JsonProperty(JSON_PROPERTY_MEDIA_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public URI getMediaUrl() { + return mediaUrl; + } + + + public void setMediaUrl(URI mediaUrl) { + this.mediaUrl = mediaUrl; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ImageMessage imageMessage = (ImageMessage) o; + return Objects.equals(this.type, imageMessage.type) && + Objects.equals(this.text, imageMessage.text) && + Objects.equals(this.actions, imageMessage.actions) && + Objects.equals(this.mediaUrl, imageMessage.mediaUrl); + } + + @Override + public int hashCode() { + return Objects.hash(type, text, actions, mediaUrl); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageMessage {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); + sb.append(" mediaUrl: ").append(toIndentedString(mediaUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Integration.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Integration.java new file mode 100644 index 00000000..ce796370 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Integration.java @@ -0,0 +1,235 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Android; +import com.zendesk.sunshine_conversations_client.model.Apple; +import com.zendesk.sunshine_conversations_client.model.Custom; +import com.zendesk.sunshine_conversations_client.model.Ios; +import com.zendesk.sunshine_conversations_client.model.Line; +import com.zendesk.sunshine_conversations_client.model.Mailgun; +import com.zendesk.sunshine_conversations_client.model.MessageBird; +import com.zendesk.sunshine_conversations_client.model.Messenger; +import com.zendesk.sunshine_conversations_client.model.Status; +import com.zendesk.sunshine_conversations_client.model.Telegram; +import com.zendesk.sunshine_conversations_client.model.Twilio; +import com.zendesk.sunshine_conversations_client.model.Twitter; +import com.zendesk.sunshine_conversations_client.model.Viber; +import com.zendesk.sunshine_conversations_client.model.Web; +import com.zendesk.sunshine_conversations_client.model.Whatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The integration. + */ +@ApiModel(description = "The integration.") +@JsonPropertyOrder({ + Integration.JSON_PROPERTY_ID, + Integration.JSON_PROPERTY_TYPE, + Integration.JSON_PROPERTY_STATUS, + Integration.JSON_PROPERTY_DISPLAY_NAME +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Android.class, name = "android"), + @JsonSubTypes.Type(value = Apple.class, name = "apple"), + @JsonSubTypes.Type(value = Custom.class, name = "custom"), + @JsonSubTypes.Type(value = Ios.class, name = "ios"), + @JsonSubTypes.Type(value = Line.class, name = "line"), + @JsonSubTypes.Type(value = Mailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messageBird"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messagebird"), + @JsonSubTypes.Type(value = Messenger.class, name = "messenger"), + @JsonSubTypes.Type(value = Telegram.class, name = "telegram"), + @JsonSubTypes.Type(value = Twilio.class, name = "twilio"), + @JsonSubTypes.Type(value = Twitter.class, name = "twitter"), + @JsonSubTypes.Type(value = Viber.class, name = "viber"), + @JsonSubTypes.Type(value = Web.class, name = "web"), + @JsonSubTypes.Type(value = Whatsapp.class, name = "whatsapp"), +}) + +public class Integration { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type; + + public static final String JSON_PROPERTY_STATUS = "status"; + private Status status; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private JsonNullable displayName = JsonNullable.undefined(); + + + /** + * The unique ID of the integration. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5e4af71a81966cfff3ef6550", value = "The unique ID of the integration.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + + + public Integration type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @ApiModelProperty(example = "android", required = true, value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Integration status(Status status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Status getStatus() { + return status; + } + + + public void setStatus(Status status) { + this.status = status; + } + + + public Integration displayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + + return this; + } + + /** + * A human-friendly name used to identify the integration. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Channel name", value = "A human-friendly name used to identify the integration.") + @JsonIgnore + + public String getDisplayName() { + return displayName.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDisplayName_JsonNullable() { + return displayName; + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + public void setDisplayName_JsonNullable(JsonNullable displayName) { + this.displayName = displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Integration integration = (Integration) o; + return Objects.equals(this.id, integration.id) && + Objects.equals(this.type, integration.type) && + Objects.equals(this.status, integration.status) && + Objects.equals(this.displayName, integration.displayName); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, status, displayName); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Integration {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationApiKey.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationApiKey.java new file mode 100644 index 00000000..b3f9150a --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationApiKey.java @@ -0,0 +1,101 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * IntegrationApiKey + */ +@JsonPropertyOrder({ + IntegrationApiKey.JSON_PROPERTY_DISPLAY_NAME +}) + +public class IntegrationApiKey { + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private String displayName; + + + public IntegrationApiKey displayName(String displayName) { + + this.displayName = displayName; + return this; + } + + /** + * The name of the API key. + * @return displayName + **/ + @ApiModelProperty(example = "My custom key", required = true, value = "The name of the API key.") + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getDisplayName() { + return displayName; + } + + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IntegrationApiKey integrationApiKey = (IntegrationApiKey) o; + return Objects.equals(this.displayName, integrationApiKey.displayName); + } + + @Override + public int hashCode() { + return Objects.hash(displayName); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegrationApiKey {\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationApiKeyListResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationApiKeyListResponse.java new file mode 100644 index 00000000..0cf57cd0 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationApiKeyListResponse.java @@ -0,0 +1,113 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ApiKey; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * IntegrationApiKeyListResponse + */ +@JsonPropertyOrder({ + IntegrationApiKeyListResponse.JSON_PROPERTY_KEYS +}) + +public class IntegrationApiKeyListResponse { + public static final String JSON_PROPERTY_KEYS = "keys"; + private List keys = null; + + + public IntegrationApiKeyListResponse keys(List keys) { + + this.keys = keys; + return this; + } + + public IntegrationApiKeyListResponse addKeysItem(ApiKey keysItem) { + if (this.keys == null) { + this.keys = new ArrayList(); + } + this.keys.add(keysItem); + return this; + } + + /** + * Integration keys of the supplied integration. + * @return keys + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Integration keys of the supplied integration.") + @JsonProperty(JSON_PROPERTY_KEYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getKeys() { + return keys; + } + + + public void setKeys(List keys) { + this.keys = keys; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IntegrationApiKeyListResponse integrationApiKeyListResponse = (IntegrationApiKeyListResponse) o; + return Objects.equals(this.keys, integrationApiKeyListResponse.keys); + } + + @Override + public int hashCode() { + return Objects.hash(keys); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegrationApiKeyListResponse {\n"); + sb.append(" keys: ").append(toIndentedString(keys)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationApiKeyResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationApiKeyResponse.java new file mode 100644 index 00000000..2825e7a5 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationApiKeyResponse.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ApiKey; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * IntegrationApiKeyResponse + */ +@JsonPropertyOrder({ + IntegrationApiKeyResponse.JSON_PROPERTY_KEY +}) + +public class IntegrationApiKeyResponse { + public static final String JSON_PROPERTY_KEY = "key"; + private ApiKey key; + + + public IntegrationApiKeyResponse key(ApiKey key) { + + this.key = key; + return this; + } + + /** + * Get key + * @return key + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ApiKey getKey() { + return key; + } + + + public void setKey(ApiKey key) { + this.key = key; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IntegrationApiKeyResponse integrationApiKeyResponse = (IntegrationApiKeyResponse) o; + return Objects.equals(this.key, integrationApiKeyResponse.key); + } + + @Override + public int hashCode() { + return Objects.hash(key); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegrationApiKeyResponse {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationId.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationId.java new file mode 100644 index 00000000..bc1d6dc4 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationId.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.Destination; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * IntegrationId + */ +@JsonPropertyOrder({ + IntegrationId.JSON_PROPERTY_INTEGRATION_ID +}) + +public class IntegrationId implements Destination { + public static final String JSON_PROPERTY_INTEGRATION_ID = "integrationId"; + private String integrationId; + + + public IntegrationId integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * The id of the integration to deliver the message to. Will return an error if the integration does not exist or if the user does not have a client for the integration attached to the conversation. + * @return integrationId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "582dedf230e788746891281a", value = "The id of the integration to deliver the message to. Will return an error if the integration does not exist or if the user does not have a client for the integration attached to the conversation. ") + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getIntegrationId() { + return integrationId; + } + + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IntegrationId integrationId = (IntegrationId) o; + return Objects.equals(this.integrationId, integrationId.integrationId); + } + + @Override + public int hashCode() { + return Objects.hash(integrationId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegrationId {\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationListFilter.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationListFilter.java new file mode 100644 index 00000000..ea6cd23c --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationListFilter.java @@ -0,0 +1,102 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * IntegrationListFilter + */ +@JsonPropertyOrder({ + IntegrationListFilter.JSON_PROPERTY_TYPES +}) + +public class IntegrationListFilter { + public static final String JSON_PROPERTY_TYPES = "types"; + private String types; + + + public IntegrationListFilter types(String types) { + + this.types = types; + return this; + } + + /** + * Comma-separated list of types to return. If omitted, all types are returned. + * @return types + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "android,ios", value = "Comma-separated list of types to return. If omitted, all types are returned.") + @JsonProperty(JSON_PROPERTY_TYPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getTypes() { + return types; + } + + + public void setTypes(String types) { + this.types = types; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IntegrationListFilter integrationListFilter = (IntegrationListFilter) o; + return Objects.equals(this.types, integrationListFilter.types); + } + + @Override + public int hashCode() { + return Objects.hash(types); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegrationListFilter {\n"); + sb.append(" types: ").append(toIndentedString(types)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationListResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationListResponse.java new file mode 100644 index 00000000..f675ec9f --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationListResponse.java @@ -0,0 +1,177 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.Links; +import com.zendesk.sunshine_conversations_client.model.Meta; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * IntegrationListResponse + */ +@JsonPropertyOrder({ + IntegrationListResponse.JSON_PROPERTY_INTEGRATIONS, + IntegrationListResponse.JSON_PROPERTY_META, + IntegrationListResponse.JSON_PROPERTY_LINKS +}) + +public class IntegrationListResponse { + public static final String JSON_PROPERTY_INTEGRATIONS = "integrations"; + private List integrations = null; + + public static final String JSON_PROPERTY_META = "meta"; + private Meta meta; + + public static final String JSON_PROPERTY_LINKS = "links"; + private Links links; + + + public IntegrationListResponse integrations(List integrations) { + + this.integrations = integrations; + return this; + } + + public IntegrationListResponse addIntegrationsItem(Integration integrationsItem) { + if (this.integrations == null) { + this.integrations = new ArrayList(); + } + this.integrations.add(integrationsItem); + return this; + } + + /** + * List of returned integrations. + * @return integrations + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of returned integrations.") + @JsonProperty(JSON_PROPERTY_INTEGRATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getIntegrations() { + return integrations; + } + + + public void setIntegrations(List integrations) { + this.integrations = integrations; + } + + + public IntegrationListResponse meta(Meta meta) { + + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Meta getMeta() { + return meta; + } + + + public void setMeta(Meta meta) { + this.meta = meta; + } + + + public IntegrationListResponse links(Links links) { + + this.links = links; + return this; + } + + /** + * Get links + * @return links + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LINKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Links getLinks() { + return links; + } + + + public void setLinks(Links links) { + this.links = links; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IntegrationListResponse integrationListResponse = (IntegrationListResponse) o; + return Objects.equals(this.integrations, integrationListResponse.integrations) && + Objects.equals(this.meta, integrationListResponse.meta) && + Objects.equals(this.links, integrationListResponse.links); + } + + @Override + public int hashCode() { + return Objects.hash(integrations, meta, links); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegrationListResponse {\n"); + sb.append(" integrations: ").append(toIndentedString(integrations)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationResponse.java new file mode 100644 index 00000000..937cbb98 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationResponse.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Integration; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * IntegrationResponse + */ +@JsonPropertyOrder({ + IntegrationResponse.JSON_PROPERTY_INTEGRATION +}) + +public class IntegrationResponse { + public static final String JSON_PROPERTY_INTEGRATION = "integration"; + private Integration integration; + + + public IntegrationResponse integration(Integration integration) { + + this.integration = integration; + return this; + } + + /** + * Get integration + * @return integration + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_INTEGRATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integration getIntegration() { + return integration; + } + + + public void setIntegration(Integration integration) { + this.integration = integration; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IntegrationResponse integrationResponse = (IntegrationResponse) o; + return Objects.equals(this.integration, integrationResponse.integration); + } + + @Override + public int hashCode() { + return Objects.hash(integration); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegrationResponse {\n"); + sb.append(" integration: ").append(toIndentedString(integration)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationType.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationType.java new file mode 100644 index 00000000..c688ddf1 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationType.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.Destination; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * IntegrationType + */ +@JsonPropertyOrder({ + IntegrationType.JSON_PROPERTY_INTEGRATION_TYPE +}) + +public class IntegrationType implements Destination { + public static final String JSON_PROPERTY_INTEGRATION_TYPE = "integrationType"; + private String integrationType; + + + public IntegrationType integrationType(String integrationType) { + + this.integrationType = integrationType; + return this; + } + + /** + * The type of the integration to deliver the message to. Will return an error if the user does not have a client of that type attached to the conversation. + * @return integrationType + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "whatsapp", value = "The type of the integration to deliver the message to. Will return an error if the user does not have a client of that type attached to the conversation. ") + @JsonProperty(JSON_PROPERTY_INTEGRATION_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getIntegrationType() { + return integrationType; + } + + + public void setIntegrationType(String integrationType) { + this.integrationType = integrationType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IntegrationType integrationType = (IntegrationType) o; + return Objects.equals(this.integrationType, integrationType.integrationType); + } + + @Override + public int hashCode() { + return Objects.hash(integrationType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegrationType {\n"); + sb.append(" integrationType: ").append(toIndentedString(integrationType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationUpdate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationUpdate.java new file mode 100644 index 00000000..6387b346 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationUpdate.java @@ -0,0 +1,55 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.AndroidUpdate; +import com.zendesk.sunshine_conversations_client.model.AppleUpdate; +import com.zendesk.sunshine_conversations_client.model.CustomUpdate; +import com.zendesk.sunshine_conversations_client.model.IosUpdate; +import com.zendesk.sunshine_conversations_client.model.LineUpdate; +import com.zendesk.sunshine_conversations_client.model.MailgunUpdate; +import com.zendesk.sunshine_conversations_client.model.MessageBirdUpdate; +import com.zendesk.sunshine_conversations_client.model.MessengerUpdate; +import com.zendesk.sunshine_conversations_client.model.PrechatCapture; +import com.zendesk.sunshine_conversations_client.model.TelegramUpdate; +import com.zendesk.sunshine_conversations_client.model.TwilioUpdate; +import com.zendesk.sunshine_conversations_client.model.TwitterUpdate; +import com.zendesk.sunshine_conversations_client.model.ViberUpdate; +import com.zendesk.sunshine_conversations_client.model.WebUpdate; +import com.zendesk.sunshine_conversations_client.model.WhatsAppUpdate; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "", visible = true) +@JsonSubTypes({ +}) + +public interface IntegrationUpdate { +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationUpdateBase.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationUpdateBase.java new file mode 100644 index 00000000..b1cdcfc2 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/IntegrationUpdateBase.java @@ -0,0 +1,115 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * IntegrationUpdateBase + */ +@JsonPropertyOrder({ + IntegrationUpdateBase.JSON_PROPERTY_DISPLAY_NAME +}) + +public class IntegrationUpdateBase { + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private JsonNullable displayName = JsonNullable.undefined(); + + + public IntegrationUpdateBase displayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + + return this; + } + + /** + * A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "My awesome integration", value = "A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`.") + @JsonIgnore + + public String getDisplayName() { + return displayName.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDisplayName_JsonNullable() { + return displayName; + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + public void setDisplayName_JsonNullable(JsonNullable displayName) { + this.displayName = displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IntegrationUpdateBase integrationUpdateBase = (IntegrationUpdateBase) o; + return Objects.equals(this.displayName, integrationUpdateBase.displayName); + } + + @Override + public int hashCode() { + return Objects.hash(displayName); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegrationUpdateBase {\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Ios.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Ios.java new file mode 100644 index 00000000..2a828706 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Ios.java @@ -0,0 +1,309 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Android; +import com.zendesk.sunshine_conversations_client.model.Apple; +import com.zendesk.sunshine_conversations_client.model.Custom; +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.Ios; +import com.zendesk.sunshine_conversations_client.model.IosAllOf; +import com.zendesk.sunshine_conversations_client.model.Line; +import com.zendesk.sunshine_conversations_client.model.Mailgun; +import com.zendesk.sunshine_conversations_client.model.MessageBird; +import com.zendesk.sunshine_conversations_client.model.Messenger; +import com.zendesk.sunshine_conversations_client.model.Status; +import com.zendesk.sunshine_conversations_client.model.Telegram; +import com.zendesk.sunshine_conversations_client.model.Twilio; +import com.zendesk.sunshine_conversations_client.model.Twitter; +import com.zendesk.sunshine_conversations_client.model.Viber; +import com.zendesk.sunshine_conversations_client.model.Web; +import com.zendesk.sunshine_conversations_client.model.Whatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Ios + */ +@JsonPropertyOrder({ + Ios.JSON_PROPERTY_TYPE, + Ios.JSON_PROPERTY_CERTIFICATE, + Ios.JSON_PROPERTY_PASSWORD, + Ios.JSON_PROPERTY_PRODUCTION, + Ios.JSON_PROPERTY_AUTO_UPDATE_BADGE, + Ios.JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Android.class, name = "android"), + @JsonSubTypes.Type(value = Apple.class, name = "apple"), + @JsonSubTypes.Type(value = Custom.class, name = "custom"), + @JsonSubTypes.Type(value = Ios.class, name = "ios"), + @JsonSubTypes.Type(value = Line.class, name = "line"), + @JsonSubTypes.Type(value = Mailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messagebird"), + @JsonSubTypes.Type(value = Messenger.class, name = "messenger"), + @JsonSubTypes.Type(value = Telegram.class, name = "telegram"), + @JsonSubTypes.Type(value = Twilio.class, name = "twilio"), + @JsonSubTypes.Type(value = Twitter.class, name = "twitter"), + @JsonSubTypes.Type(value = Viber.class, name = "viber"), + @JsonSubTypes.Type(value = Web.class, name = "web"), + @JsonSubTypes.Type(value = Whatsapp.class, name = "whatsapp"), +}) + +public class Ios extends Integration { + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type = "ios"; + + public static final String JSON_PROPERTY_CERTIFICATE = "certificate"; + private JsonNullable certificate = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_PRODUCTION = "production"; + private Boolean production; + + public static final String JSON_PROPERTY_AUTO_UPDATE_BADGE = "autoUpdateBadge"; + private Boolean autoUpdateBadge; + + public static final String JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS = "canUserCreateMoreConversations"; + private Boolean canUserCreateMoreConversations; + + + public Ios type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Ios certificate(String certificate) { + this.certificate = JsonNullable.of(certificate); + + return this; + } + + /** + * The binary of your APN certificate base64 encoded. + * @return certificate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_APN_certificate", value = "The binary of your APN certificate base64 encoded.") + @JsonIgnore + + public String getCertificate() { + return certificate.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CERTIFICATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getCertificate_JsonNullable() { + return certificate; + } + + @JsonProperty(JSON_PROPERTY_CERTIFICATE) + public void setCertificate_JsonNullable(JsonNullable certificate) { + this.certificate = certificate; + } + + public void setCertificate(String certificate) { + this.certificate = JsonNullable.of(certificate); + } + + + public Ios password(String password) { + + this.password = password; + return this; + } + + /** + * The password for your APN certificate. + * @return password + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_APN_password", value = "The password for your APN certificate.") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public Ios production(Boolean production) { + + this.production = production; + return this; + } + + /** + * The APN environment to connect to (Production, if true, or Sandbox). Defaults to value inferred from certificate if not specified. + * @return production + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The APN environment to connect to (Production, if true, or Sandbox). Defaults to value inferred from certificate if not specified.") + @JsonProperty(JSON_PROPERTY_PRODUCTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getProduction() { + return production; + } + + + public void setProduction(Boolean production) { + this.production = production; + } + + + public Ios autoUpdateBadge(Boolean autoUpdateBadge) { + + this.autoUpdateBadge = autoUpdateBadge; + return this; + } + + /** + * Use the unread count of the conversation as the application badge. + * @return autoUpdateBadge + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Use the unread count of the conversation as the application badge.") + @JsonProperty(JSON_PROPERTY_AUTO_UPDATE_BADGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getAutoUpdateBadge() { + return autoUpdateBadge; + } + + + public void setAutoUpdateBadge(Boolean autoUpdateBadge) { + this.autoUpdateBadge = autoUpdateBadge; + } + + + public Ios canUserCreateMoreConversations(Boolean canUserCreateMoreConversations) { + + this.canUserCreateMoreConversations = canUserCreateMoreConversations; + return this; + } + + /** + * Allows users to create more than one conversation on the iOS integration. + * @return canUserCreateMoreConversations + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Allows users to create more than one conversation on the iOS integration.") + @JsonProperty(JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getCanUserCreateMoreConversations() { + return canUserCreateMoreConversations; + } + + + public void setCanUserCreateMoreConversations(Boolean canUserCreateMoreConversations) { + this.canUserCreateMoreConversations = canUserCreateMoreConversations; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Ios ios = (Ios) o; + return Objects.equals(this.type, ios.type) && + Objects.equals(this.certificate, ios.certificate) && + Objects.equals(this.password, ios.password) && + Objects.equals(this.production, ios.production) && + Objects.equals(this.autoUpdateBadge, ios.autoUpdateBadge) && + Objects.equals(this.canUserCreateMoreConversations, ios.canUserCreateMoreConversations) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, certificate, password, production, autoUpdateBadge, canUserCreateMoreConversations, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Ios {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" certificate: ").append(toIndentedString(certificate)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" production: ").append(toIndentedString(production)).append("\n"); + sb.append(" autoUpdateBadge: ").append(toIndentedString(autoUpdateBadge)).append("\n"); + sb.append(" canUserCreateMoreConversations: ").append(toIndentedString(canUserCreateMoreConversations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/IosAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/IosAllOf.java new file mode 100644 index 00000000..2e0d7d48 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/IosAllOf.java @@ -0,0 +1,270 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * IosAllOf + */ +@JsonPropertyOrder({ + IosAllOf.JSON_PROPERTY_TYPE, + IosAllOf.JSON_PROPERTY_CERTIFICATE, + IosAllOf.JSON_PROPERTY_PASSWORD, + IosAllOf.JSON_PROPERTY_PRODUCTION, + IosAllOf.JSON_PROPERTY_AUTO_UPDATE_BADGE, + IosAllOf.JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS +}) + +public class IosAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "ios"; + + public static final String JSON_PROPERTY_CERTIFICATE = "certificate"; + private JsonNullable certificate = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_PRODUCTION = "production"; + private Boolean production; + + public static final String JSON_PROPERTY_AUTO_UPDATE_BADGE = "autoUpdateBadge"; + private Boolean autoUpdateBadge; + + public static final String JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS = "canUserCreateMoreConversations"; + private Boolean canUserCreateMoreConversations; + + + public IosAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public IosAllOf certificate(String certificate) { + this.certificate = JsonNullable.of(certificate); + + return this; + } + + /** + * The binary of your APN certificate base64 encoded. + * @return certificate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_APN_certificate", value = "The binary of your APN certificate base64 encoded.") + @JsonIgnore + + public String getCertificate() { + return certificate.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CERTIFICATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getCertificate_JsonNullable() { + return certificate; + } + + @JsonProperty(JSON_PROPERTY_CERTIFICATE) + public void setCertificate_JsonNullable(JsonNullable certificate) { + this.certificate = certificate; + } + + public void setCertificate(String certificate) { + this.certificate = JsonNullable.of(certificate); + } + + + public IosAllOf password(String password) { + + this.password = password; + return this; + } + + /** + * The password for your APN certificate. + * @return password + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_APN_password", value = "The password for your APN certificate.") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public IosAllOf production(Boolean production) { + + this.production = production; + return this; + } + + /** + * The APN environment to connect to (Production, if true, or Sandbox). Defaults to value inferred from certificate if not specified. + * @return production + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The APN environment to connect to (Production, if true, or Sandbox). Defaults to value inferred from certificate if not specified.") + @JsonProperty(JSON_PROPERTY_PRODUCTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getProduction() { + return production; + } + + + public void setProduction(Boolean production) { + this.production = production; + } + + + public IosAllOf autoUpdateBadge(Boolean autoUpdateBadge) { + + this.autoUpdateBadge = autoUpdateBadge; + return this; + } + + /** + * Use the unread count of the conversation as the application badge. + * @return autoUpdateBadge + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Use the unread count of the conversation as the application badge.") + @JsonProperty(JSON_PROPERTY_AUTO_UPDATE_BADGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getAutoUpdateBadge() { + return autoUpdateBadge; + } + + + public void setAutoUpdateBadge(Boolean autoUpdateBadge) { + this.autoUpdateBadge = autoUpdateBadge; + } + + + public IosAllOf canUserCreateMoreConversations(Boolean canUserCreateMoreConversations) { + + this.canUserCreateMoreConversations = canUserCreateMoreConversations; + return this; + } + + /** + * Allows users to create more than one conversation on the iOS integration. + * @return canUserCreateMoreConversations + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Allows users to create more than one conversation on the iOS integration.") + @JsonProperty(JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getCanUserCreateMoreConversations() { + return canUserCreateMoreConversations; + } + + + public void setCanUserCreateMoreConversations(Boolean canUserCreateMoreConversations) { + this.canUserCreateMoreConversations = canUserCreateMoreConversations; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IosAllOf iosAllOf = (IosAllOf) o; + return Objects.equals(this.type, iosAllOf.type) && + Objects.equals(this.certificate, iosAllOf.certificate) && + Objects.equals(this.password, iosAllOf.password) && + Objects.equals(this.production, iosAllOf.production) && + Objects.equals(this.autoUpdateBadge, iosAllOf.autoUpdateBadge) && + Objects.equals(this.canUserCreateMoreConversations, iosAllOf.canUserCreateMoreConversations); + } + + @Override + public int hashCode() { + return Objects.hash(type, certificate, password, production, autoUpdateBadge, canUserCreateMoreConversations); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IosAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" certificate: ").append(toIndentedString(certificate)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" production: ").append(toIndentedString(production)).append("\n"); + sb.append(" autoUpdateBadge: ").append(toIndentedString(autoUpdateBadge)).append("\n"); + sb.append(" canUserCreateMoreConversations: ").append(toIndentedString(canUserCreateMoreConversations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/IosUpdate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/IosUpdate.java new file mode 100644 index 00000000..756b31d2 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/IosUpdate.java @@ -0,0 +1,285 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdateBase; +import com.zendesk.sunshine_conversations_client.model.IosUpdateAllOf; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdate; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * IosUpdate + */ +@JsonPropertyOrder({ + IosUpdate.JSON_PROPERTY_DISPLAY_NAME, + IosUpdate.JSON_PROPERTY_CERTIFICATE, + IosUpdate.JSON_PROPERTY_PASSWORD, + IosUpdate.JSON_PROPERTY_PRODUCTION, + IosUpdate.JSON_PROPERTY_AUTO_UPDATE_BADGE, + IosUpdate.JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION +}) + +public class IosUpdate implements IntegrationUpdate { + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private JsonNullable displayName = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CERTIFICATE = "certificate"; + private JsonNullable certificate = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_PRODUCTION = "production"; + private Boolean production; + + public static final String JSON_PROPERTY_AUTO_UPDATE_BADGE = "autoUpdateBadge"; + private Boolean autoUpdateBadge; + + public static final String JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION = "canUserCreateConversation"; + private Boolean canUserCreateConversation; + + + public IosUpdate displayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + + return this; + } + + /** + * A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "My awesome integration", value = "A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`.") + @JsonIgnore + + public String getDisplayName() { + return displayName.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDisplayName_JsonNullable() { + return displayName; + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + public void setDisplayName_JsonNullable(JsonNullable displayName) { + this.displayName = displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + } + + + public IosUpdate certificate(String certificate) { + this.certificate = JsonNullable.of(certificate); + + return this; + } + + /** + * The binary of your APN certificate base64 encoded. + * @return certificate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_APN_certificate", value = "The binary of your APN certificate base64 encoded.") + @JsonIgnore + + public String getCertificate() { + return certificate.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CERTIFICATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getCertificate_JsonNullable() { + return certificate; + } + + @JsonProperty(JSON_PROPERTY_CERTIFICATE) + public void setCertificate_JsonNullable(JsonNullable certificate) { + this.certificate = certificate; + } + + public void setCertificate(String certificate) { + this.certificate = JsonNullable.of(certificate); + } + + + public IosUpdate password(String password) { + + this.password = password; + return this; + } + + /** + * The password for your APN certificate. + * @return password + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_APN_password", value = "The password for your APN certificate.") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public IosUpdate production(Boolean production) { + + this.production = production; + return this; + } + + /** + * The APN environment to connect to (Production, if true, or Sandbox). Defaults to value inferred from certificate if not specified. + * @return production + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The APN environment to connect to (Production, if true, or Sandbox). Defaults to value inferred from certificate if not specified.") + @JsonProperty(JSON_PROPERTY_PRODUCTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getProduction() { + return production; + } + + + public void setProduction(Boolean production) { + this.production = production; + } + + + public IosUpdate autoUpdateBadge(Boolean autoUpdateBadge) { + + this.autoUpdateBadge = autoUpdateBadge; + return this; + } + + /** + * Use the unread count of the conversation as the application badge. + * @return autoUpdateBadge + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Use the unread count of the conversation as the application badge.") + @JsonProperty(JSON_PROPERTY_AUTO_UPDATE_BADGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getAutoUpdateBadge() { + return autoUpdateBadge; + } + + + public void setAutoUpdateBadge(Boolean autoUpdateBadge) { + this.autoUpdateBadge = autoUpdateBadge; + } + + + public IosUpdate canUserCreateConversation(Boolean canUserCreateConversation) { + + this.canUserCreateConversation = canUserCreateConversation; + return this; + } + + /** + * Allows users to create more than one conversation on the iOS integration. + * @return canUserCreateConversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Allows users to create more than one conversation on the iOS integration.") + @JsonProperty(JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getCanUserCreateConversation() { + return canUserCreateConversation; + } + + + public void setCanUserCreateConversation(Boolean canUserCreateConversation) { + this.canUserCreateConversation = canUserCreateConversation; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IosUpdate iosUpdate = (IosUpdate) o; + return Objects.equals(this.displayName, iosUpdate.displayName) && + Objects.equals(this.certificate, iosUpdate.certificate) && + Objects.equals(this.password, iosUpdate.password) && + Objects.equals(this.production, iosUpdate.production) && + Objects.equals(this.autoUpdateBadge, iosUpdate.autoUpdateBadge) && + Objects.equals(this.canUserCreateConversation, iosUpdate.canUserCreateConversation); + } + + @Override + public int hashCode() { + return Objects.hash(displayName, certificate, password, production, autoUpdateBadge, canUserCreateConversation); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IosUpdate {\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" certificate: ").append(toIndentedString(certificate)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" production: ").append(toIndentedString(production)).append("\n"); + sb.append(" autoUpdateBadge: ").append(toIndentedString(autoUpdateBadge)).append("\n"); + sb.append(" canUserCreateConversation: ").append(toIndentedString(canUserCreateConversation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/IosUpdateAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/IosUpdateAllOf.java new file mode 100644 index 00000000..641b1f02 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/IosUpdateAllOf.java @@ -0,0 +1,239 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * IosUpdateAllOf + */ +@JsonPropertyOrder({ + IosUpdateAllOf.JSON_PROPERTY_CERTIFICATE, + IosUpdateAllOf.JSON_PROPERTY_PASSWORD, + IosUpdateAllOf.JSON_PROPERTY_PRODUCTION, + IosUpdateAllOf.JSON_PROPERTY_AUTO_UPDATE_BADGE, + IosUpdateAllOf.JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION +}) + +public class IosUpdateAllOf { + public static final String JSON_PROPERTY_CERTIFICATE = "certificate"; + private JsonNullable certificate = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_PRODUCTION = "production"; + private Boolean production; + + public static final String JSON_PROPERTY_AUTO_UPDATE_BADGE = "autoUpdateBadge"; + private Boolean autoUpdateBadge; + + public static final String JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION = "canUserCreateConversation"; + private Boolean canUserCreateConversation; + + + public IosUpdateAllOf certificate(String certificate) { + this.certificate = JsonNullable.of(certificate); + + return this; + } + + /** + * The binary of your APN certificate base64 encoded. + * @return certificate + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_APN_certificate", value = "The binary of your APN certificate base64 encoded.") + @JsonIgnore + + public String getCertificate() { + return certificate.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CERTIFICATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getCertificate_JsonNullable() { + return certificate; + } + + @JsonProperty(JSON_PROPERTY_CERTIFICATE) + public void setCertificate_JsonNullable(JsonNullable certificate) { + this.certificate = certificate; + } + + public void setCertificate(String certificate) { + this.certificate = JsonNullable.of(certificate); + } + + + public IosUpdateAllOf password(String password) { + + this.password = password; + return this; + } + + /** + * The password for your APN certificate. + * @return password + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_APN_password", value = "The password for your APN certificate.") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public IosUpdateAllOf production(Boolean production) { + + this.production = production; + return this; + } + + /** + * The APN environment to connect to (Production, if true, or Sandbox). Defaults to value inferred from certificate if not specified. + * @return production + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The APN environment to connect to (Production, if true, or Sandbox). Defaults to value inferred from certificate if not specified.") + @JsonProperty(JSON_PROPERTY_PRODUCTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getProduction() { + return production; + } + + + public void setProduction(Boolean production) { + this.production = production; + } + + + public IosUpdateAllOf autoUpdateBadge(Boolean autoUpdateBadge) { + + this.autoUpdateBadge = autoUpdateBadge; + return this; + } + + /** + * Use the unread count of the conversation as the application badge. + * @return autoUpdateBadge + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Use the unread count of the conversation as the application badge.") + @JsonProperty(JSON_PROPERTY_AUTO_UPDATE_BADGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getAutoUpdateBadge() { + return autoUpdateBadge; + } + + + public void setAutoUpdateBadge(Boolean autoUpdateBadge) { + this.autoUpdateBadge = autoUpdateBadge; + } + + + public IosUpdateAllOf canUserCreateConversation(Boolean canUserCreateConversation) { + + this.canUserCreateConversation = canUserCreateConversation; + return this; + } + + /** + * Allows users to create more than one conversation on the iOS integration. + * @return canUserCreateConversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Allows users to create more than one conversation on the iOS integration.") + @JsonProperty(JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getCanUserCreateConversation() { + return canUserCreateConversation; + } + + + public void setCanUserCreateConversation(Boolean canUserCreateConversation) { + this.canUserCreateConversation = canUserCreateConversation; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IosUpdateAllOf iosUpdateAllOf = (IosUpdateAllOf) o; + return Objects.equals(this.certificate, iosUpdateAllOf.certificate) && + Objects.equals(this.password, iosUpdateAllOf.password) && + Objects.equals(this.production, iosUpdateAllOf.production) && + Objects.equals(this.autoUpdateBadge, iosUpdateAllOf.autoUpdateBadge) && + Objects.equals(this.canUserCreateConversation, iosUpdateAllOf.canUserCreateConversation); + } + + @Override + public int hashCode() { + return Objects.hash(certificate, password, production, autoUpdateBadge, canUserCreateConversation); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IosUpdateAllOf {\n"); + sb.append(" certificate: ").append(toIndentedString(certificate)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" production: ").append(toIndentedString(production)).append("\n"); + sb.append(" autoUpdateBadge: ").append(toIndentedString(autoUpdateBadge)).append("\n"); + sb.append(" canUserCreateConversation: ").append(toIndentedString(canUserCreateConversation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Item.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Item.java new file mode 100644 index 00000000..a16463e3 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Item.java @@ -0,0 +1,343 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ActionSubset; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Item + */ +@JsonPropertyOrder({ + Item.JSON_PROPERTY_TITLE, + Item.JSON_PROPERTY_DESCRIPTION, + Item.JSON_PROPERTY_MEDIA_URL, + Item.JSON_PROPERTY_MEDIA_TYPE, + Item.JSON_PROPERTY_SIZE, + Item.JSON_PROPERTY_ACTIONS, + Item.JSON_PROPERTY_METADATA +}) + +public class Item { + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_MEDIA_URL = "mediaUrl"; + private URI mediaUrl; + + public static final String JSON_PROPERTY_MEDIA_TYPE = "mediaType"; + private String mediaType; + + /** + * The size of the image. + */ + public enum SizeEnum { + COMPACT("compact"), + + LARGE("large"); + + private String value; + + SizeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SizeEnum fromValue(String value) { + for (SizeEnum b : SizeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_SIZE = "size"; + private SizeEnum size; + + public static final String JSON_PROPERTY_ACTIONS = "actions"; + private List actions = new ArrayList(); + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public Item title(String title) { + + this.title = title; + return this; + } + + /** + * The title of the item. + * @return title + **/ + @ApiModelProperty(required = true, value = "The title of the item.") + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTitle() { + return title; + } + + + public void setTitle(String title) { + this.title = title; + } + + + public Item description(String description) { + + this.description = description; + return this; + } + + /** + * The description of the item. + * @return description + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The description of the item.") + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public Item mediaUrl(URI mediaUrl) { + + this.mediaUrl = mediaUrl; + return this; + } + + /** + * The image url attached to the item. + * @return mediaUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The image url attached to the item.") + @JsonProperty(JSON_PROPERTY_MEDIA_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public URI getMediaUrl() { + return mediaUrl; + } + + + public void setMediaUrl(URI mediaUrl) { + this.mediaUrl = mediaUrl; + } + + + public Item mediaType(String mediaType) { + + this.mediaType = mediaType; + return this; + } + + /** + * The MIME type for any image attached in the mediaUrl. + * @return mediaType + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The MIME type for any image attached in the mediaUrl.") + @JsonProperty(JSON_PROPERTY_MEDIA_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getMediaType() { + return mediaType; + } + + + public void setMediaType(String mediaType) { + this.mediaType = mediaType; + } + + + public Item size(SizeEnum size) { + + this.size = size; + return this; + } + + /** + * The size of the image. + * @return size + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The size of the image.") + @JsonProperty(JSON_PROPERTY_SIZE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SizeEnum getSize() { + return size; + } + + + public void setSize(SizeEnum size) { + this.size = size; + } + + + public Item actions(List actions) { + + this.actions = actions; + return this; + } + + public Item addActionsItem(ActionSubset actionsItem) { + this.actions.add(actionsItem); + return this; + } + + /** + * An array of objects representing the actions associated with the item. + * @return actions + **/ + @ApiModelProperty(required = true, value = "An array of objects representing the actions associated with the item.") + @JsonProperty(JSON_PROPERTY_ACTIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getActions() { + return actions; + } + + + public void setActions(List actions) { + this.actions = actions; + } + + + public Item metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Item item = (Item) o; + return Objects.equals(this.title, item.title) && + Objects.equals(this.description, item.description) && + Objects.equals(this.mediaUrl, item.mediaUrl) && + Objects.equals(this.mediaType, item.mediaType) && + Objects.equals(this.size, item.size) && + Objects.equals(this.actions, item.actions) && + Objects.equals(this.metadata, item.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(title, description, mediaUrl, mediaType, size, actions, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Item {\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" mediaUrl: ").append(toIndentedString(mediaUrl)).append("\n"); + sb.append(" mediaType: ").append(toIndentedString(mediaType)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Line.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Line.java new file mode 100644 index 00000000..770ff8dc --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Line.java @@ -0,0 +1,347 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Android; +import com.zendesk.sunshine_conversations_client.model.Apple; +import com.zendesk.sunshine_conversations_client.model.Custom; +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.Ios; +import com.zendesk.sunshine_conversations_client.model.Line; +import com.zendesk.sunshine_conversations_client.model.LineAllOf; +import com.zendesk.sunshine_conversations_client.model.Mailgun; +import com.zendesk.sunshine_conversations_client.model.MessageBird; +import com.zendesk.sunshine_conversations_client.model.Messenger; +import com.zendesk.sunshine_conversations_client.model.Status; +import com.zendesk.sunshine_conversations_client.model.Telegram; +import com.zendesk.sunshine_conversations_client.model.Twilio; +import com.zendesk.sunshine_conversations_client.model.Twitter; +import com.zendesk.sunshine_conversations_client.model.Viber; +import com.zendesk.sunshine_conversations_client.model.Web; +import com.zendesk.sunshine_conversations_client.model.Whatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Line + */ +@JsonPropertyOrder({ + Line.JSON_PROPERTY_TYPE, + Line.JSON_PROPERTY_CHANNEL_ID, + Line.JSON_PROPERTY_CHANNEL_SECRET, + Line.JSON_PROPERTY_CHANNEL_ACCESS_TOKEN, + Line.JSON_PROPERTY_SERVICE_CODE, + Line.JSON_PROPERTY_SWITCHER_SECRET, + Line.JSON_PROPERTY_QR_CODE_URL, + Line.JSON_PROPERTY_LINE_ID +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Android.class, name = "android"), + @JsonSubTypes.Type(value = Apple.class, name = "apple"), + @JsonSubTypes.Type(value = Custom.class, name = "custom"), + @JsonSubTypes.Type(value = Ios.class, name = "ios"), + @JsonSubTypes.Type(value = Line.class, name = "line"), + @JsonSubTypes.Type(value = Mailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messagebird"), + @JsonSubTypes.Type(value = Messenger.class, name = "messenger"), + @JsonSubTypes.Type(value = Telegram.class, name = "telegram"), + @JsonSubTypes.Type(value = Twilio.class, name = "twilio"), + @JsonSubTypes.Type(value = Twitter.class, name = "twitter"), + @JsonSubTypes.Type(value = Viber.class, name = "viber"), + @JsonSubTypes.Type(value = Web.class, name = "web"), + @JsonSubTypes.Type(value = Whatsapp.class, name = "whatsapp"), +}) + +public class Line extends Integration { + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type = "line"; + + public static final String JSON_PROPERTY_CHANNEL_ID = "channelId"; + private String channelId; + + public static final String JSON_PROPERTY_CHANNEL_SECRET = "channelSecret"; + private String channelSecret; + + public static final String JSON_PROPERTY_CHANNEL_ACCESS_TOKEN = "channelAccessToken"; + private String channelAccessToken; + + public static final String JSON_PROPERTY_SERVICE_CODE = "serviceCode"; + private String serviceCode; + + public static final String JSON_PROPERTY_SWITCHER_SECRET = "switcherSecret"; + private String switcherSecret; + + public static final String JSON_PROPERTY_QR_CODE_URL = "qrCodeUrl"; + private String qrCodeUrl; + + public static final String JSON_PROPERTY_LINE_ID = "lineId"; + private String lineId; + + + public Line type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Line channelId(String channelId) { + + this.channelId = channelId; + return this; + } + + /** + * LINE Channel ID. + * @return channelId + **/ + @ApiModelProperty(example = "1286564967", required = true, value = "LINE Channel ID.") + @JsonProperty(JSON_PROPERTY_CHANNEL_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getChannelId() { + return channelId; + } + + + public void setChannelId(String channelId) { + this.channelId = channelId; + } + + + public Line channelSecret(String channelSecret) { + + this.channelSecret = channelSecret; + return this; + } + + /** + * LINE Channel Secret. + * @return channelSecret + **/ + @ApiModelProperty(example = "your_line_channel_secret", required = true, value = "LINE Channel Secret.") + @JsonProperty(JSON_PROPERTY_CHANNEL_SECRET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getChannelSecret() { + return channelSecret; + } + + + public void setChannelSecret(String channelSecret) { + this.channelSecret = channelSecret; + } + + + public Line channelAccessToken(String channelAccessToken) { + + this.channelAccessToken = channelAccessToken; + return this; + } + + /** + * LINE Channel Access Token. + * @return channelAccessToken + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_line_channel_token", value = "LINE Channel Access Token.") + @JsonProperty(JSON_PROPERTY_CHANNEL_ACCESS_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getChannelAccessToken() { + return channelAccessToken; + } + + + public void setChannelAccessToken(String channelAccessToken) { + this.channelAccessToken = channelAccessToken; + } + + + public Line serviceCode(String serviceCode) { + + this.serviceCode = serviceCode; + return this; + } + + /** + * LINE Service Code. + * @return serviceCode + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_line_service_code", value = "LINE Service Code.") + @JsonProperty(JSON_PROPERTY_SERVICE_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getServiceCode() { + return serviceCode; + } + + + public void setServiceCode(String serviceCode) { + this.serviceCode = serviceCode; + } + + + public Line switcherSecret(String switcherSecret) { + + this.switcherSecret = switcherSecret; + return this; + } + + /** + * LINE Switcher Secret. + * @return switcherSecret + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_line_switcher_secret", value = "LINE Switcher Secret.") + @JsonProperty(JSON_PROPERTY_SWITCHER_SECRET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSwitcherSecret() { + return switcherSecret; + } + + + public void setSwitcherSecret(String switcherSecret) { + this.switcherSecret = switcherSecret; + } + + + public Line qrCodeUrl(String qrCodeUrl) { + + this.qrCodeUrl = qrCodeUrl; + return this; + } + + /** + * URL provided by LINE in the [Developer Console](https://developers.line.biz/console/). + * @return qrCodeUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://qr-official.line.me/M/1O4fb8.png", value = "URL provided by LINE in the [Developer Console](https://developers.line.biz/console/).") + @JsonProperty(JSON_PROPERTY_QR_CODE_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getQrCodeUrl() { + return qrCodeUrl; + } + + + public void setQrCodeUrl(String qrCodeUrl) { + this.qrCodeUrl = qrCodeUrl; + } + + + /** + * LINE Basic ID. Is automatically set when qrCodeUrl is updated. + * @return lineId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "104fb8", value = "LINE Basic ID. Is automatically set when qrCodeUrl is updated.") + @JsonProperty(JSON_PROPERTY_LINE_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getLineId() { + return lineId; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Line line = (Line) o; + return Objects.equals(this.type, line.type) && + Objects.equals(this.channelId, line.channelId) && + Objects.equals(this.channelSecret, line.channelSecret) && + Objects.equals(this.channelAccessToken, line.channelAccessToken) && + Objects.equals(this.serviceCode, line.serviceCode) && + Objects.equals(this.switcherSecret, line.switcherSecret) && + Objects.equals(this.qrCodeUrl, line.qrCodeUrl) && + Objects.equals(this.lineId, line.lineId) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, channelId, channelSecret, channelAccessToken, serviceCode, switcherSecret, qrCodeUrl, lineId, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Line {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" channelId: ").append(toIndentedString(channelId)).append("\n"); + sb.append(" channelSecret: ").append(toIndentedString(channelSecret)).append("\n"); + sb.append(" channelAccessToken: ").append(toIndentedString(channelAccessToken)).append("\n"); + sb.append(" serviceCode: ").append(toIndentedString(serviceCode)).append("\n"); + sb.append(" switcherSecret: ").append(toIndentedString(switcherSecret)).append("\n"); + sb.append(" qrCodeUrl: ").append(toIndentedString(qrCodeUrl)).append("\n"); + sb.append(" lineId: ").append(toIndentedString(lineId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/LineAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/LineAllOf.java new file mode 100644 index 00000000..093e69e0 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/LineAllOf.java @@ -0,0 +1,309 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * For LINE, each of your customers will need to manually configure a webhook in their LINE configuration page that will point to Sunshine Conversations servers. You must instruct your customers how to configure this manually on their LINE bot page. Once you’ve acquired all the required information, call the Create Integration endpoint. Then, using the returned integration _id, your customer must set the Callback URL field in their LINE Business Center page. The URL should look like the following: `https://app.smooch.io:443/api/line/webhooks/{appId}/{integrationId}`. + */ +@ApiModel(description = "For LINE, each of your customers will need to manually configure a webhook in their LINE configuration page that will point to Sunshine Conversations servers. You must instruct your customers how to configure this manually on their LINE bot page. Once you’ve acquired all the required information, call the Create Integration endpoint. Then, using the returned integration _id, your customer must set the Callback URL field in their LINE Business Center page. The URL should look like the following: `https://app.smooch.io:443/api/line/webhooks/{appId}/{integrationId}`. ") +@JsonPropertyOrder({ + LineAllOf.JSON_PROPERTY_TYPE, + LineAllOf.JSON_PROPERTY_CHANNEL_ID, + LineAllOf.JSON_PROPERTY_CHANNEL_SECRET, + LineAllOf.JSON_PROPERTY_CHANNEL_ACCESS_TOKEN, + LineAllOf.JSON_PROPERTY_SERVICE_CODE, + LineAllOf.JSON_PROPERTY_SWITCHER_SECRET, + LineAllOf.JSON_PROPERTY_QR_CODE_URL, + LineAllOf.JSON_PROPERTY_LINE_ID +}) + +public class LineAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "line"; + + public static final String JSON_PROPERTY_CHANNEL_ID = "channelId"; + private String channelId; + + public static final String JSON_PROPERTY_CHANNEL_SECRET = "channelSecret"; + private String channelSecret; + + public static final String JSON_PROPERTY_CHANNEL_ACCESS_TOKEN = "channelAccessToken"; + private String channelAccessToken; + + public static final String JSON_PROPERTY_SERVICE_CODE = "serviceCode"; + private String serviceCode; + + public static final String JSON_PROPERTY_SWITCHER_SECRET = "switcherSecret"; + private String switcherSecret; + + public static final String JSON_PROPERTY_QR_CODE_URL = "qrCodeUrl"; + private String qrCodeUrl; + + public static final String JSON_PROPERTY_LINE_ID = "lineId"; + private String lineId; + + + public LineAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public LineAllOf channelId(String channelId) { + + this.channelId = channelId; + return this; + } + + /** + * LINE Channel ID. + * @return channelId + **/ + @ApiModelProperty(example = "1286564967", required = true, value = "LINE Channel ID.") + @JsonProperty(JSON_PROPERTY_CHANNEL_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getChannelId() { + return channelId; + } + + + public void setChannelId(String channelId) { + this.channelId = channelId; + } + + + public LineAllOf channelSecret(String channelSecret) { + + this.channelSecret = channelSecret; + return this; + } + + /** + * LINE Channel Secret. + * @return channelSecret + **/ + @ApiModelProperty(example = "your_line_channel_secret", required = true, value = "LINE Channel Secret.") + @JsonProperty(JSON_PROPERTY_CHANNEL_SECRET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getChannelSecret() { + return channelSecret; + } + + + public void setChannelSecret(String channelSecret) { + this.channelSecret = channelSecret; + } + + + public LineAllOf channelAccessToken(String channelAccessToken) { + + this.channelAccessToken = channelAccessToken; + return this; + } + + /** + * LINE Channel Access Token. + * @return channelAccessToken + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_line_channel_token", value = "LINE Channel Access Token.") + @JsonProperty(JSON_PROPERTY_CHANNEL_ACCESS_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getChannelAccessToken() { + return channelAccessToken; + } + + + public void setChannelAccessToken(String channelAccessToken) { + this.channelAccessToken = channelAccessToken; + } + + + public LineAllOf serviceCode(String serviceCode) { + + this.serviceCode = serviceCode; + return this; + } + + /** + * LINE Service Code. + * @return serviceCode + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_line_service_code", value = "LINE Service Code.") + @JsonProperty(JSON_PROPERTY_SERVICE_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getServiceCode() { + return serviceCode; + } + + + public void setServiceCode(String serviceCode) { + this.serviceCode = serviceCode; + } + + + public LineAllOf switcherSecret(String switcherSecret) { + + this.switcherSecret = switcherSecret; + return this; + } + + /** + * LINE Switcher Secret. + * @return switcherSecret + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_line_switcher_secret", value = "LINE Switcher Secret.") + @JsonProperty(JSON_PROPERTY_SWITCHER_SECRET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSwitcherSecret() { + return switcherSecret; + } + + + public void setSwitcherSecret(String switcherSecret) { + this.switcherSecret = switcherSecret; + } + + + public LineAllOf qrCodeUrl(String qrCodeUrl) { + + this.qrCodeUrl = qrCodeUrl; + return this; + } + + /** + * URL provided by LINE in the [Developer Console](https://developers.line.biz/console/). + * @return qrCodeUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://qr-official.line.me/M/1O4fb8.png", value = "URL provided by LINE in the [Developer Console](https://developers.line.biz/console/).") + @JsonProperty(JSON_PROPERTY_QR_CODE_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getQrCodeUrl() { + return qrCodeUrl; + } + + + public void setQrCodeUrl(String qrCodeUrl) { + this.qrCodeUrl = qrCodeUrl; + } + + + /** + * LINE Basic ID. Is automatically set when qrCodeUrl is updated. + * @return lineId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "104fb8", value = "LINE Basic ID. Is automatically set when qrCodeUrl is updated.") + @JsonProperty(JSON_PROPERTY_LINE_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getLineId() { + return lineId; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LineAllOf lineAllOf = (LineAllOf) o; + return Objects.equals(this.type, lineAllOf.type) && + Objects.equals(this.channelId, lineAllOf.channelId) && + Objects.equals(this.channelSecret, lineAllOf.channelSecret) && + Objects.equals(this.channelAccessToken, lineAllOf.channelAccessToken) && + Objects.equals(this.serviceCode, lineAllOf.serviceCode) && + Objects.equals(this.switcherSecret, lineAllOf.switcherSecret) && + Objects.equals(this.qrCodeUrl, lineAllOf.qrCodeUrl) && + Objects.equals(this.lineId, lineAllOf.lineId); + } + + @Override + public int hashCode() { + return Objects.hash(type, channelId, channelSecret, channelAccessToken, serviceCode, switcherSecret, qrCodeUrl, lineId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LineAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" channelId: ").append(toIndentedString(channelId)).append("\n"); + sb.append(" channelSecret: ").append(toIndentedString(channelSecret)).append("\n"); + sb.append(" channelAccessToken: ").append(toIndentedString(channelAccessToken)).append("\n"); + sb.append(" serviceCode: ").append(toIndentedString(serviceCode)).append("\n"); + sb.append(" switcherSecret: ").append(toIndentedString(switcherSecret)).append("\n"); + sb.append(" qrCodeUrl: ").append(toIndentedString(qrCodeUrl)).append("\n"); + sb.append(" lineId: ").append(toIndentedString(lineId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/LineUpdate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/LineUpdate.java new file mode 100644 index 00000000..4240b9c4 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/LineUpdate.java @@ -0,0 +1,79 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdateBase; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdate; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * LineUpdate + */ +@JsonPropertyOrder({ +}) + +public class LineUpdate extends IntegrationUpdateBase implements IntegrationUpdate { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LineUpdate {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Link.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Link.java new file mode 100644 index 00000000..d333e50b --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Link.java @@ -0,0 +1,274 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ExtraChannelOptions; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.zendesk.sunshine_conversations_client.model.Action; +import com.zendesk.sunshine_conversations_client.model.ActionSubset; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * A link action will open the provided URI when tapped. + */ +@ApiModel(description = "A link action will open the provided URI when tapped.") +@JsonPropertyOrder({ + Link.JSON_PROPERTY_TYPE, + Link.JSON_PROPERTY_URI, + Link.JSON_PROPERTY_TEXT, + Link.JSON_PROPERTY_DEFAULT, + Link.JSON_PROPERTY_METADATA, + Link.JSON_PROPERTY_EXTRA_CHANNEL_OPTIONS +}) + +public class Link implements Action, ActionSubset { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "link"; + + public static final String JSON_PROPERTY_URI = "uri"; + private URI uri; + + public static final String JSON_PROPERTY_TEXT = "text"; + private String text; + + public static final String JSON_PROPERTY_DEFAULT = "default"; + private Boolean _default; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_EXTRA_CHANNEL_OPTIONS = "extraChannelOptions"; + private ExtraChannelOptions extraChannelOptions; + + + public Link type(String type) { + + this.type = type; + return this; + } + + /** + * The type of action. + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of action.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Link uri(URI uri) { + + this.uri = uri; + return this; + } + + /** + * The action URI. This is the link that will be used in the clients when clicking the button. + * @return uri + **/ + @ApiModelProperty(required = true, value = "The action URI. This is the link that will be used in the clients when clicking the button.") + @JsonProperty(JSON_PROPERTY_URI) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public URI getUri() { + return uri; + } + + + public void setUri(URI uri) { + this.uri = uri; + } + + + public Link text(String text) { + + this.text = text; + return this; + } + + /** + * The button text. + * @return text + **/ + @ApiModelProperty(required = true, value = "The button text.") + @JsonProperty(JSON_PROPERTY_TEXT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public Link _default(Boolean _default) { + + this._default = _default; + return this; + } + + /** + * Boolean value indicating whether the action is the default action for a message item in Facebook Messenger. + * @return _default + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Boolean value indicating whether the action is the default action for a message item in Facebook Messenger.") + @JsonProperty(JSON_PROPERTY_DEFAULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getDefault() { + return _default; + } + + + public void setDefault(Boolean _default) { + this._default = _default; + } + + + public Link metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + public Link extraChannelOptions(ExtraChannelOptions extraChannelOptions) { + + this.extraChannelOptions = extraChannelOptions; + return this; + } + + /** + * Get extraChannelOptions + * @return extraChannelOptions + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_EXTRA_CHANNEL_OPTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ExtraChannelOptions getExtraChannelOptions() { + return extraChannelOptions; + } + + + public void setExtraChannelOptions(ExtraChannelOptions extraChannelOptions) { + this.extraChannelOptions = extraChannelOptions; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Link link = (Link) o; + return Objects.equals(this.type, link.type) && + Objects.equals(this.uri, link.uri) && + Objects.equals(this.text, link.text) && + Objects.equals(this._default, link._default) && + Objects.equals(this.metadata, link.metadata) && + Objects.equals(this.extraChannelOptions, link.extraChannelOptions); + } + + @Override + public int hashCode() { + return Objects.hash(type, uri, text, _default, metadata, extraChannelOptions); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Link {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" uri: ").append(toIndentedString(uri)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" _default: ").append(toIndentedString(_default)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" extraChannelOptions: ").append(toIndentedString(extraChannelOptions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Links.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Links.java new file mode 100644 index 00000000..5c1133fc --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Links.java @@ -0,0 +1,134 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Previous and next page links, if they exist. + */ +@ApiModel(description = "Previous and next page links, if they exist.") +@JsonPropertyOrder({ + Links.JSON_PROPERTY_PREV, + Links.JSON_PROPERTY_NEXT +}) + +public class Links { + public static final String JSON_PROPERTY_PREV = "prev"; + private String prev; + + public static final String JSON_PROPERTY_NEXT = "next"; + private String next; + + + public Links prev(String prev) { + + this.prev = prev; + return this; + } + + /** + * A link to the previous page. Not specified if there are no previous pages. + * @return prev + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://api.smooch.io/v2/apps?page[before]=fcafad804c39a39648004af9", value = "A link to the previous page. Not specified if there are no previous pages.") + @JsonProperty(JSON_PROPERTY_PREV) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPrev() { + return prev; + } + + + public void setPrev(String prev) { + this.prev = prev; + } + + + public Links next(String next) { + + this.next = next; + return this; + } + + /** + * A link to the next page. Not specified if there are no subsequent pages. + * @return next + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://api.smooch.io/v2/apps?page[after]=5ea868f862cdd24abf010b38", value = "A link to the next page. Not specified if there are no subsequent pages.") + @JsonProperty(JSON_PROPERTY_NEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getNext() { + return next; + } + + + public void setNext(String next) { + this.next = next; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Links links = (Links) o; + return Objects.equals(this.prev, links.prev) && + Objects.equals(this.next, links.next); + } + + @Override + public int hashCode() { + return Objects.hash(prev, next); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Links {\n"); + sb.append(" prev: ").append(toIndentedString(prev)).append("\n"); + sb.append(" next: ").append(toIndentedString(next)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ListMessage.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ListMessage.java new file mode 100644 index 00000000..d7b1ae01 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ListMessage.java @@ -0,0 +1,185 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ActionSubset; +import com.zendesk.sunshine_conversations_client.model.Item; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.zendesk.sunshine_conversations_client.model.Content; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.math.BigDecimal; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * List messages are a vertically scrollable set of items that may each contain text, an image, and message actions. Not all messaging channels fully support list messages. * Facebook Messenger and WeChat have native support. * For LINE and our Android, iOS and Web SDK, Sunshine Conversations converts list messages to carousel. * On WhatsApp, Telegram and Twitter, Sunshine Conversations converts list messages to multiple rich messages. * On all other platforms, Sunshine Conversations converts list messages to raw text. + */ +@ApiModel(description = "List messages are a vertically scrollable set of items that may each contain text, an image, and message actions. Not all messaging channels fully support list messages. * Facebook Messenger and WeChat have native support. * For LINE and our Android, iOS and Web SDK, Sunshine Conversations converts list messages to carousel. * On WhatsApp, Telegram and Twitter, Sunshine Conversations converts list messages to multiple rich messages. * On all other platforms, Sunshine Conversations converts list messages to raw text. ") +@JsonPropertyOrder({ + ListMessage.JSON_PROPERTY_TYPE, + ListMessage.JSON_PROPERTY_ITEMS, + ListMessage.JSON_PROPERTY_ACTIONS +}) + +public class ListMessage implements Content { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "list"; + + public static final String JSON_PROPERTY_ITEMS = "items"; + private List items = new ArrayList(); + + public static final String JSON_PROPERTY_ACTIONS = "actions"; + private List actions = null; + + + public ListMessage type(String type) { + + this.type = type; + return this; + } + + /** + * The type of message. + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of message.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ListMessage items(List items) { + + this.items = items; + return this; + } + + public ListMessage addItemsItem(Item itemsItem) { + this.items.add(itemsItem); + return this; + } + + /** + * An array of objects representing the items associated with the message. Only present in carousel and list type messages. + * @return items + **/ + @ApiModelProperty(required = true, value = "An array of objects representing the items associated with the message. Only present in carousel and list type messages.") + @JsonProperty(JSON_PROPERTY_ITEMS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getItems() { + return items; + } + + + public void setItems(List items) { + this.items = items; + } + + + public ListMessage actions(List actions) { + + this.actions = actions; + return this; + } + + public ListMessage addActionsItem(ActionSubset actionsItem) { + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actionsItem); + return this; + } + + /** + * An array of objects representing the actions associated with the message. The array length is limited by the third party channel. + * @return actions + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "An array of objects representing the actions associated with the message. The array length is limited by the third party channel.") + @JsonProperty(JSON_PROPERTY_ACTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getActions() { + return actions; + } + + + public void setActions(List actions) { + this.actions = actions; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListMessage listMessage = (ListMessage) o; + return Objects.equals(this.type, listMessage.type) && + Objects.equals(this.items, listMessage.items) && + Objects.equals(this.actions, listMessage.actions); + } + + @Override + public int hashCode() { + return Objects.hash(type, items, actions); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListMessage {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/LocationMessage.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/LocationMessage.java new file mode 100644 index 00000000..f77635c5 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/LocationMessage.java @@ -0,0 +1,195 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.LocationMessageCoordinates; +import com.zendesk.sunshine_conversations_client.model.LocationMessageLocation; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.Content; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.math.BigDecimal; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * A location type message includes the coordinates (latitude and longitude) of a location and an optional location object which can include the name and address of the location. Typically sent in response to a Location Request. + */ +@ApiModel(description = "A location type message includes the coordinates (latitude and longitude) of a location and an optional location object which can include the name and address of the location. Typically sent in response to a Location Request.") +@JsonPropertyOrder({ + LocationMessage.JSON_PROPERTY_TYPE, + LocationMessage.JSON_PROPERTY_TEXT, + LocationMessage.JSON_PROPERTY_COORDINATES, + LocationMessage.JSON_PROPERTY_LOCATION +}) + +public class LocationMessage implements Content { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "location"; + + public static final String JSON_PROPERTY_TEXT = "text"; + private String text; + + public static final String JSON_PROPERTY_COORDINATES = "coordinates"; + private LocationMessageCoordinates coordinates; + + public static final String JSON_PROPERTY_LOCATION = "location"; + private LocationMessageLocation location; + + + public LocationMessage type(String type) { + + this.type = type; + return this; + } + + /** + * The type of message. + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of message.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + /** + * The fallback text message used when location messages are not supported by the channel. + * @return text + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The fallback text message used when location messages are not supported by the channel.") + @JsonProperty(JSON_PROPERTY_TEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getText() { + return text; + } + + + + + public LocationMessage coordinates(LocationMessageCoordinates coordinates) { + + this.coordinates = coordinates; + return this; + } + + /** + * Get coordinates + * @return coordinates + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_COORDINATES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public LocationMessageCoordinates getCoordinates() { + return coordinates; + } + + + public void setCoordinates(LocationMessageCoordinates coordinates) { + this.coordinates = coordinates; + } + + + public LocationMessage location(LocationMessageLocation location) { + + this.location = location; + return this; + } + + /** + * Get location + * @return location + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LOCATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public LocationMessageLocation getLocation() { + return location; + } + + + public void setLocation(LocationMessageLocation location) { + this.location = location; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LocationMessage locationMessage = (LocationMessage) o; + return Objects.equals(this.type, locationMessage.type) && + Objects.equals(this.text, locationMessage.text) && + Objects.equals(this.coordinates, locationMessage.coordinates) && + Objects.equals(this.location, locationMessage.location); + } + + @Override + public int hashCode() { + return Objects.hash(type, text, coordinates, location); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LocationMessage {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" coordinates: ").append(toIndentedString(coordinates)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/LocationMessageCoordinates.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/LocationMessageCoordinates.java new file mode 100644 index 00000000..30b30782 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/LocationMessageCoordinates.java @@ -0,0 +1,135 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The coordinates of the location. + */ +@ApiModel(description = "The coordinates of the location.") +@JsonPropertyOrder({ + LocationMessageCoordinates.JSON_PROPERTY_LAT, + LocationMessageCoordinates.JSON_PROPERTY_LONG +}) + +public class LocationMessageCoordinates { + public static final String JSON_PROPERTY_LAT = "lat"; + private BigDecimal lat; + + public static final String JSON_PROPERTY_LONG = "long"; + private BigDecimal _long; + + + public LocationMessageCoordinates lat(BigDecimal lat) { + + this.lat = lat; + return this; + } + + /** + * Global latitude. + * @return lat + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Global latitude.") + @JsonProperty(JSON_PROPERTY_LAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getLat() { + return lat; + } + + + public void setLat(BigDecimal lat) { + this.lat = lat; + } + + + public LocationMessageCoordinates _long(BigDecimal _long) { + + this._long = _long; + return this; + } + + /** + * Global longitude. + * @return _long + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Global longitude.") + @JsonProperty(JSON_PROPERTY_LONG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getLong() { + return _long; + } + + + public void setLong(BigDecimal _long) { + this._long = _long; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LocationMessageCoordinates locationMessageCoordinates = (LocationMessageCoordinates) o; + return Objects.equals(this.lat, locationMessageCoordinates.lat) && + Objects.equals(this._long, locationMessageCoordinates._long); + } + + @Override + public int hashCode() { + return Objects.hash(lat, _long); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LocationMessageCoordinates {\n"); + sb.append(" lat: ").append(toIndentedString(lat)).append("\n"); + sb.append(" _long: ").append(toIndentedString(_long)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/LocationMessageLocation.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/LocationMessageLocation.java new file mode 100644 index 00000000..000ed0f9 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/LocationMessageLocation.java @@ -0,0 +1,134 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Information about the location. + */ +@ApiModel(description = "Information about the location.") +@JsonPropertyOrder({ + LocationMessageLocation.JSON_PROPERTY_ADDRESS, + LocationMessageLocation.JSON_PROPERTY_NAME +}) + +public class LocationMessageLocation { + public static final String JSON_PROPERTY_ADDRESS = "address"; + private String address; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + + public LocationMessageLocation address(String address) { + + this.address = address; + return this; + } + + /** + * A string representing the address of the location. + * @return address + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A string representing the address of the location.") + @JsonProperty(JSON_PROPERTY_ADDRESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAddress() { + return address; + } + + + public void setAddress(String address) { + this.address = address; + } + + + public LocationMessageLocation name(String name) { + + this.name = name; + return this; + } + + /** + * A string representing the name of the location. + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A string representing the name of the location.") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LocationMessageLocation locationMessageLocation = (LocationMessageLocation) o; + return Objects.equals(this.address, locationMessageLocation.address) && + Objects.equals(this.name, locationMessageLocation.name); + } + + @Override + public int hashCode() { + return Objects.hash(address, name); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LocationMessageLocation {\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/LocationRequest.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/LocationRequest.java new file mode 100644 index 00000000..82b91bde --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/LocationRequest.java @@ -0,0 +1,180 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.zendesk.sunshine_conversations_client.model.Action; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * A location request action will prompt the user to share their location. + */ +@ApiModel(description = "A location request action will prompt the user to share their location.") +@JsonPropertyOrder({ + LocationRequest.JSON_PROPERTY_TYPE, + LocationRequest.JSON_PROPERTY_TEXT, + LocationRequest.JSON_PROPERTY_METADATA +}) + +public class LocationRequest implements Action { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "locationRequest"; + + public static final String JSON_PROPERTY_TEXT = "text"; + private String text; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public LocationRequest type(String type) { + + this.type = type; + return this; + } + + /** + * The type of action. + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of action.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public LocationRequest text(String text) { + + this.text = text; + return this; + } + + /** + * The button text. + * @return text + **/ + @ApiModelProperty(required = true, value = "The button text.") + @JsonProperty(JSON_PROPERTY_TEXT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public LocationRequest metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LocationRequest locationRequest = (LocationRequest) o; + return Objects.equals(this.type, locationRequest.type) && + Objects.equals(this.text, locationRequest.text) && + Objects.equals(this.metadata, locationRequest.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(type, text, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LocationRequest {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Mailgun.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Mailgun.java new file mode 100644 index 00000000..2130680a --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Mailgun.java @@ -0,0 +1,306 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Android; +import com.zendesk.sunshine_conversations_client.model.Apple; +import com.zendesk.sunshine_conversations_client.model.Custom; +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.Ios; +import com.zendesk.sunshine_conversations_client.model.Line; +import com.zendesk.sunshine_conversations_client.model.Mailgun; +import com.zendesk.sunshine_conversations_client.model.MailgunAllOf; +import com.zendesk.sunshine_conversations_client.model.MessageBird; +import com.zendesk.sunshine_conversations_client.model.Messenger; +import com.zendesk.sunshine_conversations_client.model.Status; +import com.zendesk.sunshine_conversations_client.model.Telegram; +import com.zendesk.sunshine_conversations_client.model.Twilio; +import com.zendesk.sunshine_conversations_client.model.Twitter; +import com.zendesk.sunshine_conversations_client.model.Viber; +import com.zendesk.sunshine_conversations_client.model.Web; +import com.zendesk.sunshine_conversations_client.model.Whatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Mailgun + */ +@JsonPropertyOrder({ + Mailgun.JSON_PROPERTY_TYPE, + Mailgun.JSON_PROPERTY_API_KEY, + Mailgun.JSON_PROPERTY_DOMAIN, + Mailgun.JSON_PROPERTY_INCOMING_ADDRESS, + Mailgun.JSON_PROPERTY_HIDE_UNSUBSCRIBE_LINK, + Mailgun.JSON_PROPERTY_FROM_ADDRESS +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Android.class, name = "android"), + @JsonSubTypes.Type(value = Apple.class, name = "apple"), + @JsonSubTypes.Type(value = Custom.class, name = "custom"), + @JsonSubTypes.Type(value = Ios.class, name = "ios"), + @JsonSubTypes.Type(value = Line.class, name = "line"), + @JsonSubTypes.Type(value = Mailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messagebird"), + @JsonSubTypes.Type(value = Messenger.class, name = "messenger"), + @JsonSubTypes.Type(value = Telegram.class, name = "telegram"), + @JsonSubTypes.Type(value = Twilio.class, name = "twilio"), + @JsonSubTypes.Type(value = Twitter.class, name = "twitter"), + @JsonSubTypes.Type(value = Viber.class, name = "viber"), + @JsonSubTypes.Type(value = Web.class, name = "web"), + @JsonSubTypes.Type(value = Whatsapp.class, name = "whatsapp"), +}) + +public class Mailgun extends Integration { + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type = "mailgun"; + + public static final String JSON_PROPERTY_API_KEY = "apiKey"; + private String apiKey; + + public static final String JSON_PROPERTY_DOMAIN = "domain"; + private String domain; + + public static final String JSON_PROPERTY_INCOMING_ADDRESS = "incomingAddress"; + private String incomingAddress; + + public static final String JSON_PROPERTY_HIDE_UNSUBSCRIBE_LINK = "hideUnsubscribeLink"; + private Boolean hideUnsubscribeLink; + + public static final String JSON_PROPERTY_FROM_ADDRESS = "fromAddress"; + private JsonNullable fromAddress = JsonNullable.undefined(); + + + public Mailgun type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Mailgun apiKey(String apiKey) { + + this.apiKey = apiKey; + return this; + } + + /** + * The public API key of your Mailgun account. + * @return apiKey + **/ + @ApiModelProperty(example = "key-f265hj32f0sd897lqd2j5keb96784043", required = true, value = "The public API key of your Mailgun account.") + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getApiKey() { + return apiKey; + } + + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + + public Mailgun domain(String domain) { + + this.domain = domain; + return this; + } + + /** + * The domain used to relay email. This domain must be configured and verified in your Mailgun account. + * @return domain + **/ + @ApiModelProperty(example = "sandbox123.mailgun.org", required = true, value = "The domain used to relay email. This domain must be configured and verified in your Mailgun account.") + @JsonProperty(JSON_PROPERTY_DOMAIN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getDomain() { + return domain; + } + + + public void setDomain(String domain) { + this.domain = domain; + } + + + public Mailgun incomingAddress(String incomingAddress) { + + this.incomingAddress = incomingAddress; + return this; + } + + /** + * Sunshine Conversations will receive all emails sent to this address. It will also be used as the Reply-To address. + * @return incomingAddress + **/ + @ApiModelProperty(example = "mytestemail@sandbox123.mailgun.org", required = true, value = "Sunshine Conversations will receive all emails sent to this address. It will also be used as the Reply-To address.") + @JsonProperty(JSON_PROPERTY_INCOMING_ADDRESS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getIncomingAddress() { + return incomingAddress; + } + + + public void setIncomingAddress(String incomingAddress) { + this.incomingAddress = incomingAddress; + } + + + public Mailgun hideUnsubscribeLink(Boolean hideUnsubscribeLink) { + + this.hideUnsubscribeLink = hideUnsubscribeLink; + return this; + } + + /** + * A boolean value indicating whether the unsubscribe link should be omitted from outgoing emails. When enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. By default, the unsubscribe link will be included in all outgoing emails. + * @return hideUnsubscribeLink + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A boolean value indicating whether the unsubscribe link should be omitted from outgoing emails. When enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. By default, the unsubscribe link will be included in all outgoing emails.") + @JsonProperty(JSON_PROPERTY_HIDE_UNSUBSCRIBE_LINK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getHideUnsubscribeLink() { + return hideUnsubscribeLink; + } + + + public void setHideUnsubscribeLink(Boolean hideUnsubscribeLink) { + this.hideUnsubscribeLink = hideUnsubscribeLink; + } + + + public Mailgun fromAddress(String fromAddress) { + this.fromAddress = JsonNullable.of(fromAddress); + + return this; + } + + /** + * Email address to use as the From and Reply-To address if it must be different from incomingAddress. Only use this option if the address that you supply is configured to forward emails to the incomingAddress, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user’s email client. May be unset with null. + * @return fromAddress + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "test@sandbox123.mailgun.org", value = "Email address to use as the From and Reply-To address if it must be different from incomingAddress. Only use this option if the address that you supply is configured to forward emails to the incomingAddress, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user’s email client. May be unset with null.") + @JsonIgnore + + public String getFromAddress() { + return fromAddress.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_FROM_ADDRESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getFromAddress_JsonNullable() { + return fromAddress; + } + + @JsonProperty(JSON_PROPERTY_FROM_ADDRESS) + public void setFromAddress_JsonNullable(JsonNullable fromAddress) { + this.fromAddress = fromAddress; + } + + public void setFromAddress(String fromAddress) { + this.fromAddress = JsonNullable.of(fromAddress); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Mailgun mailgun = (Mailgun) o; + return Objects.equals(this.type, mailgun.type) && + Objects.equals(this.apiKey, mailgun.apiKey) && + Objects.equals(this.domain, mailgun.domain) && + Objects.equals(this.incomingAddress, mailgun.incomingAddress) && + Objects.equals(this.hideUnsubscribeLink, mailgun.hideUnsubscribeLink) && + Objects.equals(this.fromAddress, mailgun.fromAddress) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, apiKey, domain, incomingAddress, hideUnsubscribeLink, fromAddress, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Mailgun {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); + sb.append(" incomingAddress: ").append(toIndentedString(incomingAddress)).append("\n"); + sb.append(" hideUnsubscribeLink: ").append(toIndentedString(hideUnsubscribeLink)).append("\n"); + sb.append(" fromAddress: ").append(toIndentedString(fromAddress)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MailgunAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MailgunAllOf.java new file mode 100644 index 00000000..a883f61a --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MailgunAllOf.java @@ -0,0 +1,268 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * To configure a Mailgun integration, visit the API Keys tab in the settings page of the Mailgun dashboard and copy your active API key. Call the Create Integration endpoint with your API Key, a domain you have configured in Mailgun, and the incoming address you would like to use. Must have the same domain as the one specified in the domain parameter. + */ +@ApiModel(description = "To configure a Mailgun integration, visit the API Keys tab in the settings page of the Mailgun dashboard and copy your active API key. Call the Create Integration endpoint with your API Key, a domain you have configured in Mailgun, and the incoming address you would like to use. Must have the same domain as the one specified in the domain parameter. ") +@JsonPropertyOrder({ + MailgunAllOf.JSON_PROPERTY_TYPE, + MailgunAllOf.JSON_PROPERTY_API_KEY, + MailgunAllOf.JSON_PROPERTY_DOMAIN, + MailgunAllOf.JSON_PROPERTY_INCOMING_ADDRESS, + MailgunAllOf.JSON_PROPERTY_HIDE_UNSUBSCRIBE_LINK, + MailgunAllOf.JSON_PROPERTY_FROM_ADDRESS +}) + +public class MailgunAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "mailgun"; + + public static final String JSON_PROPERTY_API_KEY = "apiKey"; + private String apiKey; + + public static final String JSON_PROPERTY_DOMAIN = "domain"; + private String domain; + + public static final String JSON_PROPERTY_INCOMING_ADDRESS = "incomingAddress"; + private String incomingAddress; + + public static final String JSON_PROPERTY_HIDE_UNSUBSCRIBE_LINK = "hideUnsubscribeLink"; + private Boolean hideUnsubscribeLink; + + public static final String JSON_PROPERTY_FROM_ADDRESS = "fromAddress"; + private JsonNullable fromAddress = JsonNullable.undefined(); + + + public MailgunAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MailgunAllOf apiKey(String apiKey) { + + this.apiKey = apiKey; + return this; + } + + /** + * The public API key of your Mailgun account. + * @return apiKey + **/ + @ApiModelProperty(example = "key-f265hj32f0sd897lqd2j5keb96784043", required = true, value = "The public API key of your Mailgun account.") + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getApiKey() { + return apiKey; + } + + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + + public MailgunAllOf domain(String domain) { + + this.domain = domain; + return this; + } + + /** + * The domain used to relay email. This domain must be configured and verified in your Mailgun account. + * @return domain + **/ + @ApiModelProperty(example = "sandbox123.mailgun.org", required = true, value = "The domain used to relay email. This domain must be configured and verified in your Mailgun account.") + @JsonProperty(JSON_PROPERTY_DOMAIN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getDomain() { + return domain; + } + + + public void setDomain(String domain) { + this.domain = domain; + } + + + public MailgunAllOf incomingAddress(String incomingAddress) { + + this.incomingAddress = incomingAddress; + return this; + } + + /** + * Sunshine Conversations will receive all emails sent to this address. It will also be used as the Reply-To address. + * @return incomingAddress + **/ + @ApiModelProperty(example = "mytestemail@sandbox123.mailgun.org", required = true, value = "Sunshine Conversations will receive all emails sent to this address. It will also be used as the Reply-To address.") + @JsonProperty(JSON_PROPERTY_INCOMING_ADDRESS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getIncomingAddress() { + return incomingAddress; + } + + + public void setIncomingAddress(String incomingAddress) { + this.incomingAddress = incomingAddress; + } + + + public MailgunAllOf hideUnsubscribeLink(Boolean hideUnsubscribeLink) { + + this.hideUnsubscribeLink = hideUnsubscribeLink; + return this; + } + + /** + * A boolean value indicating whether the unsubscribe link should be omitted from outgoing emails. When enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. By default, the unsubscribe link will be included in all outgoing emails. + * @return hideUnsubscribeLink + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A boolean value indicating whether the unsubscribe link should be omitted from outgoing emails. When enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. By default, the unsubscribe link will be included in all outgoing emails.") + @JsonProperty(JSON_PROPERTY_HIDE_UNSUBSCRIBE_LINK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getHideUnsubscribeLink() { + return hideUnsubscribeLink; + } + + + public void setHideUnsubscribeLink(Boolean hideUnsubscribeLink) { + this.hideUnsubscribeLink = hideUnsubscribeLink; + } + + + public MailgunAllOf fromAddress(String fromAddress) { + this.fromAddress = JsonNullable.of(fromAddress); + + return this; + } + + /** + * Email address to use as the From and Reply-To address if it must be different from incomingAddress. Only use this option if the address that you supply is configured to forward emails to the incomingAddress, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user’s email client. May be unset with null. + * @return fromAddress + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "test@sandbox123.mailgun.org", value = "Email address to use as the From and Reply-To address if it must be different from incomingAddress. Only use this option if the address that you supply is configured to forward emails to the incomingAddress, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user’s email client. May be unset with null.") + @JsonIgnore + + public String getFromAddress() { + return fromAddress.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_FROM_ADDRESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getFromAddress_JsonNullable() { + return fromAddress; + } + + @JsonProperty(JSON_PROPERTY_FROM_ADDRESS) + public void setFromAddress_JsonNullable(JsonNullable fromAddress) { + this.fromAddress = fromAddress; + } + + public void setFromAddress(String fromAddress) { + this.fromAddress = JsonNullable.of(fromAddress); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MailgunAllOf mailgunAllOf = (MailgunAllOf) o; + return Objects.equals(this.type, mailgunAllOf.type) && + Objects.equals(this.apiKey, mailgunAllOf.apiKey) && + Objects.equals(this.domain, mailgunAllOf.domain) && + Objects.equals(this.incomingAddress, mailgunAllOf.incomingAddress) && + Objects.equals(this.hideUnsubscribeLink, mailgunAllOf.hideUnsubscribeLink) && + Objects.equals(this.fromAddress, mailgunAllOf.fromAddress); + } + + @Override + public int hashCode() { + return Objects.hash(type, apiKey, domain, incomingAddress, hideUnsubscribeLink, fromAddress); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MailgunAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); + sb.append(" incomingAddress: ").append(toIndentedString(incomingAddress)).append("\n"); + sb.append(" hideUnsubscribeLink: ").append(toIndentedString(hideUnsubscribeLink)).append("\n"); + sb.append(" fromAddress: ").append(toIndentedString(fromAddress)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MailgunUpdate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MailgunUpdate.java new file mode 100644 index 00000000..a1a813b6 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MailgunUpdate.java @@ -0,0 +1,192 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdateBase; +import com.zendesk.sunshine_conversations_client.model.MailgunUpdateAllOf; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdate; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MailgunUpdate + */ +@JsonPropertyOrder({ + MailgunUpdate.JSON_PROPERTY_DISPLAY_NAME, + MailgunUpdate.JSON_PROPERTY_HIDE_UNSUBSCRIBE_LINK, + MailgunUpdate.JSON_PROPERTY_FROM_ADDRESS +}) + +public class MailgunUpdate implements IntegrationUpdate { + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private JsonNullable displayName = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_HIDE_UNSUBSCRIBE_LINK = "hideUnsubscribeLink"; + private Boolean hideUnsubscribeLink; + + public static final String JSON_PROPERTY_FROM_ADDRESS = "fromAddress"; + private JsonNullable fromAddress = JsonNullable.undefined(); + + + public MailgunUpdate displayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + + return this; + } + + /** + * A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "My awesome integration", value = "A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`.") + @JsonIgnore + + public String getDisplayName() { + return displayName.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDisplayName_JsonNullable() { + return displayName; + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + public void setDisplayName_JsonNullable(JsonNullable displayName) { + this.displayName = displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + } + + + public MailgunUpdate hideUnsubscribeLink(Boolean hideUnsubscribeLink) { + + this.hideUnsubscribeLink = hideUnsubscribeLink; + return this; + } + + /** + * A boolean value indicating whether the unsubscribe link should be omitted from outgoing emails. When enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. By default, the unsubscribe link will be included in all outgoing emails. + * @return hideUnsubscribeLink + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A boolean value indicating whether the unsubscribe link should be omitted from outgoing emails. When enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. By default, the unsubscribe link will be included in all outgoing emails.") + @JsonProperty(JSON_PROPERTY_HIDE_UNSUBSCRIBE_LINK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getHideUnsubscribeLink() { + return hideUnsubscribeLink; + } + + + public void setHideUnsubscribeLink(Boolean hideUnsubscribeLink) { + this.hideUnsubscribeLink = hideUnsubscribeLink; + } + + + public MailgunUpdate fromAddress(String fromAddress) { + this.fromAddress = JsonNullable.of(fromAddress); + + return this; + } + + /** + * Email address to use as the From and Reply-To address if it must be different from incomingAddress. Only use this option if the address that you supply is configured to forward emails to the incomingAddress, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user’s email client. May be unset with null. + * @return fromAddress + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "test@sandbox123.mailgun.org", value = "Email address to use as the From and Reply-To address if it must be different from incomingAddress. Only use this option if the address that you supply is configured to forward emails to the incomingAddress, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user’s email client. May be unset with null.") + @JsonIgnore + + public String getFromAddress() { + return fromAddress.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_FROM_ADDRESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getFromAddress_JsonNullable() { + return fromAddress; + } + + @JsonProperty(JSON_PROPERTY_FROM_ADDRESS) + public void setFromAddress_JsonNullable(JsonNullable fromAddress) { + this.fromAddress = fromAddress; + } + + public void setFromAddress(String fromAddress) { + this.fromAddress = JsonNullable.of(fromAddress); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MailgunUpdate mailgunUpdate = (MailgunUpdate) o; + return Objects.equals(this.displayName, mailgunUpdate.displayName) && + Objects.equals(this.hideUnsubscribeLink, mailgunUpdate.hideUnsubscribeLink) && + Objects.equals(this.fromAddress, mailgunUpdate.fromAddress); + } + + @Override + public int hashCode() { + return Objects.hash(displayName, hideUnsubscribeLink, fromAddress); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MailgunUpdate {\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" hideUnsubscribeLink: ").append(toIndentedString(hideUnsubscribeLink)).append("\n"); + sb.append(" fromAddress: ").append(toIndentedString(fromAddress)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MailgunUpdateAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MailgunUpdateAllOf.java new file mode 100644 index 00000000..c63f73e7 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MailgunUpdateAllOf.java @@ -0,0 +1,146 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MailgunUpdateAllOf + */ +@JsonPropertyOrder({ + MailgunUpdateAllOf.JSON_PROPERTY_HIDE_UNSUBSCRIBE_LINK, + MailgunUpdateAllOf.JSON_PROPERTY_FROM_ADDRESS +}) + +public class MailgunUpdateAllOf { + public static final String JSON_PROPERTY_HIDE_UNSUBSCRIBE_LINK = "hideUnsubscribeLink"; + private Boolean hideUnsubscribeLink; + + public static final String JSON_PROPERTY_FROM_ADDRESS = "fromAddress"; + private JsonNullable fromAddress = JsonNullable.undefined(); + + + public MailgunUpdateAllOf hideUnsubscribeLink(Boolean hideUnsubscribeLink) { + + this.hideUnsubscribeLink = hideUnsubscribeLink; + return this; + } + + /** + * A boolean value indicating whether the unsubscribe link should be omitted from outgoing emails. When enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. By default, the unsubscribe link will be included in all outgoing emails. + * @return hideUnsubscribeLink + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A boolean value indicating whether the unsubscribe link should be omitted from outgoing emails. When enabled, it is expected that the business is providing the user a way to unsubscribe by some other means. By default, the unsubscribe link will be included in all outgoing emails.") + @JsonProperty(JSON_PROPERTY_HIDE_UNSUBSCRIBE_LINK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getHideUnsubscribeLink() { + return hideUnsubscribeLink; + } + + + public void setHideUnsubscribeLink(Boolean hideUnsubscribeLink) { + this.hideUnsubscribeLink = hideUnsubscribeLink; + } + + + public MailgunUpdateAllOf fromAddress(String fromAddress) { + this.fromAddress = JsonNullable.of(fromAddress); + + return this; + } + + /** + * Email address to use as the From and Reply-To address if it must be different from incomingAddress. Only use this option if the address that you supply is configured to forward emails to the incomingAddress, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user’s email client. May be unset with null. + * @return fromAddress + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "test@sandbox123.mailgun.org", value = "Email address to use as the From and Reply-To address if it must be different from incomingAddress. Only use this option if the address that you supply is configured to forward emails to the incomingAddress, otherwise user replies will be lost. You must also make sure that the domain is properly configured as a mail provider so as to not be flagged as spam by the user’s email client. May be unset with null.") + @JsonIgnore + + public String getFromAddress() { + return fromAddress.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_FROM_ADDRESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getFromAddress_JsonNullable() { + return fromAddress; + } + + @JsonProperty(JSON_PROPERTY_FROM_ADDRESS) + public void setFromAddress_JsonNullable(JsonNullable fromAddress) { + this.fromAddress = fromAddress; + } + + public void setFromAddress(String fromAddress) { + this.fromAddress = JsonNullable.of(fromAddress); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MailgunUpdateAllOf mailgunUpdateAllOf = (MailgunUpdateAllOf) o; + return Objects.equals(this.hideUnsubscribeLink, mailgunUpdateAllOf.hideUnsubscribeLink) && + Objects.equals(this.fromAddress, mailgunUpdateAllOf.fromAddress); + } + + @Override + public int hashCode() { + return Objects.hash(hideUnsubscribeLink, fromAddress); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MailgunUpdateAllOf {\n"); + sb.append(" hideUnsubscribeLink: ").append(toIndentedString(hideUnsubscribeLink)).append("\n"); + sb.append(" fromAddress: ").append(toIndentedString(fromAddress)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteria.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteria.java new file mode 100644 index 00000000..227630ae --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteria.java @@ -0,0 +1,48 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.MatchCriteriaMailgun; +import com.zendesk.sunshine_conversations_client.model.MatchCriteriaMessagebird; +import com.zendesk.sunshine_conversations_client.model.MatchCriteriaTwilio; +import com.zendesk.sunshine_conversations_client.model.MatchCriteriaWhatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = MatchCriteriaMailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MatchCriteriaMailgun.class, name = "matchCriteriaMailgun"), + @JsonSubTypes.Type(value = MatchCriteriaMessagebird.class, name = "matchCriteriaMessagebird"), + @JsonSubTypes.Type(value = MatchCriteriaTwilio.class, name = "matchCriteriaTwilio"), + @JsonSubTypes.Type(value = MatchCriteriaWhatsapp.class, name = "matchCriteriaWhatsapp"), + @JsonSubTypes.Type(value = MatchCriteriaMessagebird.class, name = "messagebird"), + @JsonSubTypes.Type(value = MatchCriteriaTwilio.class, name = "twilio"), + @JsonSubTypes.Type(value = MatchCriteriaWhatsapp.class, name = "whatsapp"), +}) + +public interface MatchCriteria { + public String getType(); +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaBase.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaBase.java new file mode 100644 index 00000000..677cc563 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaBase.java @@ -0,0 +1,163 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The set of criteria used to determine the user's identity on a third-party channel. + */ +@ApiModel(description = "The set of criteria used to determine the user's identity on a third-party channel.") +@JsonPropertyOrder({ + MatchCriteriaBase.JSON_PROPERTY_TYPE, + MatchCriteriaBase.JSON_PROPERTY_INTEGRATION_ID, + MatchCriteriaBase.JSON_PROPERTY_PRIMARY +}) + +public class MatchCriteriaBase { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integrationId"; + private String integrationId; + + public static final String JSON_PROPERTY_PRIMARY = "primary"; + private Boolean primary = true; + + + public MatchCriteriaBase type(String type) { + + this.type = type; + return this; + } + + /** + * The channel type. + * @return type + **/ + @ApiModelProperty(required = true, value = "The channel type.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MatchCriteriaBase integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * The ID of the integration to link. Must match the provided type. + * @return integrationId + **/ + @ApiModelProperty(example = "582dedf230e788746891281a", required = true, value = "The ID of the integration to link. Must match the provided type.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getIntegrationId() { + return integrationId; + } + + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + + public MatchCriteriaBase primary(Boolean primary) { + + this.primary = primary; + return this; + } + + /** + * Flag indicating whether the client will become the primary for the target conversation once linking is complete. + * @return primary + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Flag indicating whether the client will become the primary for the target conversation once linking is complete.") + @JsonProperty(JSON_PROPERTY_PRIMARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getPrimary() { + return primary; + } + + + public void setPrimary(Boolean primary) { + this.primary = primary; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MatchCriteriaBase matchCriteriaBase = (MatchCriteriaBase) o; + return Objects.equals(this.type, matchCriteriaBase.type) && + Objects.equals(this.integrationId, matchCriteriaBase.integrationId) && + Objects.equals(this.primary, matchCriteriaBase.primary); + } + + @Override + public int hashCode() { + return Objects.hash(type, integrationId, primary); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MatchCriteriaBase {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" primary: ").append(toIndentedString(primary)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaMailgun.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaMailgun.java new file mode 100644 index 00000000..b6187d3c --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaMailgun.java @@ -0,0 +1,228 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.MatchCriteriaBase; +import com.zendesk.sunshine_conversations_client.model.MatchCriteriaMailgunAllOf; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.MatchCriteria; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MatchCriteriaMailgun + */ +@JsonPropertyOrder({ + MatchCriteriaMailgun.JSON_PROPERTY_TYPE, + MatchCriteriaMailgun.JSON_PROPERTY_INTEGRATION_ID, + MatchCriteriaMailgun.JSON_PROPERTY_PRIMARY, + MatchCriteriaMailgun.JSON_PROPERTY_ADDRESS, + MatchCriteriaMailgun.JSON_PROPERTY_SUBJECT +}) + +public class MatchCriteriaMailgun implements MatchCriteria { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "mailgun"; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integrationId"; + private String integrationId; + + public static final String JSON_PROPERTY_PRIMARY = "primary"; + private Boolean primary = true; + + public static final String JSON_PROPERTY_ADDRESS = "address"; + private String address; + + public static final String JSON_PROPERTY_SUBJECT = "subject"; + private String subject = "New message from {appName}"; + + + public MatchCriteriaMailgun type(String type) { + + this.type = type; + return this; + } + + /** + * The channel type. + * @return type + **/ + @ApiModelProperty(required = true, value = "The channel type.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MatchCriteriaMailgun integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * The ID of the integration to link. Must match the provided type. + * @return integrationId + **/ + @ApiModelProperty(example = "582dedf230e788746891281a", required = true, value = "The ID of the integration to link. Must match the provided type.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getIntegrationId() { + return integrationId; + } + + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + + public MatchCriteriaMailgun primary(Boolean primary) { + + this.primary = primary; + return this; + } + + /** + * Flag indicating whether the client will become the primary for the target conversation once linking is complete. + * @return primary + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Flag indicating whether the client will become the primary for the target conversation once linking is complete.") + @JsonProperty(JSON_PROPERTY_PRIMARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getPrimary() { + return primary; + } + + + public void setPrimary(Boolean primary) { + this.primary = primary; + } + + + public MatchCriteriaMailgun address(String address) { + + this.address = address; + return this; + } + + /** + * The user’s email address. + * @return address + **/ + @ApiModelProperty(example = "steveb@channel5.com", required = true, value = "The user’s email address.") + @JsonProperty(JSON_PROPERTY_ADDRESS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAddress() { + return address; + } + + + public void setAddress(String address) { + this.address = address; + } + + + public MatchCriteriaMailgun subject(String subject) { + + this.subject = subject; + return this; + } + + /** + * May be specified to set the subject for the outgoing email. + * @return subject + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "May be specified to set the subject for the outgoing email.") + @JsonProperty(JSON_PROPERTY_SUBJECT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSubject() { + return subject; + } + + + public void setSubject(String subject) { + this.subject = subject; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MatchCriteriaMailgun matchCriteriaMailgun = (MatchCriteriaMailgun) o; + return Objects.equals(this.type, matchCriteriaMailgun.type) && + Objects.equals(this.integrationId, matchCriteriaMailgun.integrationId) && + Objects.equals(this.primary, matchCriteriaMailgun.primary) && + Objects.equals(this.address, matchCriteriaMailgun.address) && + Objects.equals(this.subject, matchCriteriaMailgun.subject); + } + + @Override + public int hashCode() { + return Objects.hash(type, integrationId, primary, address, subject); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MatchCriteriaMailgun {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" primary: ").append(toIndentedString(primary)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" subject: ").append(toIndentedString(subject)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaMailgunAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaMailgunAllOf.java new file mode 100644 index 00000000..a5c1bf04 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaMailgunAllOf.java @@ -0,0 +1,164 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The set of criteria used to determine the user's identity on a third-party channel. + */ +@ApiModel(description = "The set of criteria used to determine the user's identity on a third-party channel.") +@JsonPropertyOrder({ + MatchCriteriaMailgunAllOf.JSON_PROPERTY_TYPE, + MatchCriteriaMailgunAllOf.JSON_PROPERTY_ADDRESS, + MatchCriteriaMailgunAllOf.JSON_PROPERTY_SUBJECT +}) + +public class MatchCriteriaMailgunAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "mailgun"; + + public static final String JSON_PROPERTY_ADDRESS = "address"; + private String address; + + public static final String JSON_PROPERTY_SUBJECT = "subject"; + private String subject = "New message from {appName}"; + + + public MatchCriteriaMailgunAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The channel type. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The channel type.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MatchCriteriaMailgunAllOf address(String address) { + + this.address = address; + return this; + } + + /** + * The user’s email address. + * @return address + **/ + @ApiModelProperty(example = "steveb@channel5.com", required = true, value = "The user’s email address.") + @JsonProperty(JSON_PROPERTY_ADDRESS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAddress() { + return address; + } + + + public void setAddress(String address) { + this.address = address; + } + + + public MatchCriteriaMailgunAllOf subject(String subject) { + + this.subject = subject; + return this; + } + + /** + * May be specified to set the subject for the outgoing email. + * @return subject + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "May be specified to set the subject for the outgoing email.") + @JsonProperty(JSON_PROPERTY_SUBJECT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSubject() { + return subject; + } + + + public void setSubject(String subject) { + this.subject = subject; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MatchCriteriaMailgunAllOf matchCriteriaMailgunAllOf = (MatchCriteriaMailgunAllOf) o; + return Objects.equals(this.type, matchCriteriaMailgunAllOf.type) && + Objects.equals(this.address, matchCriteriaMailgunAllOf.address) && + Objects.equals(this.subject, matchCriteriaMailgunAllOf.subject); + } + + @Override + public int hashCode() { + return Objects.hash(type, address, subject); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MatchCriteriaMailgunAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" subject: ").append(toIndentedString(subject)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaMessagebird.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaMessagebird.java new file mode 100644 index 00000000..59dc4a4c --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaMessagebird.java @@ -0,0 +1,197 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.MatchCriteriaBase; +import com.zendesk.sunshine_conversations_client.model.MatchCriteriaMessagebirdAllOf; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.MatchCriteria; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MatchCriteriaMessagebird + */ +@JsonPropertyOrder({ + MatchCriteriaMessagebird.JSON_PROPERTY_TYPE, + MatchCriteriaMessagebird.JSON_PROPERTY_INTEGRATION_ID, + MatchCriteriaMessagebird.JSON_PROPERTY_PRIMARY, + MatchCriteriaMessagebird.JSON_PROPERTY_PHONE_NUMBER +}) + +public class MatchCriteriaMessagebird implements MatchCriteria { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "messagebird"; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integrationId"; + private String integrationId; + + public static final String JSON_PROPERTY_PRIMARY = "primary"; + private Boolean primary = true; + + public static final String JSON_PROPERTY_PHONE_NUMBER = "phoneNumber"; + private String phoneNumber; + + + public MatchCriteriaMessagebird type(String type) { + + this.type = type; + return this; + } + + /** + * The channel type. + * @return type + **/ + @ApiModelProperty(required = true, value = "The channel type.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MatchCriteriaMessagebird integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * The ID of the integration to link. Must match the provided type. + * @return integrationId + **/ + @ApiModelProperty(example = "582dedf230e788746891281a", required = true, value = "The ID of the integration to link. Must match the provided type.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getIntegrationId() { + return integrationId; + } + + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + + public MatchCriteriaMessagebird primary(Boolean primary) { + + this.primary = primary; + return this; + } + + /** + * Flag indicating whether the client will become the primary for the target conversation once linking is complete. + * @return primary + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Flag indicating whether the client will become the primary for the target conversation once linking is complete.") + @JsonProperty(JSON_PROPERTY_PRIMARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getPrimary() { + return primary; + } + + + public void setPrimary(Boolean primary) { + this.primary = primary; + } + + + public MatchCriteriaMessagebird phoneNumber(String phoneNumber) { + + this.phoneNumber = phoneNumber; + return this; + } + + /** + * The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. + * @return phoneNumber + **/ + @ApiModelProperty(example = "+15550001234", required = true, value = "The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. ") + @JsonProperty(JSON_PROPERTY_PHONE_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPhoneNumber() { + return phoneNumber; + } + + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MatchCriteriaMessagebird matchCriteriaMessagebird = (MatchCriteriaMessagebird) o; + return Objects.equals(this.type, matchCriteriaMessagebird.type) && + Objects.equals(this.integrationId, matchCriteriaMessagebird.integrationId) && + Objects.equals(this.primary, matchCriteriaMessagebird.primary) && + Objects.equals(this.phoneNumber, matchCriteriaMessagebird.phoneNumber); + } + + @Override + public int hashCode() { + return Objects.hash(type, integrationId, primary, phoneNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MatchCriteriaMessagebird {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" primary: ").append(toIndentedString(primary)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaMessagebirdAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaMessagebirdAllOf.java new file mode 100644 index 00000000..a71142b7 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaMessagebirdAllOf.java @@ -0,0 +1,133 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The set of criteria used to determine the user's identity on a third-party channel. + */ +@ApiModel(description = "The set of criteria used to determine the user's identity on a third-party channel.") +@JsonPropertyOrder({ + MatchCriteriaMessagebirdAllOf.JSON_PROPERTY_TYPE, + MatchCriteriaMessagebirdAllOf.JSON_PROPERTY_PHONE_NUMBER +}) + +public class MatchCriteriaMessagebirdAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "messagebird"; + + public static final String JSON_PROPERTY_PHONE_NUMBER = "phoneNumber"; + private String phoneNumber; + + + public MatchCriteriaMessagebirdAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The channel type. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The channel type.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MatchCriteriaMessagebirdAllOf phoneNumber(String phoneNumber) { + + this.phoneNumber = phoneNumber; + return this; + } + + /** + * The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. + * @return phoneNumber + **/ + @ApiModelProperty(example = "+15550001234", required = true, value = "The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. ") + @JsonProperty(JSON_PROPERTY_PHONE_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPhoneNumber() { + return phoneNumber; + } + + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MatchCriteriaMessagebirdAllOf matchCriteriaMessagebirdAllOf = (MatchCriteriaMessagebirdAllOf) o; + return Objects.equals(this.type, matchCriteriaMessagebirdAllOf.type) && + Objects.equals(this.phoneNumber, matchCriteriaMessagebirdAllOf.phoneNumber); + } + + @Override + public int hashCode() { + return Objects.hash(type, phoneNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MatchCriteriaMessagebirdAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaTwilio.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaTwilio.java new file mode 100644 index 00000000..c057f681 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaTwilio.java @@ -0,0 +1,197 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.MatchCriteriaBase; +import com.zendesk.sunshine_conversations_client.model.MatchCriteriaTwilioAllOf; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.MatchCriteria; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MatchCriteriaTwilio + */ +@JsonPropertyOrder({ + MatchCriteriaTwilio.JSON_PROPERTY_TYPE, + MatchCriteriaTwilio.JSON_PROPERTY_INTEGRATION_ID, + MatchCriteriaTwilio.JSON_PROPERTY_PRIMARY, + MatchCriteriaTwilio.JSON_PROPERTY_PHONE_NUMBER +}) + +public class MatchCriteriaTwilio implements MatchCriteria { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "twilio"; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integrationId"; + private String integrationId; + + public static final String JSON_PROPERTY_PRIMARY = "primary"; + private Boolean primary = true; + + public static final String JSON_PROPERTY_PHONE_NUMBER = "phoneNumber"; + private String phoneNumber; + + + public MatchCriteriaTwilio type(String type) { + + this.type = type; + return this; + } + + /** + * The channel type. + * @return type + **/ + @ApiModelProperty(required = true, value = "The channel type.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MatchCriteriaTwilio integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * The ID of the integration to link. Must match the provided type. + * @return integrationId + **/ + @ApiModelProperty(example = "582dedf230e788746891281a", required = true, value = "The ID of the integration to link. Must match the provided type.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getIntegrationId() { + return integrationId; + } + + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + + public MatchCriteriaTwilio primary(Boolean primary) { + + this.primary = primary; + return this; + } + + /** + * Flag indicating whether the client will become the primary for the target conversation once linking is complete. + * @return primary + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Flag indicating whether the client will become the primary for the target conversation once linking is complete.") + @JsonProperty(JSON_PROPERTY_PRIMARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getPrimary() { + return primary; + } + + + public void setPrimary(Boolean primary) { + this.primary = primary; + } + + + public MatchCriteriaTwilio phoneNumber(String phoneNumber) { + + this.phoneNumber = phoneNumber; + return this; + } + + /** + * The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. + * @return phoneNumber + **/ + @ApiModelProperty(example = "+15550001234", required = true, value = "The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. ") + @JsonProperty(JSON_PROPERTY_PHONE_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPhoneNumber() { + return phoneNumber; + } + + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MatchCriteriaTwilio matchCriteriaTwilio = (MatchCriteriaTwilio) o; + return Objects.equals(this.type, matchCriteriaTwilio.type) && + Objects.equals(this.integrationId, matchCriteriaTwilio.integrationId) && + Objects.equals(this.primary, matchCriteriaTwilio.primary) && + Objects.equals(this.phoneNumber, matchCriteriaTwilio.phoneNumber); + } + + @Override + public int hashCode() { + return Objects.hash(type, integrationId, primary, phoneNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MatchCriteriaTwilio {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" primary: ").append(toIndentedString(primary)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaTwilioAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaTwilioAllOf.java new file mode 100644 index 00000000..464db38d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaTwilioAllOf.java @@ -0,0 +1,133 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The set of criteria used to determine the user's identity on a third-party channel. + */ +@ApiModel(description = "The set of criteria used to determine the user's identity on a third-party channel.") +@JsonPropertyOrder({ + MatchCriteriaTwilioAllOf.JSON_PROPERTY_TYPE, + MatchCriteriaTwilioAllOf.JSON_PROPERTY_PHONE_NUMBER +}) + +public class MatchCriteriaTwilioAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "twilio"; + + public static final String JSON_PROPERTY_PHONE_NUMBER = "phoneNumber"; + private String phoneNumber; + + + public MatchCriteriaTwilioAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The channel type. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The channel type.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MatchCriteriaTwilioAllOf phoneNumber(String phoneNumber) { + + this.phoneNumber = phoneNumber; + return this; + } + + /** + * The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. + * @return phoneNumber + **/ + @ApiModelProperty(example = "+15550001234", required = true, value = "The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. ") + @JsonProperty(JSON_PROPERTY_PHONE_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPhoneNumber() { + return phoneNumber; + } + + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MatchCriteriaTwilioAllOf matchCriteriaTwilioAllOf = (MatchCriteriaTwilioAllOf) o; + return Objects.equals(this.type, matchCriteriaTwilioAllOf.type) && + Objects.equals(this.phoneNumber, matchCriteriaTwilioAllOf.phoneNumber); + } + + @Override + public int hashCode() { + return Objects.hash(type, phoneNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MatchCriteriaTwilioAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaWhatsapp.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaWhatsapp.java new file mode 100644 index 00000000..660fc64d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaWhatsapp.java @@ -0,0 +1,197 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.MatchCriteriaBase; +import com.zendesk.sunshine_conversations_client.model.MatchCriteriaWhatsappAllOf; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.MatchCriteria; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MatchCriteriaWhatsapp + */ +@JsonPropertyOrder({ + MatchCriteriaWhatsapp.JSON_PROPERTY_TYPE, + MatchCriteriaWhatsapp.JSON_PROPERTY_INTEGRATION_ID, + MatchCriteriaWhatsapp.JSON_PROPERTY_PRIMARY, + MatchCriteriaWhatsapp.JSON_PROPERTY_PHONE_NUMBER +}) + +public class MatchCriteriaWhatsapp implements MatchCriteria { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "whatsapp"; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integrationId"; + private String integrationId; + + public static final String JSON_PROPERTY_PRIMARY = "primary"; + private Boolean primary = true; + + public static final String JSON_PROPERTY_PHONE_NUMBER = "phoneNumber"; + private String phoneNumber; + + + public MatchCriteriaWhatsapp type(String type) { + + this.type = type; + return this; + } + + /** + * The channel type. + * @return type + **/ + @ApiModelProperty(required = true, value = "The channel type.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MatchCriteriaWhatsapp integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * The ID of the integration to link. Must match the provided type. + * @return integrationId + **/ + @ApiModelProperty(example = "582dedf230e788746891281a", required = true, value = "The ID of the integration to link. Must match the provided type.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getIntegrationId() { + return integrationId; + } + + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + + public MatchCriteriaWhatsapp primary(Boolean primary) { + + this.primary = primary; + return this; + } + + /** + * Flag indicating whether the client will become the primary for the target conversation once linking is complete. + * @return primary + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Flag indicating whether the client will become the primary for the target conversation once linking is complete.") + @JsonProperty(JSON_PROPERTY_PRIMARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getPrimary() { + return primary; + } + + + public void setPrimary(Boolean primary) { + this.primary = primary; + } + + + public MatchCriteriaWhatsapp phoneNumber(String phoneNumber) { + + this.phoneNumber = phoneNumber; + return this; + } + + /** + * The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. + * @return phoneNumber + **/ + @ApiModelProperty(example = "+15550001234", required = true, value = "The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. ") + @JsonProperty(JSON_PROPERTY_PHONE_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPhoneNumber() { + return phoneNumber; + } + + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MatchCriteriaWhatsapp matchCriteriaWhatsapp = (MatchCriteriaWhatsapp) o; + return Objects.equals(this.type, matchCriteriaWhatsapp.type) && + Objects.equals(this.integrationId, matchCriteriaWhatsapp.integrationId) && + Objects.equals(this.primary, matchCriteriaWhatsapp.primary) && + Objects.equals(this.phoneNumber, matchCriteriaWhatsapp.phoneNumber); + } + + @Override + public int hashCode() { + return Objects.hash(type, integrationId, primary, phoneNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MatchCriteriaWhatsapp {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" primary: ").append(toIndentedString(primary)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaWhatsappAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaWhatsappAllOf.java new file mode 100644 index 00000000..6185722f --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MatchCriteriaWhatsappAllOf.java @@ -0,0 +1,133 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The set of criteria used to determine the user's identity on a third-party channel. + */ +@ApiModel(description = "The set of criteria used to determine the user's identity on a third-party channel.") +@JsonPropertyOrder({ + MatchCriteriaWhatsappAllOf.JSON_PROPERTY_TYPE, + MatchCriteriaWhatsappAllOf.JSON_PROPERTY_PHONE_NUMBER +}) + +public class MatchCriteriaWhatsappAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "whatsapp"; + + public static final String JSON_PROPERTY_PHONE_NUMBER = "phoneNumber"; + private String phoneNumber; + + + public MatchCriteriaWhatsappAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The channel type. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The channel type.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MatchCriteriaWhatsappAllOf phoneNumber(String phoneNumber) { + + this.phoneNumber = phoneNumber; + return this; + } + + /** + * The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. + * @return phoneNumber + **/ + @ApiModelProperty(example = "+15550001234", required = true, value = "The user’s phone number. It must contain the + prefix and the country code. Examples of valid phone numbers: +1 212-555-2368, +12125552368, +1 212 555 2368. Examples of invalid phone numbers: 212 555 2368, 1 212 555 2368. ") + @JsonProperty(JSON_PROPERTY_PHONE_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPhoneNumber() { + return phoneNumber; + } + + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MatchCriteriaWhatsappAllOf matchCriteriaWhatsappAllOf = (MatchCriteriaWhatsappAllOf) o; + return Objects.equals(this.type, matchCriteriaWhatsappAllOf.type) && + Objects.equals(this.phoneNumber, matchCriteriaWhatsappAllOf.phoneNumber); + } + + @Override + public int hashCode() { + return Objects.hash(type, phoneNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MatchCriteriaWhatsappAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Message.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Message.java new file mode 100644 index 00000000..062b5cdc --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Message.java @@ -0,0 +1,356 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Author; +import com.zendesk.sunshine_conversations_client.model.Content; +import com.zendesk.sunshine_conversations_client.model.QuotedMessage; +import com.zendesk.sunshine_conversations_client.model.Source; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Message + */ +@JsonPropertyOrder({ + Message.JSON_PROPERTY_ID, + Message.JSON_PROPERTY_RECEIVED, + Message.JSON_PROPERTY_AUTHOR, + Message.JSON_PROPERTY_CONTENT, + Message.JSON_PROPERTY_SOURCE, + Message.JSON_PROPERTY_QUOTED_MESSAGE, + Message.JSON_PROPERTY_METADATA, + Message.JSON_PROPERTY_DELETED +}) + +public class Message { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_RECEIVED = "received"; + private String received; + + public static final String JSON_PROPERTY_AUTHOR = "author"; + private Author author; + + public static final String JSON_PROPERTY_CONTENT = "content"; + private Content content = null; + + public static final String JSON_PROPERTY_SOURCE = "source"; + private Source source; + + public static final String JSON_PROPERTY_QUOTED_MESSAGE = "quotedMessage"; + private JsonNullable quotedMessage = JsonNullable.of(null); + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.of(null); + + public static final String JSON_PROPERTY_DELETED = "deleted"; + private JsonNullable deleted = JsonNullable.undefined(); + + + public Message id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the message. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5e552ef595e5206375bb835d", value = "The unique ID of the message.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Message received(String received) { + + this.received = received; + return this; + } + + /** + * A datetime string with the format `YYYY-MM-DDThh:mm:ss.SSSZ` representing when Sunshine Conversations received the message. + * @return received + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2019-03-21T18:48:52.760Z", value = "A datetime string with the format `YYYY-MM-DDThh:mm:ss.SSSZ` representing when Sunshine Conversations received the message.") + @JsonProperty(JSON_PROPERTY_RECEIVED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getReceived() { + return received; + } + + + public void setReceived(String received) { + this.received = received; + } + + + public Message author(Author author) { + + this.author = author; + return this; + } + + /** + * Get author + * @return author + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_AUTHOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Author getAuthor() { + return author; + } + + + public void setAuthor(Author author) { + this.author = author; + } + + + public Message content(Content content) { + + this.content = content; + return this; + } + + /** + * The content of the message. + * @return content + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The content of the message.") + @JsonProperty(JSON_PROPERTY_CONTENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Content getContent() { + return content; + } + + + public void setContent(Content content) { + this.content = content; + } + + + public Message source(Source source) { + + this.source = source; + return this; + } + + /** + * Get source + * @return source + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Source getSource() { + return source; + } + + + public void setSource(Source source) { + this.source = source; + } + + + public Message quotedMessage(QuotedMessage quotedMessage) { + this.quotedMessage = JsonNullable.of(quotedMessage); + + return this; + } + + /** + * The quoted message is currently only available for WhatsApp and Web Messenger `formResponse` messages. + * @return quotedMessage + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The quoted message is currently only available for WhatsApp and Web Messenger `formResponse` messages.") + @JsonIgnore + + public QuotedMessage getQuotedMessage() { + return quotedMessage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_QUOTED_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getQuotedMessage_JsonNullable() { + return quotedMessage; + } + + @JsonProperty(JSON_PROPERTY_QUOTED_MESSAGE) + public void setQuotedMessage_JsonNullable(JsonNullable quotedMessage) { + this.quotedMessage = quotedMessage; + } + + public void setQuotedMessage(QuotedMessage quotedMessage) { + this.quotedMessage = JsonNullable.of(quotedMessage); + } + + + public Message metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Get metadata + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + public Message deleted(Boolean deleted) { + this.deleted = JsonNullable.of(deleted); + + return this; + } + + /** + * true if the message serves as a placeholder for one that has been deleted. + * @return deleted + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "true if the message serves as a placeholder for one that has been deleted.") + @JsonIgnore + + public Boolean getDeleted() { + return deleted.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DELETED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDeleted_JsonNullable() { + return deleted; + } + + @JsonProperty(JSON_PROPERTY_DELETED) + public void setDeleted_JsonNullable(JsonNullable deleted) { + this.deleted = deleted; + } + + public void setDeleted(Boolean deleted) { + this.deleted = JsonNullable.of(deleted); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Message message = (Message) o; + return Objects.equals(this.id, message.id) && + Objects.equals(this.received, message.received) && + Objects.equals(this.author, message.author) && + Objects.equals(this.content, message.content) && + Objects.equals(this.source, message.source) && + Objects.equals(this.quotedMessage, message.quotedMessage) && + Objects.equals(this.metadata, message.metadata) && + Objects.equals(this.deleted, message.deleted); + } + + @Override + public int hashCode() { + return Objects.hash(id, received, author, content, source, quotedMessage, metadata, deleted); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Message {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" received: ").append(toIndentedString(received)).append("\n"); + sb.append(" author: ").append(toIndentedString(author)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" quotedMessage: ").append(toIndentedString(quotedMessage)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" deleted: ").append(toIndentedString(deleted)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageBird.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageBird.java new file mode 100644 index 00000000..f95199bf --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageBird.java @@ -0,0 +1,253 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Android; +import com.zendesk.sunshine_conversations_client.model.Apple; +import com.zendesk.sunshine_conversations_client.model.Custom; +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.Ios; +import com.zendesk.sunshine_conversations_client.model.Line; +import com.zendesk.sunshine_conversations_client.model.Mailgun; +import com.zendesk.sunshine_conversations_client.model.MessageBird; +import com.zendesk.sunshine_conversations_client.model.MessageBirdAllOf; +import com.zendesk.sunshine_conversations_client.model.Messenger; +import com.zendesk.sunshine_conversations_client.model.Status; +import com.zendesk.sunshine_conversations_client.model.Telegram; +import com.zendesk.sunshine_conversations_client.model.Twilio; +import com.zendesk.sunshine_conversations_client.model.Twitter; +import com.zendesk.sunshine_conversations_client.model.Viber; +import com.zendesk.sunshine_conversations_client.model.Web; +import com.zendesk.sunshine_conversations_client.model.Whatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MessageBird + */ +@JsonPropertyOrder({ + MessageBird.JSON_PROPERTY_TYPE, + MessageBird.JSON_PROPERTY_ACCESS_KEY, + MessageBird.JSON_PROPERTY_SIGNING_KEY, + MessageBird.JSON_PROPERTY_ORIGINATOR, + MessageBird.JSON_PROPERTY_WEBHOOK_SECRET +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Android.class, name = "android"), + @JsonSubTypes.Type(value = Apple.class, name = "apple"), + @JsonSubTypes.Type(value = Custom.class, name = "custom"), + @JsonSubTypes.Type(value = Ios.class, name = "ios"), + @JsonSubTypes.Type(value = Line.class, name = "line"), + @JsonSubTypes.Type(value = Mailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messagebird"), + @JsonSubTypes.Type(value = Messenger.class, name = "messenger"), + @JsonSubTypes.Type(value = Telegram.class, name = "telegram"), + @JsonSubTypes.Type(value = Twilio.class, name = "twilio"), + @JsonSubTypes.Type(value = Twitter.class, name = "twitter"), + @JsonSubTypes.Type(value = Viber.class, name = "viber"), + @JsonSubTypes.Type(value = Web.class, name = "web"), + @JsonSubTypes.Type(value = Whatsapp.class, name = "whatsapp"), +}) + +public class MessageBird extends Integration { + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type = "messagebird"; + + public static final String JSON_PROPERTY_ACCESS_KEY = "accessKey"; + private String accessKey; + + public static final String JSON_PROPERTY_SIGNING_KEY = "signingKey"; + private String signingKey; + + public static final String JSON_PROPERTY_ORIGINATOR = "originator"; + private String originator; + + public static final String JSON_PROPERTY_WEBHOOK_SECRET = "webhookSecret"; + private String webhookSecret; + + + public MessageBird type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MessageBird accessKey(String accessKey) { + + this.accessKey = accessKey; + return this; + } + + /** + * The public API key of your MessageBird account. + * @return accessKey + **/ + @ApiModelProperty(example = "9V2iJmd93kFJ390L9495JCl11", required = true, value = "The public API key of your MessageBird account.") + @JsonProperty(JSON_PROPERTY_ACCESS_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAccessKey() { + return accessKey; + } + + + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + + public MessageBird signingKey(String signingKey) { + + this.signingKey = signingKey; + return this; + } + + /** + * The signing key of your MessageBird account. Used to validate the webhooks' origin. + * @return signingKey + **/ + @ApiModelProperty(example = "Uu6N09Lkdji3820DJIO89I39sl9dJ", required = true, value = "The signing key of your MessageBird account. Used to validate the webhooks' origin.") + @JsonProperty(JSON_PROPERTY_SIGNING_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getSigningKey() { + return signingKey; + } + + + public void setSigningKey(String signingKey) { + this.signingKey = signingKey; + } + + + public MessageBird originator(String originator) { + + this.originator = originator; + return this; + } + + /** + * Sunshine Conversations will receive all messages sent to this phone number. + * @return originator + **/ + @ApiModelProperty(example = "12262121021", required = true, value = "Sunshine Conversations will receive all messages sent to this phone number.") + @JsonProperty(JSON_PROPERTY_ORIGINATOR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getOriginator() { + return originator; + } + + + public void setOriginator(String originator) { + this.originator = originator; + } + + + /** + * The secret that is used to configure webhooks in MessageBird. + * @return webhookSecret + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "72ade38394d1da51566cede33bd1e67e", value = "The secret that is used to configure webhooks in MessageBird.") + @JsonProperty(JSON_PROPERTY_WEBHOOK_SECRET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getWebhookSecret() { + return webhookSecret; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageBird messageBird = (MessageBird) o; + return Objects.equals(this.type, messageBird.type) && + Objects.equals(this.accessKey, messageBird.accessKey) && + Objects.equals(this.signingKey, messageBird.signingKey) && + Objects.equals(this.originator, messageBird.originator) && + Objects.equals(this.webhookSecret, messageBird.webhookSecret) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, accessKey, signingKey, originator, webhookSecret, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageBird {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" accessKey: ").append(toIndentedString(accessKey)).append("\n"); + sb.append(" signingKey: ").append(toIndentedString(signingKey)).append("\n"); + sb.append(" originator: ").append(toIndentedString(originator)).append("\n"); + sb.append(" webhookSecret: ").append(toIndentedString(webhookSecret)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageBirdAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageBirdAllOf.java new file mode 100644 index 00000000..e4053da3 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageBirdAllOf.java @@ -0,0 +1,215 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * To configure a MessageBird integration, acquire the accessKey, the signingKey and the MessageBird number you would like to use, then call the Create Integration endpoint. The response will include the integration’s _id and webhookSecret, which must be used to configure the webhook in MessageBird. In the Flow Builder for the MessageBird number you’ve used to integrate, add a new step with the following settings: * Create a new Call HTTP endpoint with SMS flow. * Select your desired SMS number for Incoming SMS. * Click on Forward to URL and set its method to POST. * Then, using the integration _id and webhookSecret returned from the create integration call, enter the following into the URL field: `https://app.smooch.io/api/messagebird/webhooks/{appId}/{integrationId}/{webhookSecret}` * Select application/json for the Set Content-Type header field. * Save and publish your changes. + */ +@ApiModel(description = "To configure a MessageBird integration, acquire the accessKey, the signingKey and the MessageBird number you would like to use, then call the Create Integration endpoint. The response will include the integration’s _id and webhookSecret, which must be used to configure the webhook in MessageBird. In the Flow Builder for the MessageBird number you’ve used to integrate, add a new step with the following settings: * Create a new Call HTTP endpoint with SMS flow. * Select your desired SMS number for Incoming SMS. * Click on Forward to URL and set its method to POST. * Then, using the integration _id and webhookSecret returned from the create integration call, enter the following into the URL field: `https://app.smooch.io/api/messagebird/webhooks/{appId}/{integrationId}/{webhookSecret}` * Select application/json for the Set Content-Type header field. * Save and publish your changes. ") +@JsonPropertyOrder({ + MessageBirdAllOf.JSON_PROPERTY_TYPE, + MessageBirdAllOf.JSON_PROPERTY_ACCESS_KEY, + MessageBirdAllOf.JSON_PROPERTY_SIGNING_KEY, + MessageBirdAllOf.JSON_PROPERTY_ORIGINATOR, + MessageBirdAllOf.JSON_PROPERTY_WEBHOOK_SECRET +}) + +public class MessageBirdAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "messagebird"; + + public static final String JSON_PROPERTY_ACCESS_KEY = "accessKey"; + private String accessKey; + + public static final String JSON_PROPERTY_SIGNING_KEY = "signingKey"; + private String signingKey; + + public static final String JSON_PROPERTY_ORIGINATOR = "originator"; + private String originator; + + public static final String JSON_PROPERTY_WEBHOOK_SECRET = "webhookSecret"; + private String webhookSecret; + + + public MessageBirdAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MessageBirdAllOf accessKey(String accessKey) { + + this.accessKey = accessKey; + return this; + } + + /** + * The public API key of your MessageBird account. + * @return accessKey + **/ + @ApiModelProperty(example = "9V2iJmd93kFJ390L9495JCl11", required = true, value = "The public API key of your MessageBird account.") + @JsonProperty(JSON_PROPERTY_ACCESS_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAccessKey() { + return accessKey; + } + + + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + + public MessageBirdAllOf signingKey(String signingKey) { + + this.signingKey = signingKey; + return this; + } + + /** + * The signing key of your MessageBird account. Used to validate the webhooks' origin. + * @return signingKey + **/ + @ApiModelProperty(example = "Uu6N09Lkdji3820DJIO89I39sl9dJ", required = true, value = "The signing key of your MessageBird account. Used to validate the webhooks' origin.") + @JsonProperty(JSON_PROPERTY_SIGNING_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getSigningKey() { + return signingKey; + } + + + public void setSigningKey(String signingKey) { + this.signingKey = signingKey; + } + + + public MessageBirdAllOf originator(String originator) { + + this.originator = originator; + return this; + } + + /** + * Sunshine Conversations will receive all messages sent to this phone number. + * @return originator + **/ + @ApiModelProperty(example = "12262121021", required = true, value = "Sunshine Conversations will receive all messages sent to this phone number.") + @JsonProperty(JSON_PROPERTY_ORIGINATOR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getOriginator() { + return originator; + } + + + public void setOriginator(String originator) { + this.originator = originator; + } + + + /** + * The secret that is used to configure webhooks in MessageBird. + * @return webhookSecret + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "72ade38394d1da51566cede33bd1e67e", value = "The secret that is used to configure webhooks in MessageBird.") + @JsonProperty(JSON_PROPERTY_WEBHOOK_SECRET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getWebhookSecret() { + return webhookSecret; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageBirdAllOf messageBirdAllOf = (MessageBirdAllOf) o; + return Objects.equals(this.type, messageBirdAllOf.type) && + Objects.equals(this.accessKey, messageBirdAllOf.accessKey) && + Objects.equals(this.signingKey, messageBirdAllOf.signingKey) && + Objects.equals(this.originator, messageBirdAllOf.originator) && + Objects.equals(this.webhookSecret, messageBirdAllOf.webhookSecret); + } + + @Override + public int hashCode() { + return Objects.hash(type, accessKey, signingKey, originator, webhookSecret); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageBirdAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" accessKey: ").append(toIndentedString(accessKey)).append("\n"); + sb.append(" signingKey: ").append(toIndentedString(signingKey)).append("\n"); + sb.append(" originator: ").append(toIndentedString(originator)).append("\n"); + sb.append(" webhookSecret: ").append(toIndentedString(webhookSecret)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageBirdUpdate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageBirdUpdate.java new file mode 100644 index 00000000..c00cbe24 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageBirdUpdate.java @@ -0,0 +1,79 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdateBase; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdate; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MessageBirdUpdate + */ +@JsonPropertyOrder({ +}) + +public class MessageBirdUpdate extends IntegrationUpdateBase implements IntegrationUpdate { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageBirdUpdate {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageListResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageListResponse.java new file mode 100644 index 00000000..f4302df3 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageListResponse.java @@ -0,0 +1,177 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Links; +import com.zendesk.sunshine_conversations_client.model.Message; +import com.zendesk.sunshine_conversations_client.model.Meta; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MessageListResponse + */ +@JsonPropertyOrder({ + MessageListResponse.JSON_PROPERTY_MESSAGES, + MessageListResponse.JSON_PROPERTY_META, + MessageListResponse.JSON_PROPERTY_LINKS +}) + +public class MessageListResponse { + public static final String JSON_PROPERTY_MESSAGES = "messages"; + private List messages = null; + + public static final String JSON_PROPERTY_META = "meta"; + private Meta meta; + + public static final String JSON_PROPERTY_LINKS = "links"; + private Links links; + + + public MessageListResponse messages(List messages) { + + this.messages = messages; + return this; + } + + public MessageListResponse addMessagesItem(Message messagesItem) { + if (this.messages == null) { + this.messages = new ArrayList(); + } + this.messages.add(messagesItem); + return this; + } + + /** + * List of returned messages. + * @return messages + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of returned messages.") + @JsonProperty(JSON_PROPERTY_MESSAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getMessages() { + return messages; + } + + + public void setMessages(List messages) { + this.messages = messages; + } + + + public MessageListResponse meta(Meta meta) { + + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Meta getMeta() { + return meta; + } + + + public void setMeta(Meta meta) { + this.meta = meta; + } + + + public MessageListResponse links(Links links) { + + this.links = links; + return this; + } + + /** + * Get links + * @return links + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LINKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Links getLinks() { + return links; + } + + + public void setLinks(Links links) { + this.links = links; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageListResponse messageListResponse = (MessageListResponse) o; + return Objects.equals(this.messages, messageListResponse.messages) && + Objects.equals(this.meta, messageListResponse.meta) && + Objects.equals(this.links, messageListResponse.links); + } + + @Override + public int hashCode() { + return Objects.hash(messages, meta, links); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageListResponse {\n"); + sb.append(" messages: ").append(toIndentedString(messages)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverride.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverride.java new file mode 100644 index 00000000..22fa0b12 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverride.java @@ -0,0 +1,201 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.MessageOverrideApple; +import com.zendesk.sunshine_conversations_client.model.MessageOverrideLine; +import com.zendesk.sunshine_conversations_client.model.MessageOverrideMessenger; +import com.zendesk.sunshine_conversations_client.model.MessageOverridePayload; +import com.zendesk.sunshine_conversations_client.model.MessageOverrideWhatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * A raw payload containing a message that is sent directly to a channel. Messages for [Apple Business Chat](https://docs.smooch.io/guide/apple-business-chat/#passthrough-api), [Line](https://docs.smooch.io/guide/line/#passthrough-api), [Messenger](https://docs.smooch.io/guide/facebook-messenger/#passthrough-api), [Whatsapp](https://docs.smooch.io/guide/whatsapp/#passthrough-api) channels are supported. + */ +@ApiModel(description = "A raw payload containing a message that is sent directly to a channel. Messages for [Apple Business Chat](https://docs.smooch.io/guide/apple-business-chat/#passthrough-api), [Line](https://docs.smooch.io/guide/line/#passthrough-api), [Messenger](https://docs.smooch.io/guide/facebook-messenger/#passthrough-api), [Whatsapp](https://docs.smooch.io/guide/whatsapp/#passthrough-api) channels are supported.") +@JsonPropertyOrder({ + MessageOverride.JSON_PROPERTY_APPLE, + MessageOverride.JSON_PROPERTY_LINE, + MessageOverride.JSON_PROPERTY_MESSENGER, + MessageOverride.JSON_PROPERTY_WHATSAPP +}) + +public class MessageOverride { + public static final String JSON_PROPERTY_APPLE = "apple"; + private MessageOverridePayload apple; + + public static final String JSON_PROPERTY_LINE = "line"; + private MessageOverridePayload line; + + public static final String JSON_PROPERTY_MESSENGER = "messenger"; + private MessageOverridePayload messenger; + + public static final String JSON_PROPERTY_WHATSAPP = "whatsapp"; + private MessageOverridePayload whatsapp; + + + public MessageOverride apple(MessageOverridePayload apple) { + + this.apple = apple; + return this; + } + + /** + * Get apple + * @return apple + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_APPLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public MessageOverridePayload getApple() { + return apple; + } + + + public void setApple(MessageOverridePayload apple) { + this.apple = apple; + } + + + public MessageOverride line(MessageOverridePayload line) { + + this.line = line; + return this; + } + + /** + * Get line + * @return line + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LINE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public MessageOverridePayload getLine() { + return line; + } + + + public void setLine(MessageOverridePayload line) { + this.line = line; + } + + + public MessageOverride messenger(MessageOverridePayload messenger) { + + this.messenger = messenger; + return this; + } + + /** + * Get messenger + * @return messenger + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MESSENGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public MessageOverridePayload getMessenger() { + return messenger; + } + + + public void setMessenger(MessageOverridePayload messenger) { + this.messenger = messenger; + } + + + public MessageOverride whatsapp(MessageOverridePayload whatsapp) { + + this.whatsapp = whatsapp; + return this; + } + + /** + * Get whatsapp + * @return whatsapp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_WHATSAPP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public MessageOverridePayload getWhatsapp() { + return whatsapp; + } + + + public void setWhatsapp(MessageOverridePayload whatsapp) { + this.whatsapp = whatsapp; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageOverride messageOverride = (MessageOverride) o; + return Objects.equals(this.apple, messageOverride.apple) && + Objects.equals(this.line, messageOverride.line) && + Objects.equals(this.messenger, messageOverride.messenger) && + Objects.equals(this.whatsapp, messageOverride.whatsapp); + } + + @Override + public int hashCode() { + return Objects.hash(apple, line, messenger, whatsapp); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageOverride {\n"); + sb.append(" apple: ").append(toIndentedString(apple)).append("\n"); + sb.append(" line: ").append(toIndentedString(line)).append("\n"); + sb.append(" messenger: ").append(toIndentedString(messenger)).append("\n"); + sb.append(" whatsapp: ").append(toIndentedString(whatsapp)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverrideApple.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverrideApple.java new file mode 100644 index 00000000..fa5426b0 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverrideApple.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.MessageOverridePayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MessageOverrideApple + */ +@JsonPropertyOrder({ + MessageOverrideApple.JSON_PROPERTY_APPLE +}) + +public class MessageOverrideApple { + public static final String JSON_PROPERTY_APPLE = "apple"; + private MessageOverridePayload apple; + + + public MessageOverrideApple apple(MessageOverridePayload apple) { + + this.apple = apple; + return this; + } + + /** + * Get apple + * @return apple + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_APPLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public MessageOverridePayload getApple() { + return apple; + } + + + public void setApple(MessageOverridePayload apple) { + this.apple = apple; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageOverrideApple messageOverrideApple = (MessageOverrideApple) o; + return Objects.equals(this.apple, messageOverrideApple.apple); + } + + @Override + public int hashCode() { + return Objects.hash(apple); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageOverrideApple {\n"); + sb.append(" apple: ").append(toIndentedString(apple)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverrideLine.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverrideLine.java new file mode 100644 index 00000000..7e0df39c --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverrideLine.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.MessageOverridePayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MessageOverrideLine + */ +@JsonPropertyOrder({ + MessageOverrideLine.JSON_PROPERTY_LINE +}) + +public class MessageOverrideLine { + public static final String JSON_PROPERTY_LINE = "line"; + private MessageOverridePayload line; + + + public MessageOverrideLine line(MessageOverridePayload line) { + + this.line = line; + return this; + } + + /** + * Get line + * @return line + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LINE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public MessageOverridePayload getLine() { + return line; + } + + + public void setLine(MessageOverridePayload line) { + this.line = line; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageOverrideLine messageOverrideLine = (MessageOverrideLine) o; + return Objects.equals(this.line, messageOverrideLine.line); + } + + @Override + public int hashCode() { + return Objects.hash(line); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageOverrideLine {\n"); + sb.append(" line: ").append(toIndentedString(line)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverrideMessenger.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverrideMessenger.java new file mode 100644 index 00000000..d6bb9c83 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverrideMessenger.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.MessageOverridePayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MessageOverrideMessenger + */ +@JsonPropertyOrder({ + MessageOverrideMessenger.JSON_PROPERTY_MESSENGER +}) + +public class MessageOverrideMessenger { + public static final String JSON_PROPERTY_MESSENGER = "messenger"; + private MessageOverridePayload messenger; + + + public MessageOverrideMessenger messenger(MessageOverridePayload messenger) { + + this.messenger = messenger; + return this; + } + + /** + * Get messenger + * @return messenger + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MESSENGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public MessageOverridePayload getMessenger() { + return messenger; + } + + + public void setMessenger(MessageOverridePayload messenger) { + this.messenger = messenger; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageOverrideMessenger messageOverrideMessenger = (MessageOverrideMessenger) o; + return Objects.equals(this.messenger, messageOverrideMessenger.messenger); + } + + @Override + public int hashCode() { + return Objects.hash(messenger); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageOverrideMessenger {\n"); + sb.append(" messenger: ").append(toIndentedString(messenger)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverridePayload.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverridePayload.java new file mode 100644 index 00000000..b56bd290 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverridePayload.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The exact payload to send to the channel. + */ +@ApiModel(description = "The exact payload to send to the channel.") +@JsonPropertyOrder({ + MessageOverridePayload.JSON_PROPERTY_PAYLOAD +}) + +public class MessageOverridePayload { + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private Object payload; + + + public MessageOverridePayload payload(Object payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getPayload() { + return payload; + } + + + public void setPayload(Object payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageOverridePayload messageOverridePayload = (MessageOverridePayload) o; + return Objects.equals(this.payload, messageOverridePayload.payload); + } + + @Override + public int hashCode() { + return Objects.hash(payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageOverridePayload {\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverrideWhatsapp.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverrideWhatsapp.java new file mode 100644 index 00000000..1da8ef27 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessageOverrideWhatsapp.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.MessageOverridePayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MessageOverrideWhatsapp + */ +@JsonPropertyOrder({ + MessageOverrideWhatsapp.JSON_PROPERTY_WHATSAPP +}) + +public class MessageOverrideWhatsapp { + public static final String JSON_PROPERTY_WHATSAPP = "whatsapp"; + private MessageOverridePayload whatsapp; + + + public MessageOverrideWhatsapp whatsapp(MessageOverridePayload whatsapp) { + + this.whatsapp = whatsapp; + return this; + } + + /** + * Get whatsapp + * @return whatsapp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_WHATSAPP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public MessageOverridePayload getWhatsapp() { + return whatsapp; + } + + + public void setWhatsapp(MessageOverridePayload whatsapp) { + this.whatsapp = whatsapp; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageOverrideWhatsapp messageOverrideWhatsapp = (MessageOverrideWhatsapp) o; + return Objects.equals(this.whatsapp, messageOverrideWhatsapp.whatsapp); + } + + @Override + public int hashCode() { + return Objects.hash(whatsapp); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageOverrideWhatsapp {\n"); + sb.append(" whatsapp: ").append(toIndentedString(whatsapp)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MessagePost.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessagePost.java new file mode 100644 index 00000000..f5472a7d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessagePost.java @@ -0,0 +1,241 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Author; +import com.zendesk.sunshine_conversations_client.model.Content; +import com.zendesk.sunshine_conversations_client.model.Destination; +import com.zendesk.sunshine_conversations_client.model.MessageOverride; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MessagePost + */ +@JsonPropertyOrder({ + MessagePost.JSON_PROPERTY_AUTHOR, + MessagePost.JSON_PROPERTY_CONTENT, + MessagePost.JSON_PROPERTY_DESTINATION, + MessagePost.JSON_PROPERTY_METADATA, + MessagePost.JSON_PROPERTY_OVERRIDE +}) + +public class MessagePost { + public static final String JSON_PROPERTY_AUTHOR = "author"; + private Author author = null; + + public static final String JSON_PROPERTY_CONTENT = "content"; + private Content content = null; + + public static final String JSON_PROPERTY_DESTINATION = "destination"; + private Destination destination = null; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_OVERRIDE = "override"; + private MessageOverride override = null; + + + public MessagePost author(Author author) { + + this.author = author; + return this; + } + + /** + * The author of the message. + * @return author + **/ + @ApiModelProperty(required = true, value = "The author of the message.") + @JsonProperty(JSON_PROPERTY_AUTHOR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Author getAuthor() { + return author; + } + + + public void setAuthor(Author author) { + this.author = author; + } + + + public MessagePost content(Content content) { + + this.content = content; + return this; + } + + /** + * The content of the message. + * @return content + **/ + @ApiModelProperty(required = true, value = "The content of the message.") + @JsonProperty(JSON_PROPERTY_CONTENT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Content getContent() { + return content; + } + + + public void setContent(Content content) { + this.content = content; + } + + + public MessagePost destination(Destination destination) { + + this.destination = destination; + return this; + } + + /** + * Get destination + * @return destination + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DESTINATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Destination getDestination() { + return destination; + } + + + public void setDestination(Destination destination) { + this.destination = destination; + } + + + public MessagePost metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + public MessagePost override(MessageOverride override) { + + this.override = override; + return this; + } + + /** + * Get override + * @return override + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OVERRIDE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public MessageOverride getOverride() { + return override; + } + + + public void setOverride(MessageOverride override) { + this.override = override; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessagePost messagePost = (MessagePost) o; + return Objects.equals(this.author, messagePost.author) && + Objects.equals(this.content, messagePost.content) && + Objects.equals(this.destination, messagePost.destination) && + Objects.equals(this.metadata, messagePost.metadata) && + Objects.equals(this.override, messagePost.override); + } + + @Override + public int hashCode() { + return Objects.hash(author, content, destination, metadata, override); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessagePost {\n"); + sb.append(" author: ").append(toIndentedString(author)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" override: ").append(toIndentedString(override)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MessagePostResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessagePostResponse.java new file mode 100644 index 00000000..fba16e8b --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessagePostResponse.java @@ -0,0 +1,114 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Message; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The created messages. A single request may produce multiple messages when the shorthand syntax is used to send a template message with leading text. + */ +@ApiModel(description = "The created messages. A single request may produce multiple messages when the shorthand syntax is used to send a template message with leading text.") +@JsonPropertyOrder({ + MessagePostResponse.JSON_PROPERTY_MESSAGES +}) + +public class MessagePostResponse { + public static final String JSON_PROPERTY_MESSAGES = "messages"; + private List messages = null; + + + public MessagePostResponse messages(List messages) { + + this.messages = messages; + return this; + } + + public MessagePostResponse addMessagesItem(Message messagesItem) { + if (this.messages == null) { + this.messages = new ArrayList(); + } + this.messages.add(messagesItem); + return this; + } + + /** + * Get messages + * @return messages + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MESSAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getMessages() { + return messages; + } + + + public void setMessages(List messages) { + this.messages = messages; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessagePostResponse messagePostResponse = (MessagePostResponse) o; + return Objects.equals(this.messages, messagePostResponse.messages); + } + + @Override + public int hashCode() { + return Objects.hash(messages); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessagePostResponse {\n"); + sb.append(" messages: ").append(toIndentedString(messages)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Messenger.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Messenger.java new file mode 100644 index 00000000..88d73624 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Messenger.java @@ -0,0 +1,231 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Android; +import com.zendesk.sunshine_conversations_client.model.Apple; +import com.zendesk.sunshine_conversations_client.model.Custom; +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.Ios; +import com.zendesk.sunshine_conversations_client.model.Line; +import com.zendesk.sunshine_conversations_client.model.Mailgun; +import com.zendesk.sunshine_conversations_client.model.MessageBird; +import com.zendesk.sunshine_conversations_client.model.Messenger; +import com.zendesk.sunshine_conversations_client.model.MessengerAllOf; +import com.zendesk.sunshine_conversations_client.model.Status; +import com.zendesk.sunshine_conversations_client.model.Telegram; +import com.zendesk.sunshine_conversations_client.model.Twilio; +import com.zendesk.sunshine_conversations_client.model.Twitter; +import com.zendesk.sunshine_conversations_client.model.Viber; +import com.zendesk.sunshine_conversations_client.model.Web; +import com.zendesk.sunshine_conversations_client.model.Whatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Messenger + */ +@JsonPropertyOrder({ + Messenger.JSON_PROPERTY_TYPE, + Messenger.JSON_PROPERTY_PAGE_ACCESS_TOKEN, + Messenger.JSON_PROPERTY_APP_ID, + Messenger.JSON_PROPERTY_APP_SECRET +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Android.class, name = "android"), + @JsonSubTypes.Type(value = Apple.class, name = "apple"), + @JsonSubTypes.Type(value = Custom.class, name = "custom"), + @JsonSubTypes.Type(value = Ios.class, name = "ios"), + @JsonSubTypes.Type(value = Line.class, name = "line"), + @JsonSubTypes.Type(value = Mailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messagebird"), + @JsonSubTypes.Type(value = Messenger.class, name = "messenger"), + @JsonSubTypes.Type(value = Telegram.class, name = "telegram"), + @JsonSubTypes.Type(value = Twilio.class, name = "twilio"), + @JsonSubTypes.Type(value = Twitter.class, name = "twitter"), + @JsonSubTypes.Type(value = Viber.class, name = "viber"), + @JsonSubTypes.Type(value = Web.class, name = "web"), + @JsonSubTypes.Type(value = Whatsapp.class, name = "whatsapp"), +}) + +public class Messenger extends Integration { + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type = "messenger"; + + public static final String JSON_PROPERTY_PAGE_ACCESS_TOKEN = "pageAccessToken"; + private String pageAccessToken; + + public static final String JSON_PROPERTY_APP_ID = "appId"; + private String appId; + + public static final String JSON_PROPERTY_APP_SECRET = "appSecret"; + private String appSecret; + + + public Messenger type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Messenger pageAccessToken(String pageAccessToken) { + + this.pageAccessToken = pageAccessToken; + return this; + } + + /** + * A Facebook Page Access Token. + * @return pageAccessToken + **/ + @ApiModelProperty(example = "your_access_token", required = true, value = "A Facebook Page Access Token.") + @JsonProperty(JSON_PROPERTY_PAGE_ACCESS_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPageAccessToken() { + return pageAccessToken; + } + + + public void setPageAccessToken(String pageAccessToken) { + this.pageAccessToken = pageAccessToken; + } + + + public Messenger appId(String appId) { + + this.appId = appId; + return this; + } + + /** + * A Facebook App ID. + * @return appId + **/ + @ApiModelProperty(example = "your_facebook_app_id", required = true, value = "A Facebook App ID.") + @JsonProperty(JSON_PROPERTY_APP_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAppId() { + return appId; + } + + + public void setAppId(String appId) { + this.appId = appId; + } + + + public Messenger appSecret(String appSecret) { + + this.appSecret = appSecret; + return this; + } + + /** + * A Facebook App Secret. + * @return appSecret + **/ + @ApiModelProperty(example = "your_facebook_app_secret", required = true, value = "A Facebook App Secret.") + @JsonProperty(JSON_PROPERTY_APP_SECRET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAppSecret() { + return appSecret; + } + + + public void setAppSecret(String appSecret) { + this.appSecret = appSecret; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Messenger messenger = (Messenger) o; + return Objects.equals(this.type, messenger.type) && + Objects.equals(this.pageAccessToken, messenger.pageAccessToken) && + Objects.equals(this.appId, messenger.appId) && + Objects.equals(this.appSecret, messenger.appSecret) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, pageAccessToken, appId, appSecret, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Messenger {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" pageAccessToken: ").append(toIndentedString(pageAccessToken)).append("\n"); + sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" appSecret: ").append(toIndentedString(appSecret)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MessengerAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessengerAllOf.java new file mode 100644 index 00000000..90c34d92 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessengerAllOf.java @@ -0,0 +1,193 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Facebook Messenger Setup steps: Take note of your Facebook app ID and secret (apps can be created at developer.facebook.com); The Facebook app must have been submitted to Facebook for approval with the “manage_pages” (to receive messages through webhook) and “pages_messaging” (to send messages) permissions. In order to integrate a Facebook Messenger app you must acquire a Page Access Token from your user. Once you have acquired a page access token from your user, call the Create Integration endpoint with your app secret and ID and the user’s page access token. + */ +@ApiModel(description = "Facebook Messenger Setup steps: Take note of your Facebook app ID and secret (apps can be created at developer.facebook.com); The Facebook app must have been submitted to Facebook for approval with the “manage_pages” (to receive messages through webhook) and “pages_messaging” (to send messages) permissions. In order to integrate a Facebook Messenger app you must acquire a Page Access Token from your user. Once you have acquired a page access token from your user, call the Create Integration endpoint with your app secret and ID and the user’s page access token. ") +@JsonPropertyOrder({ + MessengerAllOf.JSON_PROPERTY_TYPE, + MessengerAllOf.JSON_PROPERTY_PAGE_ACCESS_TOKEN, + MessengerAllOf.JSON_PROPERTY_APP_ID, + MessengerAllOf.JSON_PROPERTY_APP_SECRET +}) + +public class MessengerAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "messenger"; + + public static final String JSON_PROPERTY_PAGE_ACCESS_TOKEN = "pageAccessToken"; + private String pageAccessToken; + + public static final String JSON_PROPERTY_APP_ID = "appId"; + private String appId; + + public static final String JSON_PROPERTY_APP_SECRET = "appSecret"; + private String appSecret; + + + public MessengerAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MessengerAllOf pageAccessToken(String pageAccessToken) { + + this.pageAccessToken = pageAccessToken; + return this; + } + + /** + * A Facebook Page Access Token. + * @return pageAccessToken + **/ + @ApiModelProperty(example = "your_access_token", required = true, value = "A Facebook Page Access Token.") + @JsonProperty(JSON_PROPERTY_PAGE_ACCESS_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPageAccessToken() { + return pageAccessToken; + } + + + public void setPageAccessToken(String pageAccessToken) { + this.pageAccessToken = pageAccessToken; + } + + + public MessengerAllOf appId(String appId) { + + this.appId = appId; + return this; + } + + /** + * A Facebook App ID. + * @return appId + **/ + @ApiModelProperty(example = "your_facebook_app_id", required = true, value = "A Facebook App ID.") + @JsonProperty(JSON_PROPERTY_APP_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAppId() { + return appId; + } + + + public void setAppId(String appId) { + this.appId = appId; + } + + + public MessengerAllOf appSecret(String appSecret) { + + this.appSecret = appSecret; + return this; + } + + /** + * A Facebook App Secret. + * @return appSecret + **/ + @ApiModelProperty(example = "your_facebook_app_secret", required = true, value = "A Facebook App Secret.") + @JsonProperty(JSON_PROPERTY_APP_SECRET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAppSecret() { + return appSecret; + } + + + public void setAppSecret(String appSecret) { + this.appSecret = appSecret; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessengerAllOf messengerAllOf = (MessengerAllOf) o; + return Objects.equals(this.type, messengerAllOf.type) && + Objects.equals(this.pageAccessToken, messengerAllOf.pageAccessToken) && + Objects.equals(this.appId, messengerAllOf.appId) && + Objects.equals(this.appSecret, messengerAllOf.appSecret); + } + + @Override + public int hashCode() { + return Objects.hash(type, pageAccessToken, appId, appSecret); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessengerAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" pageAccessToken: ").append(toIndentedString(pageAccessToken)).append("\n"); + sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" appSecret: ").append(toIndentedString(appSecret)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MessengerUpdate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessengerUpdate.java new file mode 100644 index 00000000..5f0aac70 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessengerUpdate.java @@ -0,0 +1,151 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdateBase; +import com.zendesk.sunshine_conversations_client.model.MessengerUpdateAllOf; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdate; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MessengerUpdate + */ +@JsonPropertyOrder({ + MessengerUpdate.JSON_PROPERTY_DISPLAY_NAME, + MessengerUpdate.JSON_PROPERTY_PAGE_ACCESS_TOKEN +}) + +public class MessengerUpdate implements IntegrationUpdate { + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private JsonNullable displayName = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_PAGE_ACCESS_TOKEN = "pageAccessToken"; + private String pageAccessToken; + + + public MessengerUpdate displayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + + return this; + } + + /** + * A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "My awesome integration", value = "A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`.") + @JsonIgnore + + public String getDisplayName() { + return displayName.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDisplayName_JsonNullable() { + return displayName; + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + public void setDisplayName_JsonNullable(JsonNullable displayName) { + this.displayName = displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + } + + + public MessengerUpdate pageAccessToken(String pageAccessToken) { + + this.pageAccessToken = pageAccessToken; + return this; + } + + /** + * A Facebook Page Access Token. + * @return pageAccessToken + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_access_token", value = "A Facebook Page Access Token.") + @JsonProperty(JSON_PROPERTY_PAGE_ACCESS_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPageAccessToken() { + return pageAccessToken; + } + + + public void setPageAccessToken(String pageAccessToken) { + this.pageAccessToken = pageAccessToken; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessengerUpdate messengerUpdate = (MessengerUpdate) o; + return Objects.equals(this.displayName, messengerUpdate.displayName) && + Objects.equals(this.pageAccessToken, messengerUpdate.pageAccessToken); + } + + @Override + public int hashCode() { + return Objects.hash(displayName, pageAccessToken); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessengerUpdate {\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" pageAccessToken: ").append(toIndentedString(pageAccessToken)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/MessengerUpdateAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessengerUpdateAllOf.java new file mode 100644 index 00000000..133f4ced --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/MessengerUpdateAllOf.java @@ -0,0 +1,102 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * MessengerUpdateAllOf + */ +@JsonPropertyOrder({ + MessengerUpdateAllOf.JSON_PROPERTY_PAGE_ACCESS_TOKEN +}) + +public class MessengerUpdateAllOf { + public static final String JSON_PROPERTY_PAGE_ACCESS_TOKEN = "pageAccessToken"; + private String pageAccessToken; + + + public MessengerUpdateAllOf pageAccessToken(String pageAccessToken) { + + this.pageAccessToken = pageAccessToken; + return this; + } + + /** + * A Facebook Page Access Token. + * @return pageAccessToken + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_access_token", value = "A Facebook Page Access Token.") + @JsonProperty(JSON_PROPERTY_PAGE_ACCESS_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPageAccessToken() { + return pageAccessToken; + } + + + public void setPageAccessToken(String pageAccessToken) { + this.pageAccessToken = pageAccessToken; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessengerUpdateAllOf messengerUpdateAllOf = (MessengerUpdateAllOf) o; + return Objects.equals(this.pageAccessToken, messengerUpdateAllOf.pageAccessToken); + } + + @Override + public int hashCode() { + return Objects.hash(pageAccessToken); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessengerUpdateAllOf {\n"); + sb.append(" pageAccessToken: ").append(toIndentedString(pageAccessToken)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Meta.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Meta.java new file mode 100644 index 00000000..c3990a77 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Meta.java @@ -0,0 +1,165 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Response metadata. + */ +@ApiModel(description = "Response metadata.") +@JsonPropertyOrder({ + Meta.JSON_PROPERTY_HAS_MORE, + Meta.JSON_PROPERTY_AFTER_CURSOR, + Meta.JSON_PROPERTY_BEFORE_CURSOR +}) + +public class Meta { + public static final String JSON_PROPERTY_HAS_MORE = "hasMore"; + private Boolean hasMore; + + public static final String JSON_PROPERTY_AFTER_CURSOR = "afterCursor"; + private String afterCursor; + + public static final String JSON_PROPERTY_BEFORE_CURSOR = "beforeCursor"; + private String beforeCursor; + + + public Meta hasMore(Boolean hasMore) { + + this.hasMore = hasMore; + return this; + } + + /** + * A flag that indicates if there are more records that can be fetched. + * @return hasMore + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A flag that indicates if there are more records that can be fetched.") + @JsonProperty(JSON_PROPERTY_HAS_MORE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getHasMore() { + return hasMore; + } + + + public void setHasMore(Boolean hasMore) { + this.hasMore = hasMore; + } + + + public Meta afterCursor(String afterCursor) { + + this.afterCursor = afterCursor; + return this; + } + + /** + * A record id that can be used as a `page[after]` parameter in a new request to get the next page. Not specified if there are no subsequent pages. + * @return afterCursor + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "55c8d9758590aa1900b9b9f6", value = "A record id that can be used as a `page[after]` parameter in a new request to get the next page. Not specified if there are no subsequent pages. ") + @JsonProperty(JSON_PROPERTY_AFTER_CURSOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAfterCursor() { + return afterCursor; + } + + + public void setAfterCursor(String afterCursor) { + this.afterCursor = afterCursor; + } + + + public Meta beforeCursor(String beforeCursor) { + + this.beforeCursor = beforeCursor; + return this; + } + + /** + * A record id that can be used as a `page[before]` parameter in a new request to get the previous page. Not specified if there are no previous pages. + * @return beforeCursor + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "55c8d9758590aa1900b9b9f6", value = "A record id that can be used as a `page[before]` parameter in a new request to get the previous page. Not specified if there are no previous pages. ") + @JsonProperty(JSON_PROPERTY_BEFORE_CURSOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBeforeCursor() { + return beforeCursor; + } + + + public void setBeforeCursor(String beforeCursor) { + this.beforeCursor = beforeCursor; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Meta meta = (Meta) o; + return Objects.equals(this.hasMore, meta.hasMore) && + Objects.equals(this.afterCursor, meta.afterCursor) && + Objects.equals(this.beforeCursor, meta.beforeCursor); + } + + @Override + public int hashCode() { + return Objects.hash(hasMore, afterCursor, beforeCursor); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Meta {\n"); + sb.append(" hasMore: ").append(toIndentedString(hasMore)).append("\n"); + sb.append(" afterCursor: ").append(toIndentedString(afterCursor)).append("\n"); + sb.append(" beforeCursor: ").append(toIndentedString(beforeCursor)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/OfferControlBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/OfferControlBody.java new file mode 100644 index 00000000..3064c0e6 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/OfferControlBody.java @@ -0,0 +1,132 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * OfferControlBody + */ +@JsonPropertyOrder({ + OfferControlBody.JSON_PROPERTY_SWITCHBOARD_INTEGRATION, + OfferControlBody.JSON_PROPERTY_METADATA +}) + +public class OfferControlBody { + public static final String JSON_PROPERTY_SWITCHBOARD_INTEGRATION = "switchboardIntegration"; + private String switchboardIntegration; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private Object metadata = null; + + + public OfferControlBody switchboardIntegration(String switchboardIntegration) { + + this.switchboardIntegration = switchboardIntegration; + return this; + } + + /** + * The id or the name of the switchboard integration that will become pending. Also supports the `next` keyword to offer control to the next switchboard integration designated in the switchboard hierarchy configuration. This cannot match the active switchboard integration. + * @return switchboardIntegration + **/ + @ApiModelProperty(example = "next", required = true, value = "The id or the name of the switchboard integration that will become pending. Also supports the `next` keyword to offer control to the next switchboard integration designated in the switchboard hierarchy configuration. This cannot match the active switchboard integration.") + @JsonProperty(JSON_PROPERTY_SWITCHBOARD_INTEGRATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getSwitchboardIntegration() { + return switchboardIntegration; + } + + + public void setSwitchboardIntegration(String switchboardIntegration) { + this.switchboardIntegration = switchboardIntegration; + } + + + public OfferControlBody metadata(Object metadata) { + + this.metadata = metadata; + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. The metadata object will be included in the `switchboard:offerControl` and `switchboard:offerControl:failure` webhooks. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. The metadata object will be included in the `switchboard:offerControl` and `switchboard:offerControl:failure` webhooks.") + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getMetadata() { + return metadata; + } + + + public void setMetadata(Object metadata) { + this.metadata = metadata; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OfferControlBody offerControlBody = (OfferControlBody) o; + return Objects.equals(this.switchboardIntegration, offerControlBody.switchboardIntegration) && + Objects.equals(this.metadata, offerControlBody.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(switchboardIntegration, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OfferControlBody {\n"); + sb.append(" switchboardIntegration: ").append(toIndentedString(switchboardIntegration)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Page.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Page.java new file mode 100644 index 00000000..5d6371ed --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Page.java @@ -0,0 +1,166 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Page + */ +@JsonPropertyOrder({ + Page.JSON_PROPERTY_AFTER, + Page.JSON_PROPERTY_BEFORE, + Page.JSON_PROPERTY_SIZE +}) + +public class Page { + public static final String JSON_PROPERTY_AFTER = "after"; + private String after; + + public static final String JSON_PROPERTY_BEFORE = "before"; + private String before; + + public static final String JSON_PROPERTY_SIZE = "size"; + private Integer size = 25; + + + public Page after(String after) { + + this.after = after; + return this; + } + + /** + * A record id. Results will only contain the records that come after the specified record. Only one of `after` or `before` can be provided, not both. + * @return after + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5e1606762556d93e9c176f69", value = "A record id. Results will only contain the records that come after the specified record. Only one of `after` or `before` can be provided, not both. ") + @JsonProperty(JSON_PROPERTY_AFTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAfter() { + return after; + } + + + public void setAfter(String after) { + this.after = after; + } + + + public Page before(String before) { + + this.before = before; + return this; + } + + /** + * A record id. Results will only contain the records that come before the specified record. Only one of `after` or `before` can be provided, not both. + * @return before + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5e1606762556d93e9c176f69", value = "A record id. Results will only contain the records that come before the specified record. Only one of `after` or `before` can be provided, not both. ") + @JsonProperty(JSON_PROPERTY_BEFORE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBefore() { + return before; + } + + + public void setBefore(String before) { + this.before = before; + } + + + public Page size(Integer size) { + + this.size = size; + return this; + } + + /** + * The number of records to return. + * minimum: 0 + * maximum: 100 + * @return size + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "10", value = "The number of records to return.") + @JsonProperty(JSON_PROPERTY_SIZE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getSize() { + return size; + } + + + public void setSize(Integer size) { + this.size = size; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Page page = (Page) o; + return Objects.equals(this.after, page.after) && + Objects.equals(this.before, page.before) && + Objects.equals(this.size, page.size); + } + + @Override + public int hashCode() { + return Objects.hash(after, before, size); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Page {\n"); + sb.append(" after: ").append(toIndentedString(after)).append("\n"); + sb.append(" before: ").append(toIndentedString(before)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Participant.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Participant.java new file mode 100644 index 00000000..82aef610 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Participant.java @@ -0,0 +1,291 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ClientAssociation; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Participant + */ +@JsonPropertyOrder({ + Participant.JSON_PROPERTY_ID, + Participant.JSON_PROPERTY_USER_ID, + Participant.JSON_PROPERTY_UNREAD_COUNT, + Participant.JSON_PROPERTY_CLIENT_ASSOCIATIONS, + Participant.JSON_PROPERTY_USER_EXTERNAL_ID, + Participant.JSON_PROPERTY_LAST_READ +}) + +public class Participant { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_USER_ID = "userId"; + private String userId; + + public static final String JSON_PROPERTY_UNREAD_COUNT = "unreadCount"; + private Integer unreadCount; + + public static final String JSON_PROPERTY_CLIENT_ASSOCIATIONS = "clientAssociations"; + private List clientAssociations = null; + + public static final String JSON_PROPERTY_USER_EXTERNAL_ID = "userExternalId"; + private JsonNullable userExternalId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_LAST_READ = "lastRead"; + private JsonNullable lastRead = JsonNullable.undefined(); + + + public Participant id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the participant. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "c93bb9c14dde8ffb94564eae", value = "The unique ID of the participant.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Participant userId(String userId) { + + this.userId = userId; + return this; + } + + /** + * The id of the associated user. + * @return userId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "42589ad070d43be9b00ff7e5", value = "The id of the associated user.") + @JsonProperty(JSON_PROPERTY_USER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUserId() { + return userId; + } + + + public void setUserId(String userId) { + this.userId = userId; + } + + + public Participant unreadCount(Integer unreadCount) { + + this.unreadCount = unreadCount; + return this; + } + + /** + * Number of messages the user has not yet read. + * @return unreadCount + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "0", value = "Number of messages the user has not yet read.") + @JsonProperty(JSON_PROPERTY_UNREAD_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getUnreadCount() { + return unreadCount; + } + + + public void setUnreadCount(Integer unreadCount) { + this.unreadCount = unreadCount; + } + + + public Participant clientAssociations(List clientAssociations) { + + this.clientAssociations = clientAssociations; + return this; + } + + public Participant addClientAssociationsItem(ClientAssociation clientAssociationsItem) { + if (this.clientAssociations == null) { + this.clientAssociations = new ArrayList(); + } + this.clientAssociations.add(clientAssociationsItem); + return this; + } + + /** + * Represents the clients that are active in the conversation for a particular user. A participant can have multiple clientAssociations in the case of channel transfer, business initiated conversations, or identified users. The order of the array indicates how recently a client has interacted with the conversation, with the most recent client first. The first item in the array is considered to be the user's primary client for that conversation, and will be selected first for message delivery. + * @return clientAssociations + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Represents the clients that are active in the conversation for a particular user. A participant can have multiple clientAssociations in the case of channel transfer, business initiated conversations, or identified users. The order of the array indicates how recently a client has interacted with the conversation, with the most recent client first. The first item in the array is considered to be the user's primary client for that conversation, and will be selected first for message delivery. ") + @JsonProperty(JSON_PROPERTY_CLIENT_ASSOCIATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getClientAssociations() { + return clientAssociations; + } + + + public void setClientAssociations(List clientAssociations) { + this.clientAssociations = clientAssociations; + } + + + public Participant userExternalId(String userExternalId) { + this.userExternalId = JsonNullable.of(userExternalId); + + return this; + } + + /** + * The externalId of the associated user. + * @return userExternalId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your-own-id", value = "The externalId of the associated user.") + @JsonIgnore + + public String getUserExternalId() { + return userExternalId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_USER_EXTERNAL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getUserExternalId_JsonNullable() { + return userExternalId; + } + + @JsonProperty(JSON_PROPERTY_USER_EXTERNAL_ID) + public void setUserExternalId_JsonNullable(JsonNullable userExternalId) { + this.userExternalId = userExternalId; + } + + public void setUserExternalId(String userExternalId) { + this.userExternalId = JsonNullable.of(userExternalId); + } + + + public Participant lastRead(String lastRead) { + this.lastRead = JsonNullable.of(lastRead); + + return this; + } + + /** + * A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the latest message the user has read. + * @return lastRead + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2019-01-14T18:55:12.515Z", value = "A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing the latest message the user has read.") + @JsonIgnore + + public String getLastRead() { + return lastRead.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_LAST_READ) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getLastRead_JsonNullable() { + return lastRead; + } + + @JsonProperty(JSON_PROPERTY_LAST_READ) + public void setLastRead_JsonNullable(JsonNullable lastRead) { + this.lastRead = lastRead; + } + + public void setLastRead(String lastRead) { + this.lastRead = JsonNullable.of(lastRead); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Participant participant = (Participant) o; + return Objects.equals(this.id, participant.id) && + Objects.equals(this.userId, participant.userId) && + Objects.equals(this.unreadCount, participant.unreadCount) && + Objects.equals(this.clientAssociations, participant.clientAssociations) && + Objects.equals(this.userExternalId, participant.userExternalId) && + Objects.equals(this.lastRead, participant.lastRead); + } + + @Override + public int hashCode() { + return Objects.hash(id, userId, unreadCount, clientAssociations, userExternalId, lastRead); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Participant {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" unreadCount: ").append(toIndentedString(unreadCount)).append("\n"); + sb.append(" clientAssociations: ").append(toIndentedString(clientAssociations)).append("\n"); + sb.append(" userExternalId: ").append(toIndentedString(userExternalId)).append("\n"); + sb.append(" lastRead: ").append(toIndentedString(lastRead)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantJoinBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantJoinBody.java new file mode 100644 index 00000000..a015bf7d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantJoinBody.java @@ -0,0 +1,73 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ParticipantSubSchema; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ParticipantJoinBody + */ +@JsonPropertyOrder({ +}) + +public class ParticipantJoinBody extends ParticipantSubSchema { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParticipantJoinBody {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantLeaveBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantLeaveBody.java new file mode 100644 index 00000000..f0c16f8c --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantLeaveBody.java @@ -0,0 +1,38 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ParticipantLeaveBodyParticipantId; +import com.zendesk.sunshine_conversations_client.model.ParticipantLeaveBodyUserExternalId; +import com.zendesk.sunshine_conversations_client.model.ParticipantLeaveBodyUserId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "", visible = true) +@JsonSubTypes({ +}) + +public interface ParticipantLeaveBody { +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantLeaveBodyParticipantId.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantLeaveBodyParticipantId.java new file mode 100644 index 00000000..5b4a1677 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantLeaveBodyParticipantId.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.ParticipantLeaveBody; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ParticipantLeaveBodyParticipantId + */ +@JsonPropertyOrder({ + ParticipantLeaveBodyParticipantId.JSON_PROPERTY_PARTICIPANT_ID +}) + +public class ParticipantLeaveBodyParticipantId implements ParticipantLeaveBody { + public static final String JSON_PROPERTY_PARTICIPANT_ID = "participantId"; + private String participantId; + + + public ParticipantLeaveBodyParticipantId participantId(String participantId) { + + this.participantId = participantId; + return this; + } + + /** + * The participantId of the user that will be removed from the conversation. It will return 404 if the user can’t be found. + * @return participantId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "42589ad070d43be9b00ff7e5", value = "The participantId of the user that will be removed from the conversation. It will return 404 if the user can’t be found. ") + @JsonProperty(JSON_PROPERTY_PARTICIPANT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getParticipantId() { + return participantId; + } + + + public void setParticipantId(String participantId) { + this.participantId = participantId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParticipantLeaveBodyParticipantId participantLeaveBodyParticipantId = (ParticipantLeaveBodyParticipantId) o; + return Objects.equals(this.participantId, participantLeaveBodyParticipantId.participantId); + } + + @Override + public int hashCode() { + return Objects.hash(participantId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParticipantLeaveBodyParticipantId {\n"); + sb.append(" participantId: ").append(toIndentedString(participantId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantLeaveBodyUserExternalId.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantLeaveBodyUserExternalId.java new file mode 100644 index 00000000..ce4ad408 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantLeaveBodyUserExternalId.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.ParticipantLeaveBody; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ParticipantLeaveBodyUserExternalId + */ +@JsonPropertyOrder({ + ParticipantLeaveBodyUserExternalId.JSON_PROPERTY_USER_EXTERNAL_ID +}) + +public class ParticipantLeaveBodyUserExternalId implements ParticipantLeaveBody { + public static final String JSON_PROPERTY_USER_EXTERNAL_ID = "userExternalId"; + private String userExternalId; + + + public ParticipantLeaveBodyUserExternalId userExternalId(String userExternalId) { + + this.userExternalId = userExternalId; + return this; + } + + /** + * The externalId of the user that will be removed from the conversation. It will return 404 if the user can’t be found. + * @return userExternalId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your-own-user-id", value = "The externalId of the user that will be removed from the conversation. It will return 404 if the user can’t be found. ") + @JsonProperty(JSON_PROPERTY_USER_EXTERNAL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUserExternalId() { + return userExternalId; + } + + + public void setUserExternalId(String userExternalId) { + this.userExternalId = userExternalId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParticipantLeaveBodyUserExternalId participantLeaveBodyUserExternalId = (ParticipantLeaveBodyUserExternalId) o; + return Objects.equals(this.userExternalId, participantLeaveBodyUserExternalId.userExternalId); + } + + @Override + public int hashCode() { + return Objects.hash(userExternalId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParticipantLeaveBodyUserExternalId {\n"); + sb.append(" userExternalId: ").append(toIndentedString(userExternalId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantLeaveBodyUserId.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantLeaveBodyUserId.java new file mode 100644 index 00000000..52c08844 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantLeaveBodyUserId.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.ParticipantLeaveBody; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ParticipantLeaveBodyUserId + */ +@JsonPropertyOrder({ + ParticipantLeaveBodyUserId.JSON_PROPERTY_USER_ID +}) + +public class ParticipantLeaveBodyUserId implements ParticipantLeaveBody { + public static final String JSON_PROPERTY_USER_ID = "userId"; + private String userId; + + + public ParticipantLeaveBodyUserId userId(String userId) { + + this.userId = userId; + return this; + } + + /** + * The id of the user that will be removed from the conversation. It will return 404 if the user can’t be found. + * @return userId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "42589ad070d43be9b00ff7e5", value = "The id of the user that will be removed from the conversation. It will return 404 if the user can’t be found. ") + @JsonProperty(JSON_PROPERTY_USER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUserId() { + return userId; + } + + + public void setUserId(String userId) { + this.userId = userId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParticipantLeaveBodyUserId participantLeaveBodyUserId = (ParticipantLeaveBodyUserId) o; + return Objects.equals(this.userId, participantLeaveBodyUserId.userId); + } + + @Override + public int hashCode() { + return Objects.hash(userId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParticipantLeaveBodyUserId {\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantListResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantListResponse.java new file mode 100644 index 00000000..dc0328da --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantListResponse.java @@ -0,0 +1,178 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Links; +import com.zendesk.sunshine_conversations_client.model.Meta; +import com.zendesk.sunshine_conversations_client.model.Participant; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * List of returned participants. + */ +@ApiModel(description = "List of returned participants.") +@JsonPropertyOrder({ + ParticipantListResponse.JSON_PROPERTY_PARTICIPANTS, + ParticipantListResponse.JSON_PROPERTY_META, + ParticipantListResponse.JSON_PROPERTY_LINKS +}) + +public class ParticipantListResponse { + public static final String JSON_PROPERTY_PARTICIPANTS = "participants"; + private List participants = null; + + public static final String JSON_PROPERTY_META = "meta"; + private Meta meta; + + public static final String JSON_PROPERTY_LINKS = "links"; + private Links links; + + + public ParticipantListResponse participants(List participants) { + + this.participants = participants; + return this; + } + + public ParticipantListResponse addParticipantsItem(Participant participantsItem) { + if (this.participants == null) { + this.participants = new ArrayList(); + } + this.participants.add(participantsItem); + return this; + } + + /** + * Get participants + * @return participants + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PARTICIPANTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getParticipants() { + return participants; + } + + + public void setParticipants(List participants) { + this.participants = participants; + } + + + public ParticipantListResponse meta(Meta meta) { + + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Meta getMeta() { + return meta; + } + + + public void setMeta(Meta meta) { + this.meta = meta; + } + + + public ParticipantListResponse links(Links links) { + + this.links = links; + return this; + } + + /** + * Get links + * @return links + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_LINKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Links getLinks() { + return links; + } + + + public void setLinks(Links links) { + this.links = links; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParticipantListResponse participantListResponse = (ParticipantListResponse) o; + return Objects.equals(this.participants, participantListResponse.participants) && + Objects.equals(this.meta, participantListResponse.meta) && + Objects.equals(this.links, participantListResponse.links); + } + + @Override + public int hashCode() { + return Objects.hash(participants, meta, links); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParticipantListResponse {\n"); + sb.append(" participants: ").append(toIndentedString(participants)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantResponse.java new file mode 100644 index 00000000..85b3ca22 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantResponse.java @@ -0,0 +1,104 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Participant; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The created participant. + */ +@ApiModel(description = "The created participant.") +@JsonPropertyOrder({ + ParticipantResponse.JSON_PROPERTY_PARTICIPANT +}) + +public class ParticipantResponse { + public static final String JSON_PROPERTY_PARTICIPANT = "participant"; + private Participant participant; + + + public ParticipantResponse participant(Participant participant) { + + this.participant = participant; + return this; + } + + /** + * Get participant + * @return participant + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PARTICIPANT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Participant getParticipant() { + return participant; + } + + + public void setParticipant(Participant participant) { + this.participant = participant; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParticipantResponse participantResponse = (ParticipantResponse) o; + return Objects.equals(this.participant, participantResponse.participant); + } + + @Override + public int hashCode() { + return Objects.hash(participant); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParticipantResponse {\n"); + sb.append(" participant: ").append(toIndentedString(participant)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantSubSchema.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantSubSchema.java new file mode 100644 index 00000000..d807faa8 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantSubSchema.java @@ -0,0 +1,166 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ParticipantWithUserExternalId; +import com.zendesk.sunshine_conversations_client.model.ParticipantWithUserId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ParticipantSubSchema + */ +@JsonPropertyOrder({ + ParticipantSubSchema.JSON_PROPERTY_USER_ID, + ParticipantSubSchema.JSON_PROPERTY_SUBSCRIBE_S_D_K_CLIENT, + ParticipantSubSchema.JSON_PROPERTY_USER_EXTERNAL_ID +}) + +public class ParticipantSubSchema { + public static final String JSON_PROPERTY_USER_ID = "userId"; + private String userId; + + public static final String JSON_PROPERTY_SUBSCRIBE_S_D_K_CLIENT = "subscribeSDKClient"; + private Boolean subscribeSDKClient; + + public static final String JSON_PROPERTY_USER_EXTERNAL_ID = "userExternalId"; + private String userExternalId; + + + public ParticipantSubSchema userId(String userId) { + + this.userId = userId; + return this; + } + + /** + * The id of the user that will be participating in the conversation. It will return `404` if the user can’t be found. One of `userId` or `userExternalId` is required, but not both. + * @return userId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "42589ad070d43be9b00ff7e5", value = "The id of the user that will be participating in the conversation. It will return `404` if the user can’t be found. One of `userId` or `userExternalId` is required, but not both.") + @JsonProperty(JSON_PROPERTY_USER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUserId() { + return userId; + } + + + public void setUserId(String userId) { + this.userId = userId; + } + + + public ParticipantSubSchema subscribeSDKClient(Boolean subscribeSDKClient) { + + this.subscribeSDKClient = subscribeSDKClient; + return this; + } + + /** + * When passed as true, the SDK client of the concerned participant will be subscribed to the conversation. The user will start receiving push notifications for this conversation right away, without having to view the conversation on the SDK beforehand. An SDK client will be created for users that don’t already have one. This field is required if the conversation is of type `sdkGroup`. + * @return subscribeSDKClient + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "false", value = "When passed as true, the SDK client of the concerned participant will be subscribed to the conversation. The user will start receiving push notifications for this conversation right away, without having to view the conversation on the SDK beforehand. An SDK client will be created for users that don’t already have one. This field is required if the conversation is of type `sdkGroup`.") + @JsonProperty(JSON_PROPERTY_SUBSCRIBE_S_D_K_CLIENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getSubscribeSDKClient() { + return subscribeSDKClient; + } + + + public void setSubscribeSDKClient(Boolean subscribeSDKClient) { + this.subscribeSDKClient = subscribeSDKClient; + } + + + public ParticipantSubSchema userExternalId(String userExternalId) { + + this.userExternalId = userExternalId; + return this; + } + + /** + * The `externalId` of the user that will be participating in the conversation. It will return `404` if the user can’t be found. One of `userId` or `userExternalId` is required, but not both. + * @return userExternalId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your-own-user-id", value = "The `externalId` of the user that will be participating in the conversation. It will return `404` if the user can’t be found. One of `userId` or `userExternalId` is required, but not both.") + @JsonProperty(JSON_PROPERTY_USER_EXTERNAL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUserExternalId() { + return userExternalId; + } + + + public void setUserExternalId(String userExternalId) { + this.userExternalId = userExternalId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParticipantSubSchema participantSubSchema = (ParticipantSubSchema) o; + return Objects.equals(this.userId, participantSubSchema.userId) && + Objects.equals(this.subscribeSDKClient, participantSubSchema.subscribeSDKClient) && + Objects.equals(this.userExternalId, participantSubSchema.userExternalId); + } + + @Override + public int hashCode() { + return Objects.hash(userId, subscribeSDKClient, userExternalId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParticipantSubSchema {\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" subscribeSDKClient: ").append(toIndentedString(subscribeSDKClient)).append("\n"); + sb.append(" userExternalId: ").append(toIndentedString(userExternalId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantWithUserExternalId.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantWithUserExternalId.java new file mode 100644 index 00000000..0db9b125 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantWithUserExternalId.java @@ -0,0 +1,133 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ParticipantWithUserExternalId + */ +@JsonPropertyOrder({ + ParticipantWithUserExternalId.JSON_PROPERTY_USER_EXTERNAL_ID, + ParticipantWithUserExternalId.JSON_PROPERTY_SUBSCRIBE_S_D_K_CLIENT +}) + +public class ParticipantWithUserExternalId { + public static final String JSON_PROPERTY_USER_EXTERNAL_ID = "userExternalId"; + private String userExternalId; + + public static final String JSON_PROPERTY_SUBSCRIBE_S_D_K_CLIENT = "subscribeSDKClient"; + private Boolean subscribeSDKClient; + + + public ParticipantWithUserExternalId userExternalId(String userExternalId) { + + this.userExternalId = userExternalId; + return this; + } + + /** + * The `externalId` of the user that will be participating in the conversation. It will return `404` if the user can’t be found. One of `userId` or `userExternalId` is required, but not both. + * @return userExternalId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your-own-user-id", value = "The `externalId` of the user that will be participating in the conversation. It will return `404` if the user can’t be found. One of `userId` or `userExternalId` is required, but not both.") + @JsonProperty(JSON_PROPERTY_USER_EXTERNAL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUserExternalId() { + return userExternalId; + } + + + public void setUserExternalId(String userExternalId) { + this.userExternalId = userExternalId; + } + + + public ParticipantWithUserExternalId subscribeSDKClient(Boolean subscribeSDKClient) { + + this.subscribeSDKClient = subscribeSDKClient; + return this; + } + + /** + * When passed as true, the SDK client of the concerned participant will be subscribed to the conversation. The user will start receiving push notifications for this conversation right away, without having to view the conversation on the SDK beforehand. An SDK client will be created for users that don’t already have one. This field is required if the conversation is of type `sdkGroup`. + * @return subscribeSDKClient + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "false", value = "When passed as true, the SDK client of the concerned participant will be subscribed to the conversation. The user will start receiving push notifications for this conversation right away, without having to view the conversation on the SDK beforehand. An SDK client will be created for users that don’t already have one. This field is required if the conversation is of type `sdkGroup`.") + @JsonProperty(JSON_PROPERTY_SUBSCRIBE_S_D_K_CLIENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getSubscribeSDKClient() { + return subscribeSDKClient; + } + + + public void setSubscribeSDKClient(Boolean subscribeSDKClient) { + this.subscribeSDKClient = subscribeSDKClient; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParticipantWithUserExternalId participantWithUserExternalId = (ParticipantWithUserExternalId) o; + return Objects.equals(this.userExternalId, participantWithUserExternalId.userExternalId) && + Objects.equals(this.subscribeSDKClient, participantWithUserExternalId.subscribeSDKClient); + } + + @Override + public int hashCode() { + return Objects.hash(userExternalId, subscribeSDKClient); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParticipantWithUserExternalId {\n"); + sb.append(" userExternalId: ").append(toIndentedString(userExternalId)).append("\n"); + sb.append(" subscribeSDKClient: ").append(toIndentedString(subscribeSDKClient)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantWithUserId.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantWithUserId.java new file mode 100644 index 00000000..602d3020 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ParticipantWithUserId.java @@ -0,0 +1,133 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ParticipantWithUserId + */ +@JsonPropertyOrder({ + ParticipantWithUserId.JSON_PROPERTY_USER_ID, + ParticipantWithUserId.JSON_PROPERTY_SUBSCRIBE_S_D_K_CLIENT +}) + +public class ParticipantWithUserId { + public static final String JSON_PROPERTY_USER_ID = "userId"; + private String userId; + + public static final String JSON_PROPERTY_SUBSCRIBE_S_D_K_CLIENT = "subscribeSDKClient"; + private Boolean subscribeSDKClient; + + + public ParticipantWithUserId userId(String userId) { + + this.userId = userId; + return this; + } + + /** + * The id of the user that will be participating in the conversation. It will return `404` if the user can’t be found. One of `userId` or `userExternalId` is required, but not both. + * @return userId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "42589ad070d43be9b00ff7e5", value = "The id of the user that will be participating in the conversation. It will return `404` if the user can’t be found. One of `userId` or `userExternalId` is required, but not both.") + @JsonProperty(JSON_PROPERTY_USER_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUserId() { + return userId; + } + + + public void setUserId(String userId) { + this.userId = userId; + } + + + public ParticipantWithUserId subscribeSDKClient(Boolean subscribeSDKClient) { + + this.subscribeSDKClient = subscribeSDKClient; + return this; + } + + /** + * When passed as true, the SDK client of the concerned participant will be subscribed to the conversation. The user will start receiving push notifications for this conversation right away, without having to view the conversation on the SDK beforehand. An SDK client will be created for users that don’t already have one. This field is required if the conversation is of type `sdkGroup`. + * @return subscribeSDKClient + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "false", value = "When passed as true, the SDK client of the concerned participant will be subscribed to the conversation. The user will start receiving push notifications for this conversation right away, without having to view the conversation on the SDK beforehand. An SDK client will be created for users that don’t already have one. This field is required if the conversation is of type `sdkGroup`.") + @JsonProperty(JSON_PROPERTY_SUBSCRIBE_S_D_K_CLIENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getSubscribeSDKClient() { + return subscribeSDKClient; + } + + + public void setSubscribeSDKClient(Boolean subscribeSDKClient) { + this.subscribeSDKClient = subscribeSDKClient; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ParticipantWithUserId participantWithUserId = (ParticipantWithUserId) o; + return Objects.equals(this.userId, participantWithUserId.userId) && + Objects.equals(this.subscribeSDKClient, participantWithUserId.subscribeSDKClient); + } + + @Override + public int hashCode() { + return Objects.hash(userId, subscribeSDKClient); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ParticipantWithUserId {\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" subscribeSDKClient: ").append(toIndentedString(subscribeSDKClient)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/PassControlBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/PassControlBody.java new file mode 100644 index 00000000..a12164f7 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/PassControlBody.java @@ -0,0 +1,132 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * PassControlBody + */ +@JsonPropertyOrder({ + PassControlBody.JSON_PROPERTY_SWITCHBOARD_INTEGRATION, + PassControlBody.JSON_PROPERTY_METADATA +}) + +public class PassControlBody { + public static final String JSON_PROPERTY_SWITCHBOARD_INTEGRATION = "switchboardIntegration"; + private String switchboardIntegration; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private Object metadata = null; + + + public PassControlBody switchboardIntegration(String switchboardIntegration) { + + this.switchboardIntegration = switchboardIntegration; + return this; + } + + /** + * The id or the name of the switchboard integration that will become active. May also use the `next` keyword to transfer control to the next switchboard integration designated in the switchboard hierarchy configuration + * @return switchboardIntegration + **/ + @ApiModelProperty(example = "next", required = true, value = "The id or the name of the switchboard integration that will become active. May also use the `next` keyword to transfer control to the next switchboard integration designated in the switchboard hierarchy configuration") + @JsonProperty(JSON_PROPERTY_SWITCHBOARD_INTEGRATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getSwitchboardIntegration() { + return switchboardIntegration; + } + + + public void setSwitchboardIntegration(String switchboardIntegration) { + this.switchboardIntegration = switchboardIntegration; + } + + + public PassControlBody metadata(Object metadata) { + + this.metadata = metadata; + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. The metadata object will be included in the `switchboard:passControl` webhook. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. The metadata object will be included in the `switchboard:passControl` webhook.") + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getMetadata() { + return metadata; + } + + + public void setMetadata(Object metadata) { + this.metadata = metadata; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PassControlBody passControlBody = (PassControlBody) o; + return Objects.equals(this.switchboardIntegration, passControlBody.switchboardIntegration) && + Objects.equals(this.metadata, passControlBody.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(switchboardIntegration, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PassControlBody {\n"); + sb.append(" switchboardIntegration: ").append(toIndentedString(switchboardIntegration)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Postback.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Postback.java new file mode 100644 index 00000000..1a919dce --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Postback.java @@ -0,0 +1,210 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.zendesk.sunshine_conversations_client.model.Action; +import com.zendesk.sunshine_conversations_client.model.ActionSubset; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Postback + */ +@JsonPropertyOrder({ + Postback.JSON_PROPERTY_TYPE, + Postback.JSON_PROPERTY_TEXT, + Postback.JSON_PROPERTY_PAYLOAD, + Postback.JSON_PROPERTY_METADATA +}) + +public class Postback implements Action, ActionSubset { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "postback"; + + public static final String JSON_PROPERTY_TEXT = "text"; + private String text; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private Object payload; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public Postback type(String type) { + + this.type = type; + return this; + } + + /** + * The type of action. + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of action.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Postback text(String text) { + + this.text = text; + return this; + } + + /** + * The button text. + * @return text + **/ + @ApiModelProperty(required = true, value = "The button text.") + @JsonProperty(JSON_PROPERTY_TEXT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public Postback payload(Object payload) { + + this.payload = payload; + return this; + } + + /** + * The payload of a postback or reply button. + * @return payload + **/ + @ApiModelProperty(required = true, value = "The payload of a postback or reply button.") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Object getPayload() { + return payload; + } + + + public void setPayload(Object payload) { + this.payload = payload; + } + + + public Postback metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Postback postback = (Postback) o; + return Objects.equals(this.type, postback.type) && + Objects.equals(this.text, postback.text) && + Objects.equals(this.payload, postback.payload) && + Objects.equals(this.metadata, postback.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(type, text, payload, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Postback {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/PostbackWebhook.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/PostbackWebhook.java new file mode 100644 index 00000000..40fecb4e --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/PostbackWebhook.java @@ -0,0 +1,146 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * PostbackWebhook + */ +@JsonPropertyOrder({ + PostbackWebhook.JSON_PROPERTY_PAYLOAD, + PostbackWebhook.JSON_PROPERTY_METADATA +}) + +public class PostbackWebhook { + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private String payload; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public PostbackWebhook payload(String payload) { + + this.payload = payload; + return this; + } + + /** + * The payload associated with the postback. + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The payload associated with the postback.") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPayload() { + return payload; + } + + + public void setPayload(String payload) { + this.payload = payload; + } + + + public PostbackWebhook metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PostbackWebhook postbackWebhook = (PostbackWebhook) o; + return Objects.equals(this.payload, postbackWebhook.payload) && + Objects.equals(this.metadata, postbackWebhook.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(payload, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PostbackWebhook {\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/PrechatCapture.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/PrechatCapture.java new file mode 100644 index 00000000..c236176a --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/PrechatCapture.java @@ -0,0 +1,206 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Field; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * PrechatCapture + */ +@JsonPropertyOrder({ + PrechatCapture.JSON_PROPERTY_AVATAR_URL, + PrechatCapture.JSON_PROPERTY_ENABLED, + PrechatCapture.JSON_PROPERTY_ENABLE_EMAIL_LINKING, + PrechatCapture.JSON_PROPERTY_FIELDS +}) + +public class PrechatCapture { + public static final String JSON_PROPERTY_AVATAR_URL = "avatarUrl"; + private String avatarUrl = "undefined"; + + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled = false; + + public static final String JSON_PROPERTY_ENABLE_EMAIL_LINKING = "enableEmailLinking"; + private Boolean enableEmailLinking = false; + + public static final String JSON_PROPERTY_FIELDS = "fields"; + private List fields = null; + + + public PrechatCapture avatarUrl(String avatarUrl) { + + this.avatarUrl = avatarUrl; + return this; + } + + /** + * Sets the URL of the avatar to use for the automatic reply to the prechat capture messages. + * @return avatarUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "http://domain.com/images/avatar.png", value = "Sets the URL of the avatar to use for the automatic reply to the prechat capture messages.") + @JsonProperty(JSON_PROPERTY_AVATAR_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAvatarUrl() { + return avatarUrl; + } + + + public void setAvatarUrl(String avatarUrl) { + this.avatarUrl = avatarUrl; + } + + + public PrechatCapture enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * If true, enables the Prechat Capture add-on when the Web Messenger is initialized. + * @return enabled + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "If true, enables the Prechat Capture add-on when the Web Messenger is initialized.") + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getEnabled() { + return enabled; + } + + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + + public PrechatCapture enableEmailLinking(Boolean enableEmailLinking) { + + this.enableEmailLinking = enableEmailLinking; + return this; + } + + /** + * f true and Mailgun is integrated, will automatically link submitted emails. + * @return enableEmailLinking + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "f true and Mailgun is integrated, will automatically link submitted emails.") + @JsonProperty(JSON_PROPERTY_ENABLE_EMAIL_LINKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getEnableEmailLinking() { + return enableEmailLinking; + } + + + public void setEnableEmailLinking(Boolean enableEmailLinking) { + this.enableEmailLinking = enableEmailLinking; + } + + + public PrechatCapture fields(List fields) { + + this.fields = fields; + return this; + } + + public PrechatCapture addFieldsItem(Field fieldsItem) { + if (this.fields == null) { + this.fields = new ArrayList(); + } + this.fields.add(fieldsItem); + return this; + } + + /** + * Array of Fields. Overrides the default Prechat Capture fields to define a custom form. + * @return fields + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "[{\"type\":\"email\",\"name\":\"email\",\"label\":\"Email\",\"placeholder\":\"your@email.com\"},{\"type\":\"text\",\"name\":\"company-website\",\"label\":\"Company website\",\"placeholder\":\"mycompany.com\"}]", value = "Array of Fields. Overrides the default Prechat Capture fields to define a custom form.") + @JsonProperty(JSON_PROPERTY_FIELDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getFields() { + return fields; + } + + + public void setFields(List fields) { + this.fields = fields; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PrechatCapture prechatCapture = (PrechatCapture) o; + return Objects.equals(this.avatarUrl, prechatCapture.avatarUrl) && + Objects.equals(this.enabled, prechatCapture.enabled) && + Objects.equals(this.enableEmailLinking, prechatCapture.enableEmailLinking) && + Objects.equals(this.fields, prechatCapture.fields); + } + + @Override + public int hashCode() { + return Objects.hash(avatarUrl, enabled, enableEmailLinking, fields); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrechatCapture {\n"); + sb.append(" avatarUrl: ").append(toIndentedString(avatarUrl)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" enableEmailLinking: ").append(toIndentedString(enableEmailLinking)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Profile.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Profile.java new file mode 100644 index 00000000..226a0ea7 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Profile.java @@ -0,0 +1,240 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Object hosting user profile information. + */ +@ApiModel(description = "Object hosting user profile information.") +@JsonPropertyOrder({ + Profile.JSON_PROPERTY_GIVEN_NAME, + Profile.JSON_PROPERTY_SURNAME, + Profile.JSON_PROPERTY_EMAIL, + Profile.JSON_PROPERTY_AVATAR_URL +}) + +public class Profile { + public static final String JSON_PROPERTY_GIVEN_NAME = "givenName"; + private JsonNullable givenName = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SURNAME = "surname"; + private JsonNullable surname = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_EMAIL = "email"; + private JsonNullable email = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_AVATAR_URL = "avatarUrl"; + private JsonNullable avatarUrl = JsonNullable.undefined(); + + + public Profile givenName(String givenName) { + this.givenName = JsonNullable.of(givenName); + + return this; + } + + /** + * The user's given name (first name). + * @return givenName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Jane", value = "The user's given name (first name).") + @JsonIgnore + + public String getGivenName() { + return givenName.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_GIVEN_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getGivenName_JsonNullable() { + return givenName; + } + + @JsonProperty(JSON_PROPERTY_GIVEN_NAME) + public void setGivenName_JsonNullable(JsonNullable givenName) { + this.givenName = givenName; + } + + public void setGivenName(String givenName) { + this.givenName = JsonNullable.of(givenName); + } + + + public Profile surname(String surname) { + this.surname = JsonNullable.of(surname); + + return this; + } + + /** + * The user's surname (last name). + * @return surname + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Doe", value = "The user's surname (last name).") + @JsonIgnore + + public String getSurname() { + return surname.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SURNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getSurname_JsonNullable() { + return surname; + } + + @JsonProperty(JSON_PROPERTY_SURNAME) + public void setSurname_JsonNullable(JsonNullable surname) { + this.surname = surname; + } + + public void setSurname(String surname) { + this.surname = JsonNullable.of(surname); + } + + + public Profile email(String email) { + this.email = JsonNullable.of(email); + + return this; + } + + /** + * The user's email address. + * @return email + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "jane.doe@gmail.com", value = "The user's email address.") + @JsonIgnore + + public String getEmail() { + return email.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getEmail_JsonNullable() { + return email; + } + + @JsonProperty(JSON_PROPERTY_EMAIL) + public void setEmail_JsonNullable(JsonNullable email) { + this.email = email; + } + + public void setEmail(String email) { + this.email = JsonNullable.of(email); + } + + + public Profile avatarUrl(URI avatarUrl) { + this.avatarUrl = JsonNullable.of(avatarUrl); + + return this; + } + + /** + * The user's avatar. + * @return avatarUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://s3.amazonaws.com/avatar.jpg", value = "The user's avatar.") + @JsonIgnore + + public URI getAvatarUrl() { + return avatarUrl.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_AVATAR_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAvatarUrl_JsonNullable() { + return avatarUrl; + } + + @JsonProperty(JSON_PROPERTY_AVATAR_URL) + public void setAvatarUrl_JsonNullable(JsonNullable avatarUrl) { + this.avatarUrl = avatarUrl; + } + + public void setAvatarUrl(URI avatarUrl) { + this.avatarUrl = JsonNullable.of(avatarUrl); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Profile profile = (Profile) o; + return Objects.equals(this.givenName, profile.givenName) && + Objects.equals(this.surname, profile.surname) && + Objects.equals(this.email, profile.email) && + Objects.equals(this.avatarUrl, profile.avatarUrl); + } + + @Override + public int hashCode() { + return Objects.hash(givenName, surname, email, avatarUrl); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Profile {\n"); + sb.append(" givenName: ").append(toIndentedString(givenName)).append("\n"); + sb.append(" surname: ").append(toIndentedString(surname)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" avatarUrl: ").append(toIndentedString(avatarUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/QuotedMessage.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/QuotedMessage.java new file mode 100644 index 00000000..2d0d8e79 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/QuotedMessage.java @@ -0,0 +1,38 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Message; +import com.zendesk.sunshine_conversations_client.model.QuotedMessageExternalMessageId; +import com.zendesk.sunshine_conversations_client.model.QuotedMessageMessage; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "", visible = true) +@JsonSubTypes({ +}) + +public interface QuotedMessage { +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/QuotedMessageExternalMessageId.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/QuotedMessageExternalMessageId.java new file mode 100644 index 00000000..4188022c --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/QuotedMessageExternalMessageId.java @@ -0,0 +1,134 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.QuotedMessage; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * QuotedMessageExternalMessageId + */ +@JsonPropertyOrder({ + QuotedMessageExternalMessageId.JSON_PROPERTY_TYPE, + QuotedMessageExternalMessageId.JSON_PROPERTY_EXTERNAL_MESSAGE_ID +}) + +public class QuotedMessageExternalMessageId implements QuotedMessage { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "externalMessageId"; + + public static final String JSON_PROPERTY_EXTERNAL_MESSAGE_ID = "externalMessageId"; + private String externalMessageId; + + + public QuotedMessageExternalMessageId type(String type) { + + this.type = type; + return this; + } + + /** + * The type of quotedMessage - `externalMessageId` if no Sunshine Conversations message matched the quoted message. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of quotedMessage - `externalMessageId` if no Sunshine Conversations message matched the quoted message.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public QuotedMessageExternalMessageId externalMessageId(String externalMessageId) { + + this.externalMessageId = externalMessageId; + return this; + } + + /** + * The external message Id of the quoted message. + * @return externalMessageId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The external message Id of the quoted message.") + @JsonProperty(JSON_PROPERTY_EXTERNAL_MESSAGE_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getExternalMessageId() { + return externalMessageId; + } + + + public void setExternalMessageId(String externalMessageId) { + this.externalMessageId = externalMessageId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QuotedMessageExternalMessageId quotedMessageExternalMessageId = (QuotedMessageExternalMessageId) o; + return Objects.equals(this.type, quotedMessageExternalMessageId.type) && + Objects.equals(this.externalMessageId, quotedMessageExternalMessageId.externalMessageId); + } + + @Override + public int hashCode() { + return Objects.hash(type, externalMessageId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuotedMessageExternalMessageId {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" externalMessageId: ").append(toIndentedString(externalMessageId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/QuotedMessageMessage.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/QuotedMessageMessage.java new file mode 100644 index 00000000..00560240 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/QuotedMessageMessage.java @@ -0,0 +1,135 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Message; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.QuotedMessage; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * QuotedMessageMessage + */ +@JsonPropertyOrder({ + QuotedMessageMessage.JSON_PROPERTY_TYPE, + QuotedMessageMessage.JSON_PROPERTY_MESSAGE +}) + +public class QuotedMessageMessage implements QuotedMessage { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "message"; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private Message message = null; + + + public QuotedMessageMessage type(String type) { + + this.type = type; + return this; + } + + /** + * The type of quotedMessage - a complete Sunshine Conversations message is provided. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of quotedMessage - a complete Sunshine Conversations message is provided.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public QuotedMessageMessage message(Message message) { + + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Message getMessage() { + return message; + } + + + public void setMessage(Message message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QuotedMessageMessage quotedMessageMessage = (QuotedMessageMessage) o; + return Objects.equals(this.type, quotedMessageMessage.type) && + Objects.equals(this.message, quotedMessageMessage.message); + } + + @Override + public int hashCode() { + return Objects.hash(type, message); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuotedMessageMessage {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Referral.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Referral.java new file mode 100644 index 00000000..41bbd240 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Referral.java @@ -0,0 +1,147 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ReferralDetails; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Referral + */ +@JsonPropertyOrder({ + Referral.JSON_PROPERTY_CODE, + Referral.JSON_PROPERTY_DETAILS +}) + +public class Referral { + public static final String JSON_PROPERTY_CODE = "code"; + private String code; + + public static final String JSON_PROPERTY_DETAILS = "details"; + private JsonNullable details = JsonNullable.undefined(); + + + public Referral code(String code) { + + this.code = code; + return this; + } + + /** + * The referral’s identifier. + * @return code + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The referral’s identifier.") + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCode() { + return code; + } + + + public void setCode(String code) { + this.code = code; + } + + + public Referral details(ReferralDetails details) { + this.details = JsonNullable.of(details); + + return this; + } + + /** + * Get details + * @return details + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public ReferralDetails getDetails() { + return details.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DETAILS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDetails_JsonNullable() { + return details; + } + + @JsonProperty(JSON_PROPERTY_DETAILS) + public void setDetails_JsonNullable(JsonNullable details) { + this.details = details; + } + + public void setDetails(ReferralDetails details) { + this.details = JsonNullable.of(details); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Referral referral = (Referral) o; + return Objects.equals(this.code, referral.code) && + Objects.equals(this.details, referral.details); + } + + @Override + public int hashCode() { + return Objects.hash(code, details); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Referral {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ReferralDetails.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ReferralDetails.java new file mode 100644 index 00000000..898381e2 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ReferralDetails.java @@ -0,0 +1,178 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Nested object containing additional information. + */ +@ApiModel(description = "Nested object containing additional information.") +@JsonPropertyOrder({ + ReferralDetails.JSON_PROPERTY_SOURCE, + ReferralDetails.JSON_PROPERTY_TYPE, + ReferralDetails.JSON_PROPERTY_AD_ID +}) + +public class ReferralDetails { + public static final String JSON_PROPERTY_SOURCE = "source"; + private String source; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_AD_ID = "adId"; + private JsonNullable adId = JsonNullable.undefined(); + + + public ReferralDetails source(String source) { + + this.source = source; + return this; + } + + /** + * The source of the referral - MESSENGER_CODE, ADS etc… + * @return source + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "MESSENGER_CODE", value = "The source of the referral - MESSENGER_CODE, ADS etc…") + @JsonProperty(JSON_PROPERTY_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSource() { + return source; + } + + + public void setSource(String source) { + this.source = source; + } + + + public ReferralDetails type(String type) { + + this.type = type; + return this; + } + + /** + * The type of referral, typically OPEN-THREAD. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "OPEN-THREAD", value = "The type of referral, typically OPEN-THREAD.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ReferralDetails adId(String adId) { + this.adId = JsonNullable.of(adId); + + return this; + } + + /** + * If the referral came from an ad, this field will be present with the ad’s Id. + * @return adId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "4216212847577", value = "If the referral came from an ad, this field will be present with the ad’s Id.") + @JsonIgnore + + public String getAdId() { + return adId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_AD_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAdId_JsonNullable() { + return adId; + } + + @JsonProperty(JSON_PROPERTY_AD_ID) + public void setAdId_JsonNullable(JsonNullable adId) { + this.adId = adId; + } + + public void setAdId(String adId) { + this.adId = JsonNullable.of(adId); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReferralDetails referralDetails = (ReferralDetails) o; + return Objects.equals(this.source, referralDetails.source) && + Objects.equals(this.type, referralDetails.type) && + Objects.equals(this.adId, referralDetails.adId); + } + + @Override + public int hashCode() { + return Objects.hash(source, type, adId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReferralDetails {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" adId: ").append(toIndentedString(adId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Reply.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Reply.java new file mode 100644 index 00000000..4314f32a --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Reply.java @@ -0,0 +1,240 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.zendesk.sunshine_conversations_client.model.Action; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Reply + */ +@JsonPropertyOrder({ + Reply.JSON_PROPERTY_TYPE, + Reply.JSON_PROPERTY_TEXT, + Reply.JSON_PROPERTY_PAYLOAD, + Reply.JSON_PROPERTY_METADATA, + Reply.JSON_PROPERTY_ICON_URL +}) + +public class Reply implements Action { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_TEXT = "text"; + private String text; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private String payload; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ICON_URL = "iconUrl"; + private String iconUrl; + + + public Reply type(String type) { + + this.type = type; + return this; + } + + /** + * The type of action. + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of action.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Reply text(String text) { + + this.text = text; + return this; + } + + /** + * The button text. Text longer than 20 characters will be truncated on Facebook Messenger, and longer than 40 characters will be truncated on Web Messenger, iOS, and Android. + * @return text + **/ + @ApiModelProperty(required = true, value = "The button text. Text longer than 20 characters will be truncated on Facebook Messenger, and longer than 40 characters will be truncated on Web Messenger, iOS, and Android.") + @JsonProperty(JSON_PROPERTY_TEXT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public Reply payload(String payload) { + + this.payload = payload; + return this; + } + + /** + * A string payload to help you identify the action context. Used when posting the reply. You can also use metadata for more complex needs. + * @return payload + **/ + @ApiModelProperty(required = true, value = "A string payload to help you identify the action context. Used when posting the reply. You can also use metadata for more complex needs.") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPayload() { + return payload; + } + + + public void setPayload(String payload) { + this.payload = payload; + } + + + public Reply metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + public Reply iconUrl(String iconUrl) { + + this.iconUrl = iconUrl; + return this; + } + + /** + * An icon to render next to the reply option. + * @return iconUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "An icon to render next to the reply option.") + @JsonProperty(JSON_PROPERTY_ICON_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getIconUrl() { + return iconUrl; + } + + + public void setIconUrl(String iconUrl) { + this.iconUrl = iconUrl; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Reply reply = (Reply) o; + return Objects.equals(this.type, reply.type) && + Objects.equals(this.text, reply.text) && + Objects.equals(this.payload, reply.payload) && + Objects.equals(this.metadata, reply.metadata) && + Objects.equals(this.iconUrl, reply.iconUrl); + } + + @Override + public int hashCode() { + return Objects.hash(type, text, payload, metadata, iconUrl); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Reply {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" iconUrl: ").append(toIndentedString(iconUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Source.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Source.java new file mode 100644 index 00000000..5f94d34a --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Source.java @@ -0,0 +1,312 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Client; +import com.zendesk.sunshine_conversations_client.model.Device; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The source of the message. + */ +@ApiModel(description = "The source of the message.") +@JsonPropertyOrder({ + Source.JSON_PROPERTY_TYPE, + Source.JSON_PROPERTY_INTEGRATION_ID, + Source.JSON_PROPERTY_ORIGINAL_MESSAGE_ID, + Source.JSON_PROPERTY_ORIGINAL_MESSAGE_TIMESTAMP, + Source.JSON_PROPERTY_CLIENT, + Source.JSON_PROPERTY_DEVICE +}) + +public class Source { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integrationId"; + private JsonNullable integrationId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ORIGINAL_MESSAGE_ID = "originalMessageId"; + private JsonNullable originalMessageId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ORIGINAL_MESSAGE_TIMESTAMP = "originalMessageTimestamp"; + private JsonNullable originalMessageTimestamp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CLIENT = "client"; + private JsonNullable client = JsonNullable.of(null); + + public static final String JSON_PROPERTY_DEVICE = "device"; + private JsonNullable device = JsonNullable.of(null); + + + public Source type(String type) { + + this.type = type; + return this; + } + + /** + * An identifier for the channel from which a message originated. May include one of api, sdk, messenger, or any number of other channels. + * @return type + **/ + @ApiModelProperty(example = "ios", required = true, value = "An identifier for the channel from which a message originated. May include one of api, sdk, messenger, or any number of other channels.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Source integrationId(String integrationId) { + this.integrationId = JsonNullable.of(integrationId); + + return this; + } + + /** + * Identifier indicating which integration the message was sent from. For user messages only. + * @return integrationId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "de13bee15b51033b34162411", value = "Identifier indicating which integration the message was sent from. For user messages only.") + @JsonIgnore + + public String getIntegrationId() { + return integrationId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getIntegrationId_JsonNullable() { + return integrationId; + } + + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + public void setIntegrationId_JsonNullable(JsonNullable integrationId) { + this.integrationId = integrationId; + } + + public void setIntegrationId(String integrationId) { + this.integrationId = JsonNullable.of(integrationId); + } + + + public Source originalMessageId(String originalMessageId) { + this.originalMessageId = JsonNullable.of(originalMessageId); + + return this; + } + + /** + * Message identifier assigned by the originating channel. + * @return originalMessageId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5f40256af057d0000dda9bd7", value = "Message identifier assigned by the originating channel.") + @JsonIgnore + + public String getOriginalMessageId() { + return originalMessageId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ORIGINAL_MESSAGE_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getOriginalMessageId_JsonNullable() { + return originalMessageId; + } + + @JsonProperty(JSON_PROPERTY_ORIGINAL_MESSAGE_ID) + public void setOriginalMessageId_JsonNullable(JsonNullable originalMessageId) { + this.originalMessageId = originalMessageId; + } + + public void setOriginalMessageId(String originalMessageId) { + this.originalMessageId = JsonNullable.of(originalMessageId); + } + + + public Source originalMessageTimestamp(String originalMessageTimestamp) { + this.originalMessageTimestamp = JsonNullable.of(originalMessageTimestamp); + + return this; + } + + /** + * A datetime string with the format `YYYY-MM-DDThh:mm:ss.SSSZ` representing when the third party channel received the message. + * @return originalMessageTimestamp + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2019-03-21T18:45:53.720Z", value = "A datetime string with the format `YYYY-MM-DDThh:mm:ss.SSSZ` representing when the third party channel received the message.") + @JsonIgnore + + public String getOriginalMessageTimestamp() { + return originalMessageTimestamp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ORIGINAL_MESSAGE_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getOriginalMessageTimestamp_JsonNullable() { + return originalMessageTimestamp; + } + + @JsonProperty(JSON_PROPERTY_ORIGINAL_MESSAGE_TIMESTAMP) + public void setOriginalMessageTimestamp_JsonNullable(JsonNullable originalMessageTimestamp) { + this.originalMessageTimestamp = originalMessageTimestamp; + } + + public void setOriginalMessageTimestamp(String originalMessageTimestamp) { + this.originalMessageTimestamp = JsonNullable.of(originalMessageTimestamp); + } + + + public Source client(Client client) { + this.client = JsonNullable.of(client); + + return this; + } + + /** + * The client from which the user authored the message or activity, if applicable. This field is not applicable in API responses, it is used only in webhook payloads if the `includeFullSource` option is enabled. + * @return client + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The client from which the user authored the message or activity, if applicable. This field is not applicable in API responses, it is used only in webhook payloads if the `includeFullSource` option is enabled.") + @JsonIgnore + + public Client getClient() { + return client.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CLIENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getClient_JsonNullable() { + return client; + } + + @JsonProperty(JSON_PROPERTY_CLIENT) + public void setClient_JsonNullable(JsonNullable client) { + this.client = client; + } + + public void setClient(Client client) { + this.client = JsonNullable.of(client); + } + + + public Source device(Device device) { + this.device = JsonNullable.of(device); + + return this; + } + + /** + * The device from which the user authored the message or activity, if applicable. This field is not applicable in API responses, it is used only in webhook payloads if the `includeFullSource` option is enabled. + * @return device + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The device from which the user authored the message or activity, if applicable. This field is not applicable in API responses, it is used only in webhook payloads if the `includeFullSource` option is enabled.") + @JsonIgnore + + public Device getDevice() { + return device.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DEVICE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDevice_JsonNullable() { + return device; + } + + @JsonProperty(JSON_PROPERTY_DEVICE) + public void setDevice_JsonNullable(JsonNullable device) { + this.device = device; + } + + public void setDevice(Device device) { + this.device = JsonNullable.of(device); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Source source = (Source) o; + return Objects.equals(this.type, source.type) && + Objects.equals(this.integrationId, source.integrationId) && + Objects.equals(this.originalMessageId, source.originalMessageId) && + Objects.equals(this.originalMessageTimestamp, source.originalMessageTimestamp) && + Objects.equals(this.client, source.client) && + Objects.equals(this.device, source.device); + } + + @Override + public int hashCode() { + return Objects.hash(type, integrationId, originalMessageId, originalMessageTimestamp, client, device); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Source {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" originalMessageId: ").append(toIndentedString(originalMessageId)).append("\n"); + sb.append(" originalMessageTimestamp: ").append(toIndentedString(originalMessageTimestamp)).append("\n"); + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append(" device: ").append(toIndentedString(device)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SourceWebhook.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SourceWebhook.java new file mode 100644 index 00000000..da348f41 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SourceWebhook.java @@ -0,0 +1,302 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Client; +import com.zendesk.sunshine_conversations_client.model.Device; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SourceWebhook + */ +@JsonPropertyOrder({ + SourceWebhook.JSON_PROPERTY_TYPE, + SourceWebhook.JSON_PROPERTY_INTEGRATION_ID, + SourceWebhook.JSON_PROPERTY_ORIGINAL_MESSAGE_ID, + SourceWebhook.JSON_PROPERTY_ORIGINAL_MESSAGE_TIMESTAMP, + SourceWebhook.JSON_PROPERTY_CLIENT, + SourceWebhook.JSON_PROPERTY_DEVICE +}) + +public class SourceWebhook { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integrationId"; + private String integrationId; + + public static final String JSON_PROPERTY_ORIGINAL_MESSAGE_ID = "originalMessageId"; + private JsonNullable originalMessageId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ORIGINAL_MESSAGE_TIMESTAMP = "originalMessageTimestamp"; + private JsonNullable originalMessageTimestamp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CLIENT = "client"; + private JsonNullable client = JsonNullable.of(null); + + public static final String JSON_PROPERTY_DEVICE = "device"; + private JsonNullable device = JsonNullable.of(null); + + + public SourceWebhook type(String type) { + + this.type = type; + return this; + } + + /** + * An identifier for the channel from which a message originated. May include one of api, sdk, messenger, or any number of other channels. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "ios", value = "An identifier for the channel from which a message originated. May include one of api, sdk, messenger, or any number of other channels.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public SourceWebhook integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * Identifier indicating which integration the message was sent from. For user messages only. + * @return integrationId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Identifier indicating which integration the message was sent from. For user messages only.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getIntegrationId() { + return integrationId; + } + + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + + public SourceWebhook originalMessageId(String originalMessageId) { + this.originalMessageId = JsonNullable.of(originalMessageId); + + return this; + } + + /** + * Message identifier assigned by the originating channel. + * @return originalMessageId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Message identifier assigned by the originating channel.") + @JsonIgnore + + public String getOriginalMessageId() { + return originalMessageId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ORIGINAL_MESSAGE_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getOriginalMessageId_JsonNullable() { + return originalMessageId; + } + + @JsonProperty(JSON_PROPERTY_ORIGINAL_MESSAGE_ID) + public void setOriginalMessageId_JsonNullable(JsonNullable originalMessageId) { + this.originalMessageId = originalMessageId; + } + + public void setOriginalMessageId(String originalMessageId) { + this.originalMessageId = JsonNullable.of(originalMessageId); + } + + + public SourceWebhook originalMessageTimestamp(String originalMessageTimestamp) { + this.originalMessageTimestamp = JsonNullable.of(originalMessageTimestamp); + + return this; + } + + /** + * A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing when the third-party channel received the message. + * @return originalMessageTimestamp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A datetime string with the format YYYY-MM-DDThh:mm:ss.SSSZ representing when the third-party channel received the message.") + @JsonIgnore + + public String getOriginalMessageTimestamp() { + return originalMessageTimestamp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ORIGINAL_MESSAGE_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getOriginalMessageTimestamp_JsonNullable() { + return originalMessageTimestamp; + } + + @JsonProperty(JSON_PROPERTY_ORIGINAL_MESSAGE_TIMESTAMP) + public void setOriginalMessageTimestamp_JsonNullable(JsonNullable originalMessageTimestamp) { + this.originalMessageTimestamp = originalMessageTimestamp; + } + + public void setOriginalMessageTimestamp(String originalMessageTimestamp) { + this.originalMessageTimestamp = JsonNullable.of(originalMessageTimestamp); + } + + + public SourceWebhook client(Client client) { + this.client = JsonNullable.of(client); + + return this; + } + + /** + * The client from which the user authored the message or activity, if applicable. This field will only be present if the `includeFullSource` option is enabled for the webhook. + * @return client + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The client from which the user authored the message or activity, if applicable. This field will only be present if the `includeFullSource` option is enabled for the webhook.") + @JsonIgnore + + public Client getClient() { + return client.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CLIENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getClient_JsonNullable() { + return client; + } + + @JsonProperty(JSON_PROPERTY_CLIENT) + public void setClient_JsonNullable(JsonNullable client) { + this.client = client; + } + + public void setClient(Client client) { + this.client = JsonNullable.of(client); + } + + + public SourceWebhook device(Device device) { + this.device = JsonNullable.of(device); + + return this; + } + + /** + * The device from which the user authored the message or activity, if applicable. This field will only be present if the `includeFullSource` option is enabled for the webhook + * @return device + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The device from which the user authored the message or activity, if applicable. This field will only be present if the `includeFullSource` option is enabled for the webhook") + @JsonIgnore + + public Device getDevice() { + return device.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DEVICE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDevice_JsonNullable() { + return device; + } + + @JsonProperty(JSON_PROPERTY_DEVICE) + public void setDevice_JsonNullable(JsonNullable device) { + this.device = device; + } + + public void setDevice(Device device) { + this.device = JsonNullable.of(device); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SourceWebhook sourceWebhook = (SourceWebhook) o; + return Objects.equals(this.type, sourceWebhook.type) && + Objects.equals(this.integrationId, sourceWebhook.integrationId) && + Objects.equals(this.originalMessageId, sourceWebhook.originalMessageId) && + Objects.equals(this.originalMessageTimestamp, sourceWebhook.originalMessageTimestamp) && + Objects.equals(this.client, sourceWebhook.client) && + Objects.equals(this.device, sourceWebhook.device); + } + + @Override + public int hashCode() { + return Objects.hash(type, integrationId, originalMessageId, originalMessageTimestamp, client, device); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SourceWebhook {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" originalMessageId: ").append(toIndentedString(originalMessageId)).append("\n"); + sb.append(" originalMessageTimestamp: ").append(toIndentedString(originalMessageTimestamp)).append("\n"); + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append(" device: ").append(toIndentedString(device)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Status.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Status.java new file mode 100644 index 00000000..b802e455 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Status.java @@ -0,0 +1,61 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import io.swagger.annotations.ApiModel; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * The status of the integration. + */ +public enum Status { + + INACTIVE("inactive"), + + ACTIVE("active"), + + ERROR("error"); + + private String value; + + Status(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static Status fromValue(String value) { + for (Status b : Status.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Switchboard.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Switchboard.java new file mode 100644 index 00000000..c5dd5417 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Switchboard.java @@ -0,0 +1,162 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Switchboard + */ +@JsonPropertyOrder({ + Switchboard.JSON_PROPERTY_ID, + Switchboard.JSON_PROPERTY_ENABLED, + Switchboard.JSON_PROPERTY_DEFAULT_SWITCHBOARD_INTEGRATION_ID +}) + +public class Switchboard { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_DEFAULT_SWITCHBOARD_INTEGRATION_ID = "defaultSwitchboardIntegrationId"; + private String defaultSwitchboardIntegrationId; + + + public Switchboard id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the switchboard. + * @return id + **/ + @ApiModelProperty(example = "5ef21b132f21af34f088530d", required = true, value = "The unique ID of the switchboard.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Switchboard enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Whether the switchboard is enabled. Allows creating the switchboard in a disabled state so that messages don't get lost or misrouted during switchboard configuration. When a switchboard is disabled, integrations linked to the switchboard will receive all events. + * @return enabled + **/ + @ApiModelProperty(required = true, value = "Whether the switchboard is enabled. Allows creating the switchboard in a disabled state so that messages don't get lost or misrouted during switchboard configuration. When a switchboard is disabled, integrations linked to the switchboard will receive all events.") + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Boolean getEnabled() { + return enabled; + } + + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + + public Switchboard defaultSwitchboardIntegrationId(String defaultSwitchboardIntegrationId) { + + this.defaultSwitchboardIntegrationId = defaultSwitchboardIntegrationId; + return this; + } + + /** + * The id of the switchboard integration that will be given control when a new conversation begins. It will also be used for conversations that existed before the switchboard was enabled. + * @return defaultSwitchboardIntegrationId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5ef21b132f21af34f088530e", value = "The id of the switchboard integration that will be given control when a new conversation begins. It will also be used for conversations that existed before the switchboard was enabled.") + @JsonProperty(JSON_PROPERTY_DEFAULT_SWITCHBOARD_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDefaultSwitchboardIntegrationId() { + return defaultSwitchboardIntegrationId; + } + + + public void setDefaultSwitchboardIntegrationId(String defaultSwitchboardIntegrationId) { + this.defaultSwitchboardIntegrationId = defaultSwitchboardIntegrationId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Switchboard switchboard = (Switchboard) o; + return Objects.equals(this.id, switchboard.id) && + Objects.equals(this.enabled, switchboard.enabled) && + Objects.equals(this.defaultSwitchboardIntegrationId, switchboard.defaultSwitchboardIntegrationId); + } + + @Override + public int hashCode() { + return Objects.hash(id, enabled, defaultSwitchboardIntegrationId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Switchboard {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" defaultSwitchboardIntegrationId: ").append(toIndentedString(defaultSwitchboardIntegrationId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControl.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControl.java new file mode 100644 index 00000000..08ee21f8 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControl.java @@ -0,0 +1,198 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.EventSubSchema; +import com.zendesk.sunshine_conversations_client.model.SwitchboardAcceptControlAllOf; +import com.zendesk.sunshine_conversations_client.model.SwitchboardAcceptControlAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardAcceptControl + */ +@JsonPropertyOrder({ + SwitchboardAcceptControl.JSON_PROPERTY_ID, + SwitchboardAcceptControl.JSON_PROPERTY_TYPE, + SwitchboardAcceptControl.JSON_PROPERTY_CREATED_AT, + SwitchboardAcceptControl.JSON_PROPERTY_PAYLOAD +}) + +public class SwitchboardAcceptControl { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private SwitchboardAcceptControlAllOfPayload payload; + + + public SwitchboardAcceptControl id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public SwitchboardAcceptControl type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public SwitchboardAcceptControl createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public SwitchboardAcceptControl payload(SwitchboardAcceptControlAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SwitchboardAcceptControlAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(SwitchboardAcceptControlAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardAcceptControl switchboardAcceptControl = (SwitchboardAcceptControl) o; + return Objects.equals(this.id, switchboardAcceptControl.id) && + Objects.equals(this.type, switchboardAcceptControl.type) && + Objects.equals(this.createdAt, switchboardAcceptControl.createdAt) && + Objects.equals(this.payload, switchboardAcceptControl.payload); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardAcceptControl {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControlAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControlAllOf.java new file mode 100644 index 00000000..ded26a3e --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControlAllOf.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.SwitchboardAcceptControlAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardAcceptControlAllOf + */ +@JsonPropertyOrder({ + SwitchboardAcceptControlAllOf.JSON_PROPERTY_PAYLOAD +}) + +public class SwitchboardAcceptControlAllOf { + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private SwitchboardAcceptControlAllOfPayload payload; + + + public SwitchboardAcceptControlAllOf payload(SwitchboardAcceptControlAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SwitchboardAcceptControlAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(SwitchboardAcceptControlAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardAcceptControlAllOf switchboardAcceptControlAllOf = (SwitchboardAcceptControlAllOf) o; + return Objects.equals(this.payload, switchboardAcceptControlAllOf.payload); + } + + @Override + public int hashCode() { + return Objects.hash(payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardAcceptControlAllOf {\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControlAllOfPayload.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControlAllOfPayload.java new file mode 100644 index 00000000..941f9326 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControlAllOfPayload.java @@ -0,0 +1,148 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationTruncated; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The payload of the event. The contents of this object depend on the type of event. + */ +@ApiModel(description = "The payload of the event. The contents of this object depend on the type of event.") +@JsonPropertyOrder({ + SwitchboardAcceptControlAllOfPayload.JSON_PROPERTY_CONVERSATION, + SwitchboardAcceptControlAllOfPayload.JSON_PROPERTY_METADATA +}) + +public class SwitchboardAcceptControlAllOfPayload { + public static final String JSON_PROPERTY_CONVERSATION = "conversation"; + private ConversationTruncated conversation = null; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public SwitchboardAcceptControlAllOfPayload conversation(ConversationTruncated conversation) { + + this.conversation = conversation; + return this; + } + + /** + * The conversation from which the switchboard event was fired. Will include an `activeSwitchboardIntegration` representing the integration that has just accepted control. + * @return conversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The conversation from which the switchboard event was fired. Will include an `activeSwitchboardIntegration` representing the integration that has just accepted control.") + @JsonProperty(JSON_PROPERTY_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationTruncated getConversation() { + return conversation; + } + + + public void setConversation(ConversationTruncated conversation) { + this.conversation = conversation; + } + + + public SwitchboardAcceptControlAllOfPayload metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardAcceptControlAllOfPayload switchboardAcceptControlAllOfPayload = (SwitchboardAcceptControlAllOfPayload) o; + return Objects.equals(this.conversation, switchboardAcceptControlAllOfPayload.conversation) && + Objects.equals(this.metadata, switchboardAcceptControlAllOfPayload.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(conversation, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardAcceptControlAllOfPayload {\n"); + sb.append(" conversation: ").append(toIndentedString(conversation)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControlFailure.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControlFailure.java new file mode 100644 index 00000000..25ecec33 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControlFailure.java @@ -0,0 +1,198 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.EventSubSchema; +import com.zendesk.sunshine_conversations_client.model.SwitchboardAcceptControlFailureAllOf; +import com.zendesk.sunshine_conversations_client.model.SwitchboardAcceptControlFailureAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardAcceptControlFailure + */ +@JsonPropertyOrder({ + SwitchboardAcceptControlFailure.JSON_PROPERTY_ID, + SwitchboardAcceptControlFailure.JSON_PROPERTY_TYPE, + SwitchboardAcceptControlFailure.JSON_PROPERTY_CREATED_AT, + SwitchboardAcceptControlFailure.JSON_PROPERTY_PAYLOAD +}) + +public class SwitchboardAcceptControlFailure { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private SwitchboardAcceptControlFailureAllOfPayload payload; + + + public SwitchboardAcceptControlFailure id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public SwitchboardAcceptControlFailure type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public SwitchboardAcceptControlFailure createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public SwitchboardAcceptControlFailure payload(SwitchboardAcceptControlFailureAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SwitchboardAcceptControlFailureAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(SwitchboardAcceptControlFailureAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardAcceptControlFailure switchboardAcceptControlFailure = (SwitchboardAcceptControlFailure) o; + return Objects.equals(this.id, switchboardAcceptControlFailure.id) && + Objects.equals(this.type, switchboardAcceptControlFailure.type) && + Objects.equals(this.createdAt, switchboardAcceptControlFailure.createdAt) && + Objects.equals(this.payload, switchboardAcceptControlFailure.payload); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardAcceptControlFailure {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControlFailureAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControlFailureAllOf.java new file mode 100644 index 00000000..e7ba5eaa --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControlFailureAllOf.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.SwitchboardAcceptControlFailureAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardAcceptControlFailureAllOf + */ +@JsonPropertyOrder({ + SwitchboardAcceptControlFailureAllOf.JSON_PROPERTY_PAYLOAD +}) + +public class SwitchboardAcceptControlFailureAllOf { + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private SwitchboardAcceptControlFailureAllOfPayload payload; + + + public SwitchboardAcceptControlFailureAllOf payload(SwitchboardAcceptControlFailureAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SwitchboardAcceptControlFailureAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(SwitchboardAcceptControlFailureAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardAcceptControlFailureAllOf switchboardAcceptControlFailureAllOf = (SwitchboardAcceptControlFailureAllOf) o; + return Objects.equals(this.payload, switchboardAcceptControlFailureAllOf.payload); + } + + @Override + public int hashCode() { + return Objects.hash(payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardAcceptControlFailureAllOf {\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControlFailureAllOfPayload.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControlFailureAllOfPayload.java new file mode 100644 index 00000000..751e0fe4 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardAcceptControlFailureAllOfPayload.java @@ -0,0 +1,179 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationTruncated; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The payload of the event. The contents of this object depend on the type of event. + */ +@ApiModel(description = "The payload of the event. The contents of this object depend on the type of event.") +@JsonPropertyOrder({ + SwitchboardAcceptControlFailureAllOfPayload.JSON_PROPERTY_ERROR, + SwitchboardAcceptControlFailureAllOfPayload.JSON_PROPERTY_CONVERSATION, + SwitchboardAcceptControlFailureAllOfPayload.JSON_PROPERTY_METADATA +}) + +public class SwitchboardAcceptControlFailureAllOfPayload { + public static final String JSON_PROPERTY_ERROR = "error"; + private Object error; + + public static final String JSON_PROPERTY_CONVERSATION = "conversation"; + private ConversationTruncated conversation = null; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public SwitchboardAcceptControlFailureAllOfPayload error(Object error) { + + this.error = error; + return this; + } + + /** + * Object containing details of what went wrong. + * @return error + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Object containing details of what went wrong.") + @JsonProperty(JSON_PROPERTY_ERROR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getError() { + return error; + } + + + public void setError(Object error) { + this.error = error; + } + + + public SwitchboardAcceptControlFailureAllOfPayload conversation(ConversationTruncated conversation) { + + this.conversation = conversation; + return this; + } + + /** + * The conversation from which the switchboard event was fired. + * @return conversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The conversation from which the switchboard event was fired.") + @JsonProperty(JSON_PROPERTY_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationTruncated getConversation() { + return conversation; + } + + + public void setConversation(ConversationTruncated conversation) { + this.conversation = conversation; + } + + + public SwitchboardAcceptControlFailureAllOfPayload metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardAcceptControlFailureAllOfPayload switchboardAcceptControlFailureAllOfPayload = (SwitchboardAcceptControlFailureAllOfPayload) o; + return Objects.equals(this.error, switchboardAcceptControlFailureAllOfPayload.error) && + Objects.equals(this.conversation, switchboardAcceptControlFailureAllOfPayload.conversation) && + Objects.equals(this.metadata, switchboardAcceptControlFailureAllOfPayload.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(error, conversation, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardAcceptControlFailureAllOfPayload {\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" conversation: ").append(toIndentedString(conversation)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegration.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegration.java new file mode 100644 index 00000000..5c6e1737 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegration.java @@ -0,0 +1,298 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardIntegration + */ +@JsonPropertyOrder({ + SwitchboardIntegration.JSON_PROPERTY_ID, + SwitchboardIntegration.JSON_PROPERTY_NAME, + SwitchboardIntegration.JSON_PROPERTY_INTEGRATION_ID, + SwitchboardIntegration.JSON_PROPERTY_INTEGRATION_TYPE, + SwitchboardIntegration.JSON_PROPERTY_DELIVER_STANDBY_EVENTS, + SwitchboardIntegration.JSON_PROPERTY_NEXT_SWITCHBOARD_INTEGRATION_ID, + SwitchboardIntegration.JSON_PROPERTY_MESSAGE_HISTORY_COUNT +}) + +public class SwitchboardIntegration { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integrationId"; + private String integrationId; + + public static final String JSON_PROPERTY_INTEGRATION_TYPE = "integrationType"; + private String integrationType; + + public static final String JSON_PROPERTY_DELIVER_STANDBY_EVENTS = "deliverStandbyEvents"; + private Boolean deliverStandbyEvents; + + public static final String JSON_PROPERTY_NEXT_SWITCHBOARD_INTEGRATION_ID = "nextSwitchboardIntegrationId"; + private String nextSwitchboardIntegrationId; + + public static final String JSON_PROPERTY_MESSAGE_HISTORY_COUNT = "messageHistoryCount"; + private JsonNullable messageHistoryCount = JsonNullable.undefined(); + + + public SwitchboardIntegration id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the switchboard integration. + * @return id + **/ + @ApiModelProperty(example = "5ef21b86e933b7355c11c604", required = true, value = "The unique ID of the switchboard integration.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public SwitchboardIntegration name(String name) { + + this.name = name; + return this; + } + + /** + * Identifier for use in control transfer protocols. Restricted to alphanumeric characters, `-` and `_`. + * @return name + **/ + @ApiModelProperty(example = "bot", required = true, value = "Identifier for use in control transfer protocols. Restricted to alphanumeric characters, `-` and `_`.") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public SwitchboardIntegration integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * Id of the integration that should deliver events routed by the switchboard. + * @return integrationId + **/ + @ApiModelProperty(example = "5ef21b86e933b7355c11c605", required = true, value = "Id of the integration that should deliver events routed by the switchboard.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getIntegrationId() { + return integrationId; + } + + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + + public SwitchboardIntegration integrationType(String integrationType) { + + this.integrationType = integrationType; + return this; + } + + /** + * Type of integration that should deliver events routed by the switchboard. If referencing an OAuth integration, the clientId issued by Sunshine Conversations during the OAuth partnership process will be the value of integrationType. + * @return integrationType + **/ + @ApiModelProperty(example = "zd:agentWorkspace", required = true, value = "Type of integration that should deliver events routed by the switchboard. If referencing an OAuth integration, the clientId issued by Sunshine Conversations during the OAuth partnership process will be the value of integrationType.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getIntegrationType() { + return integrationType; + } + + + public void setIntegrationType(String integrationType) { + this.integrationType = integrationType; + } + + + public SwitchboardIntegration deliverStandbyEvents(Boolean deliverStandbyEvents) { + + this.deliverStandbyEvents = deliverStandbyEvents; + return this; + } + + /** + * Setting to determine if webhooks should be sent when the switchboard integration is not in control of a conversation (standby status) + * @return deliverStandbyEvents + **/ + @ApiModelProperty(required = true, value = "Setting to determine if webhooks should be sent when the switchboard integration is not in control of a conversation (standby status)") + @JsonProperty(JSON_PROPERTY_DELIVER_STANDBY_EVENTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Boolean getDeliverStandbyEvents() { + return deliverStandbyEvents; + } + + + public void setDeliverStandbyEvents(Boolean deliverStandbyEvents) { + this.deliverStandbyEvents = deliverStandbyEvents; + } + + + public SwitchboardIntegration nextSwitchboardIntegrationId(String nextSwitchboardIntegrationId) { + + this.nextSwitchboardIntegrationId = nextSwitchboardIntegrationId; + return this; + } + + /** + * The switchboard integration id to which control of a conversation is passed / offered by default. + * @return nextSwitchboardIntegrationId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5ef21b86e933b7355c11c606", value = "The switchboard integration id to which control of a conversation is passed / offered by default.") + @JsonProperty(JSON_PROPERTY_NEXT_SWITCHBOARD_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getNextSwitchboardIntegrationId() { + return nextSwitchboardIntegrationId; + } + + + public void setNextSwitchboardIntegrationId(String nextSwitchboardIntegrationId) { + this.nextSwitchboardIntegrationId = nextSwitchboardIntegrationId; + } + + + public SwitchboardIntegration messageHistoryCount(Integer messageHistoryCount) { + this.messageHistoryCount = JsonNullable.of(messageHistoryCount); + + return this; + } + + /** + * Number of messages to include in the message history context. + * minimum: 1 + * maximum: 10 + * @return messageHistoryCount + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5", value = "Number of messages to include in the message history context.") + @JsonIgnore + + public Integer getMessageHistoryCount() { + return messageHistoryCount.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MESSAGE_HISTORY_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMessageHistoryCount_JsonNullable() { + return messageHistoryCount; + } + + @JsonProperty(JSON_PROPERTY_MESSAGE_HISTORY_COUNT) + public void setMessageHistoryCount_JsonNullable(JsonNullable messageHistoryCount) { + this.messageHistoryCount = messageHistoryCount; + } + + public void setMessageHistoryCount(Integer messageHistoryCount) { + this.messageHistoryCount = JsonNullable.of(messageHistoryCount); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardIntegration switchboardIntegration = (SwitchboardIntegration) o; + return Objects.equals(this.id, switchboardIntegration.id) && + Objects.equals(this.name, switchboardIntegration.name) && + Objects.equals(this.integrationId, switchboardIntegration.integrationId) && + Objects.equals(this.integrationType, switchboardIntegration.integrationType) && + Objects.equals(this.deliverStandbyEvents, switchboardIntegration.deliverStandbyEvents) && + Objects.equals(this.nextSwitchboardIntegrationId, switchboardIntegration.nextSwitchboardIntegrationId) && + Objects.equals(this.messageHistoryCount, switchboardIntegration.messageHistoryCount); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, integrationId, integrationType, deliverStandbyEvents, nextSwitchboardIntegrationId, messageHistoryCount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardIntegration {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" integrationType: ").append(toIndentedString(integrationType)).append("\n"); + sb.append(" deliverStandbyEvents: ").append(toIndentedString(deliverStandbyEvents)).append("\n"); + sb.append(" nextSwitchboardIntegrationId: ").append(toIndentedString(nextSwitchboardIntegrationId)).append("\n"); + sb.append(" messageHistoryCount: ").append(toIndentedString(messageHistoryCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegrationCreateBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegrationCreateBody.java new file mode 100644 index 00000000..ecb04093 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegrationCreateBody.java @@ -0,0 +1,281 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardIntegrationCreateBody + */ +@JsonPropertyOrder({ + SwitchboardIntegrationCreateBody.JSON_PROPERTY_NAME, + SwitchboardIntegrationCreateBody.JSON_PROPERTY_INTEGRATION_ID, + SwitchboardIntegrationCreateBody.JSON_PROPERTY_INTEGRATION_TYPE, + SwitchboardIntegrationCreateBody.JSON_PROPERTY_DELIVER_STANDBY_EVENTS, + SwitchboardIntegrationCreateBody.JSON_PROPERTY_NEXT_SWITCHBOARD_INTEGRATION_ID, + SwitchboardIntegrationCreateBody.JSON_PROPERTY_MESSAGE_HISTORY_COUNT +}) + +public class SwitchboardIntegrationCreateBody { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integrationId"; + private String integrationId = null; + + public static final String JSON_PROPERTY_INTEGRATION_TYPE = "integrationType"; + private String integrationType = null; + + public static final String JSON_PROPERTY_DELIVER_STANDBY_EVENTS = "deliverStandbyEvents"; + private Boolean deliverStandbyEvents = null; + + public static final String JSON_PROPERTY_NEXT_SWITCHBOARD_INTEGRATION_ID = "nextSwitchboardIntegrationId"; + private JsonNullable nextSwitchboardIntegrationId = JsonNullable.of(null); + + public static final String JSON_PROPERTY_MESSAGE_HISTORY_COUNT = "messageHistoryCount"; + private JsonNullable messageHistoryCount = JsonNullable.undefined(); + + + public SwitchboardIntegrationCreateBody name(String name) { + + this.name = name; + return this; + } + + /** + * Identifier for use in control transfer protocols. Restricted to alphanumeric characters, `-` and `_`. + * @return name + **/ + @ApiModelProperty(example = "bot", required = true, value = "Identifier for use in control transfer protocols. Restricted to alphanumeric characters, `-` and `_`.") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public SwitchboardIntegrationCreateBody integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * The id of the integration to link to the switchboard integration. Must be used when linking a custom integration. One of `integrationId` or `integrationType` must be provided. + * @return integrationId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The id of the integration to link to the switchboard integration. Must be used when linking a custom integration. One of `integrationId` or `integrationType` must be provided.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getIntegrationId() { + return integrationId; + } + + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + + public SwitchboardIntegrationCreateBody integrationType(String integrationType) { + + this.integrationType = integrationType; + return this; + } + + /** + * The type of the integration to link to the switchboard integration. Must be used when linking an OAuth integration. One of `integrationId` or `integrationType` must be provided. + * @return integrationType + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the integration to link to the switchboard integration. Must be used when linking an OAuth integration. One of `integrationId` or `integrationType` must be provided.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getIntegrationType() { + return integrationType; + } + + + public void setIntegrationType(String integrationType) { + this.integrationType = integrationType; + } + + + public SwitchboardIntegrationCreateBody deliverStandbyEvents(Boolean deliverStandbyEvents) { + + this.deliverStandbyEvents = deliverStandbyEvents; + return this; + } + + /** + * Get deliverStandbyEvents + * @return deliverStandbyEvents + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DELIVER_STANDBY_EVENTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getDeliverStandbyEvents() { + return deliverStandbyEvents; + } + + + public void setDeliverStandbyEvents(Boolean deliverStandbyEvents) { + this.deliverStandbyEvents = deliverStandbyEvents; + } + + + public SwitchboardIntegrationCreateBody nextSwitchboardIntegrationId(String nextSwitchboardIntegrationId) { + this.nextSwitchboardIntegrationId = JsonNullable.of(nextSwitchboardIntegrationId); + + return this; + } + + /** + * Get nextSwitchboardIntegrationId + * @return nextSwitchboardIntegrationId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public String getNextSwitchboardIntegrationId() { + return nextSwitchboardIntegrationId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NEXT_SWITCHBOARD_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNextSwitchboardIntegrationId_JsonNullable() { + return nextSwitchboardIntegrationId; + } + + @JsonProperty(JSON_PROPERTY_NEXT_SWITCHBOARD_INTEGRATION_ID) + public void setNextSwitchboardIntegrationId_JsonNullable(JsonNullable nextSwitchboardIntegrationId) { + this.nextSwitchboardIntegrationId = nextSwitchboardIntegrationId; + } + + public void setNextSwitchboardIntegrationId(String nextSwitchboardIntegrationId) { + this.nextSwitchboardIntegrationId = JsonNullable.of(nextSwitchboardIntegrationId); + } + + + public SwitchboardIntegrationCreateBody messageHistoryCount(Integer messageHistoryCount) { + this.messageHistoryCount = JsonNullable.of(messageHistoryCount); + + return this; + } + + /** + * Number of messages to include in the message history context. + * minimum: 1 + * maximum: 10 + * @return messageHistoryCount + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5", value = "Number of messages to include in the message history context.") + @JsonIgnore + + public Integer getMessageHistoryCount() { + return messageHistoryCount.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MESSAGE_HISTORY_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMessageHistoryCount_JsonNullable() { + return messageHistoryCount; + } + + @JsonProperty(JSON_PROPERTY_MESSAGE_HISTORY_COUNT) + public void setMessageHistoryCount_JsonNullable(JsonNullable messageHistoryCount) { + this.messageHistoryCount = messageHistoryCount; + } + + public void setMessageHistoryCount(Integer messageHistoryCount) { + this.messageHistoryCount = JsonNullable.of(messageHistoryCount); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardIntegrationCreateBody switchboardIntegrationCreateBody = (SwitchboardIntegrationCreateBody) o; + return Objects.equals(this.name, switchboardIntegrationCreateBody.name) && + Objects.equals(this.integrationId, switchboardIntegrationCreateBody.integrationId) && + Objects.equals(this.integrationType, switchboardIntegrationCreateBody.integrationType) && + Objects.equals(this.deliverStandbyEvents, switchboardIntegrationCreateBody.deliverStandbyEvents) && + Objects.equals(this.nextSwitchboardIntegrationId, switchboardIntegrationCreateBody.nextSwitchboardIntegrationId) && + Objects.equals(this.messageHistoryCount, switchboardIntegrationCreateBody.messageHistoryCount); + } + + @Override + public int hashCode() { + return Objects.hash(name, integrationId, integrationType, deliverStandbyEvents, nextSwitchboardIntegrationId, messageHistoryCount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardIntegrationCreateBody {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" integrationType: ").append(toIndentedString(integrationType)).append("\n"); + sb.append(" deliverStandbyEvents: ").append(toIndentedString(deliverStandbyEvents)).append("\n"); + sb.append(" nextSwitchboardIntegrationId: ").append(toIndentedString(nextSwitchboardIntegrationId)).append("\n"); + sb.append(" messageHistoryCount: ").append(toIndentedString(messageHistoryCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegrationListResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegrationListResponse.java new file mode 100644 index 00000000..0fd7e160 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegrationListResponse.java @@ -0,0 +1,113 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.SwitchboardIntegration; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardIntegrationListResponse + */ +@JsonPropertyOrder({ + SwitchboardIntegrationListResponse.JSON_PROPERTY_SWITCHBOARD_INTEGRATIONS +}) + +public class SwitchboardIntegrationListResponse { + public static final String JSON_PROPERTY_SWITCHBOARD_INTEGRATIONS = "switchboardIntegrations"; + private List switchboardIntegrations = null; + + + public SwitchboardIntegrationListResponse switchboardIntegrations(List switchboardIntegrations) { + + this.switchboardIntegrations = switchboardIntegrations; + return this; + } + + public SwitchboardIntegrationListResponse addSwitchboardIntegrationsItem(SwitchboardIntegration switchboardIntegrationsItem) { + if (this.switchboardIntegrations == null) { + this.switchboardIntegrations = new ArrayList(); + } + this.switchboardIntegrations.add(switchboardIntegrationsItem); + return this; + } + + /** + * List of returned switchboard integrations. + * @return switchboardIntegrations + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of returned switchboard integrations.") + @JsonProperty(JSON_PROPERTY_SWITCHBOARD_INTEGRATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getSwitchboardIntegrations() { + return switchboardIntegrations; + } + + + public void setSwitchboardIntegrations(List switchboardIntegrations) { + this.switchboardIntegrations = switchboardIntegrations; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardIntegrationListResponse switchboardIntegrationListResponse = (SwitchboardIntegrationListResponse) o; + return Objects.equals(this.switchboardIntegrations, switchboardIntegrationListResponse.switchboardIntegrations); + } + + @Override + public int hashCode() { + return Objects.hash(switchboardIntegrations); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardIntegrationListResponse {\n"); + sb.append(" switchboardIntegrations: ").append(toIndentedString(switchboardIntegrations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegrationResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegrationResponse.java new file mode 100644 index 00000000..7153ef93 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegrationResponse.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.SwitchboardIntegration; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardIntegrationResponse + */ +@JsonPropertyOrder({ + SwitchboardIntegrationResponse.JSON_PROPERTY_SWITCHBOARD_INTEGRATION +}) + +public class SwitchboardIntegrationResponse { + public static final String JSON_PROPERTY_SWITCHBOARD_INTEGRATION = "switchboardIntegration"; + private SwitchboardIntegration switchboardIntegration = null; + + + public SwitchboardIntegrationResponse switchboardIntegration(SwitchboardIntegration switchboardIntegration) { + + this.switchboardIntegration = switchboardIntegration; + return this; + } + + /** + * The switchboard integration. + * @return switchboardIntegration + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The switchboard integration.") + @JsonProperty(JSON_PROPERTY_SWITCHBOARD_INTEGRATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SwitchboardIntegration getSwitchboardIntegration() { + return switchboardIntegration; + } + + + public void setSwitchboardIntegration(SwitchboardIntegration switchboardIntegration) { + this.switchboardIntegration = switchboardIntegration; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardIntegrationResponse switchboardIntegrationResponse = (SwitchboardIntegrationResponse) o; + return Objects.equals(this.switchboardIntegration, switchboardIntegrationResponse.switchboardIntegration); + } + + @Override + public int hashCode() { + return Objects.hash(switchboardIntegration); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardIntegrationResponse {\n"); + sb.append(" switchboardIntegration: ").append(toIndentedString(switchboardIntegration)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegrationUpdateBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegrationUpdateBody.java new file mode 100644 index 00000000..c99e4753 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegrationUpdateBody.java @@ -0,0 +1,282 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardIntegrationUpdateBody + */ +@JsonPropertyOrder({ + SwitchboardIntegrationUpdateBody.JSON_PROPERTY_NAME, + SwitchboardIntegrationUpdateBody.JSON_PROPERTY_INTEGRATION_ID, + SwitchboardIntegrationUpdateBody.JSON_PROPERTY_INTEGRATION_TYPE, + SwitchboardIntegrationUpdateBody.JSON_PROPERTY_DELIVER_STANDBY_EVENTS, + SwitchboardIntegrationUpdateBody.JSON_PROPERTY_NEXT_SWITCHBOARD_INTEGRATION_ID, + SwitchboardIntegrationUpdateBody.JSON_PROPERTY_MESSAGE_HISTORY_COUNT +}) + +public class SwitchboardIntegrationUpdateBody { + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integrationId"; + private String integrationId = null; + + public static final String JSON_PROPERTY_INTEGRATION_TYPE = "integrationType"; + private String integrationType = null; + + public static final String JSON_PROPERTY_DELIVER_STANDBY_EVENTS = "deliverStandbyEvents"; + private Boolean deliverStandbyEvents; + + public static final String JSON_PROPERTY_NEXT_SWITCHBOARD_INTEGRATION_ID = "nextSwitchboardIntegrationId"; + private JsonNullable nextSwitchboardIntegrationId = JsonNullable.of(null); + + public static final String JSON_PROPERTY_MESSAGE_HISTORY_COUNT = "messageHistoryCount"; + private JsonNullable messageHistoryCount = JsonNullable.undefined(); + + + public SwitchboardIntegrationUpdateBody name(String name) { + + this.name = name; + return this; + } + + /** + * Identifier for use in control transfer protocols. Restricted to alphanumeric characters, `-` and `_`. + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "bot", value = "Identifier for use in control transfer protocols. Restricted to alphanumeric characters, `-` and `_`.") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public SwitchboardIntegrationUpdateBody integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * The id of the integration to link to the switchboard integration. Must be used when linking a custom integration. Can't provide both `integrationId` and `integrationType`. + * @return integrationId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The id of the integration to link to the switchboard integration. Must be used when linking a custom integration. Can't provide both `integrationId` and `integrationType`.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getIntegrationId() { + return integrationId; + } + + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + + public SwitchboardIntegrationUpdateBody integrationType(String integrationType) { + + this.integrationType = integrationType; + return this; + } + + /** + * The type of the integration to link to the switchboard integration. Must be used when linking an OAuth integration. Can't provide both `integrationId` and `integrationType`. + * @return integrationType + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the integration to link to the switchboard integration. Must be used when linking an OAuth integration. Can't provide both `integrationId` and `integrationType`.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getIntegrationType() { + return integrationType; + } + + + public void setIntegrationType(String integrationType) { + this.integrationType = integrationType; + } + + + public SwitchboardIntegrationUpdateBody deliverStandbyEvents(Boolean deliverStandbyEvents) { + + this.deliverStandbyEvents = deliverStandbyEvents; + return this; + } + + /** + * Setting to determine if webhooks should be sent when the switchboard integration is not in control of a conversation (standby status) + * @return deliverStandbyEvents + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Setting to determine if webhooks should be sent when the switchboard integration is not in control of a conversation (standby status)") + @JsonProperty(JSON_PROPERTY_DELIVER_STANDBY_EVENTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getDeliverStandbyEvents() { + return deliverStandbyEvents; + } + + + public void setDeliverStandbyEvents(Boolean deliverStandbyEvents) { + this.deliverStandbyEvents = deliverStandbyEvents; + } + + + public SwitchboardIntegrationUpdateBody nextSwitchboardIntegrationId(String nextSwitchboardIntegrationId) { + this.nextSwitchboardIntegrationId = JsonNullable.of(nextSwitchboardIntegrationId); + + return this; + } + + /** + * Get nextSwitchboardIntegrationId + * @return nextSwitchboardIntegrationId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public String getNextSwitchboardIntegrationId() { + return nextSwitchboardIntegrationId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NEXT_SWITCHBOARD_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNextSwitchboardIntegrationId_JsonNullable() { + return nextSwitchboardIntegrationId; + } + + @JsonProperty(JSON_PROPERTY_NEXT_SWITCHBOARD_INTEGRATION_ID) + public void setNextSwitchboardIntegrationId_JsonNullable(JsonNullable nextSwitchboardIntegrationId) { + this.nextSwitchboardIntegrationId = nextSwitchboardIntegrationId; + } + + public void setNextSwitchboardIntegrationId(String nextSwitchboardIntegrationId) { + this.nextSwitchboardIntegrationId = JsonNullable.of(nextSwitchboardIntegrationId); + } + + + public SwitchboardIntegrationUpdateBody messageHistoryCount(Integer messageHistoryCount) { + this.messageHistoryCount = JsonNullable.of(messageHistoryCount); + + return this; + } + + /** + * Number of messages to include in the message history context. + * minimum: 1 + * maximum: 10 + * @return messageHistoryCount + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5", value = "Number of messages to include in the message history context.") + @JsonIgnore + + public Integer getMessageHistoryCount() { + return messageHistoryCount.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MESSAGE_HISTORY_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMessageHistoryCount_JsonNullable() { + return messageHistoryCount; + } + + @JsonProperty(JSON_PROPERTY_MESSAGE_HISTORY_COUNT) + public void setMessageHistoryCount_JsonNullable(JsonNullable messageHistoryCount) { + this.messageHistoryCount = messageHistoryCount; + } + + public void setMessageHistoryCount(Integer messageHistoryCount) { + this.messageHistoryCount = JsonNullable.of(messageHistoryCount); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardIntegrationUpdateBody switchboardIntegrationUpdateBody = (SwitchboardIntegrationUpdateBody) o; + return Objects.equals(this.name, switchboardIntegrationUpdateBody.name) && + Objects.equals(this.integrationId, switchboardIntegrationUpdateBody.integrationId) && + Objects.equals(this.integrationType, switchboardIntegrationUpdateBody.integrationType) && + Objects.equals(this.deliverStandbyEvents, switchboardIntegrationUpdateBody.deliverStandbyEvents) && + Objects.equals(this.nextSwitchboardIntegrationId, switchboardIntegrationUpdateBody.nextSwitchboardIntegrationId) && + Objects.equals(this.messageHistoryCount, switchboardIntegrationUpdateBody.messageHistoryCount); + } + + @Override + public int hashCode() { + return Objects.hash(name, integrationId, integrationType, deliverStandbyEvents, nextSwitchboardIntegrationId, messageHistoryCount); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardIntegrationUpdateBody {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" integrationType: ").append(toIndentedString(integrationType)).append("\n"); + sb.append(" deliverStandbyEvents: ").append(toIndentedString(deliverStandbyEvents)).append("\n"); + sb.append(" nextSwitchboardIntegrationId: ").append(toIndentedString(nextSwitchboardIntegrationId)).append("\n"); + sb.append(" messageHistoryCount: ").append(toIndentedString(messageHistoryCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegrationWebhook.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegrationWebhook.java new file mode 100644 index 00000000..ce053c50 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardIntegrationWebhook.java @@ -0,0 +1,195 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardIntegrationWebhook + */ +@JsonPropertyOrder({ + SwitchboardIntegrationWebhook.JSON_PROPERTY_ID, + SwitchboardIntegrationWebhook.JSON_PROPERTY_NAME, + SwitchboardIntegrationWebhook.JSON_PROPERTY_INTEGRATION_ID, + SwitchboardIntegrationWebhook.JSON_PROPERTY_INTEGRATION_TYPE +}) + +public class SwitchboardIntegrationWebhook { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integrationId"; + private String integrationId; + + public static final String JSON_PROPERTY_INTEGRATION_TYPE = "integrationType"; + private String integrationType; + + + public SwitchboardIntegrationWebhook id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the switchboard integration. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5ef21b86e933b7355c11c604", value = "The unique ID of the switchboard integration.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public SwitchboardIntegrationWebhook name(String name) { + + this.name = name; + return this; + } + + /** + * Identifier for use in control transfer protocols. Restricted to alphanumeric characters, `-` and `_`. + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "bot", value = "Identifier for use in control transfer protocols. Restricted to alphanumeric characters, `-` and `_`.") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public SwitchboardIntegrationWebhook integrationId(String integrationId) { + + this.integrationId = integrationId; + return this; + } + + /** + * Id of the integration that should deliver events routed by the switchboard. + * @return integrationId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5ef21b86e933b7355c11c605", value = "Id of the integration that should deliver events routed by the switchboard.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getIntegrationId() { + return integrationId; + } + + + public void setIntegrationId(String integrationId) { + this.integrationId = integrationId; + } + + + public SwitchboardIntegrationWebhook integrationType(String integrationType) { + + this.integrationType = integrationType; + return this; + } + + /** + * Type of integration that should deliver events routed by the switchboard. If referencing an OAuth integration, the clientId issued by Sunshine Conversations during the OAuth partnership process will be the value of integrationType. + * @return integrationType + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "zd:agentWorkspace", value = "Type of integration that should deliver events routed by the switchboard. If referencing an OAuth integration, the clientId issued by Sunshine Conversations during the OAuth partnership process will be the value of integrationType.") + @JsonProperty(JSON_PROPERTY_INTEGRATION_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getIntegrationType() { + return integrationType; + } + + + public void setIntegrationType(String integrationType) { + this.integrationType = integrationType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardIntegrationWebhook switchboardIntegrationWebhook = (SwitchboardIntegrationWebhook) o; + return Objects.equals(this.id, switchboardIntegrationWebhook.id) && + Objects.equals(this.name, switchboardIntegrationWebhook.name) && + Objects.equals(this.integrationId, switchboardIntegrationWebhook.integrationId) && + Objects.equals(this.integrationType, switchboardIntegrationWebhook.integrationType); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, integrationId, integrationType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardIntegrationWebhook {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" integrationType: ").append(toIndentedString(integrationType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardListResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardListResponse.java new file mode 100644 index 00000000..4e47a1e6 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardListResponse.java @@ -0,0 +1,113 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Switchboard; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardListResponse + */ +@JsonPropertyOrder({ + SwitchboardListResponse.JSON_PROPERTY_SWITCHBOARDS +}) + +public class SwitchboardListResponse { + public static final String JSON_PROPERTY_SWITCHBOARDS = "switchboards"; + private List switchboards = null; + + + public SwitchboardListResponse switchboards(List switchboards) { + + this.switchboards = switchboards; + return this; + } + + public SwitchboardListResponse addSwitchboardsItem(Switchboard switchboardsItem) { + if (this.switchboards == null) { + this.switchboards = new ArrayList(); + } + this.switchboards.add(switchboardsItem); + return this; + } + + /** + * List of returned switchboards. + * @return switchboards + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of returned switchboards.") + @JsonProperty(JSON_PROPERTY_SWITCHBOARDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getSwitchboards() { + return switchboards; + } + + + public void setSwitchboards(List switchboards) { + this.switchboards = switchboards; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardListResponse switchboardListResponse = (SwitchboardListResponse) o; + return Objects.equals(this.switchboards, switchboardListResponse.switchboards); + } + + @Override + public int hashCode() { + return Objects.hash(switchboards); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardListResponse {\n"); + sb.append(" switchboards: ").append(toIndentedString(switchboards)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardOfferControl.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardOfferControl.java new file mode 100644 index 00000000..56721bbe --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardOfferControl.java @@ -0,0 +1,198 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.EventSubSchema; +import com.zendesk.sunshine_conversations_client.model.SwitchboardOfferControlAllOf; +import com.zendesk.sunshine_conversations_client.model.SwitchboardOfferControlAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardOfferControl + */ +@JsonPropertyOrder({ + SwitchboardOfferControl.JSON_PROPERTY_ID, + SwitchboardOfferControl.JSON_PROPERTY_TYPE, + SwitchboardOfferControl.JSON_PROPERTY_CREATED_AT, + SwitchboardOfferControl.JSON_PROPERTY_PAYLOAD +}) + +public class SwitchboardOfferControl { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private SwitchboardOfferControlAllOfPayload payload; + + + public SwitchboardOfferControl id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public SwitchboardOfferControl type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public SwitchboardOfferControl createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public SwitchboardOfferControl payload(SwitchboardOfferControlAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SwitchboardOfferControlAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(SwitchboardOfferControlAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardOfferControl switchboardOfferControl = (SwitchboardOfferControl) o; + return Objects.equals(this.id, switchboardOfferControl.id) && + Objects.equals(this.type, switchboardOfferControl.type) && + Objects.equals(this.createdAt, switchboardOfferControl.createdAt) && + Objects.equals(this.payload, switchboardOfferControl.payload); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardOfferControl {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardOfferControlAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardOfferControlAllOf.java new file mode 100644 index 00000000..94aa4b8a --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardOfferControlAllOf.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.SwitchboardOfferControlAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardOfferControlAllOf + */ +@JsonPropertyOrder({ + SwitchboardOfferControlAllOf.JSON_PROPERTY_PAYLOAD +}) + +public class SwitchboardOfferControlAllOf { + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private SwitchboardOfferControlAllOfPayload payload; + + + public SwitchboardOfferControlAllOf payload(SwitchboardOfferControlAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SwitchboardOfferControlAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(SwitchboardOfferControlAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardOfferControlAllOf switchboardOfferControlAllOf = (SwitchboardOfferControlAllOf) o; + return Objects.equals(this.payload, switchboardOfferControlAllOf.payload); + } + + @Override + public int hashCode() { + return Objects.hash(payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardOfferControlAllOf {\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardOfferControlAllOfPayload.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardOfferControlAllOfPayload.java new file mode 100644 index 00000000..d786dc4c --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardOfferControlAllOfPayload.java @@ -0,0 +1,148 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationTruncated; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The payload of the event. The contents of this object depend on the type of event. + */ +@ApiModel(description = "The payload of the event. The contents of this object depend on the type of event.") +@JsonPropertyOrder({ + SwitchboardOfferControlAllOfPayload.JSON_PROPERTY_CONVERSATION, + SwitchboardOfferControlAllOfPayload.JSON_PROPERTY_METADATA +}) + +public class SwitchboardOfferControlAllOfPayload { + public static final String JSON_PROPERTY_CONVERSATION = "conversation"; + private ConversationTruncated conversation = null; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public SwitchboardOfferControlAllOfPayload conversation(ConversationTruncated conversation) { + + this.conversation = conversation; + return this; + } + + /** + * The conversation from which the switchboard event was fired. On success, the payload will include an `activeSwitchboardIntegration`, representing the integration from which control is being offered, and a `pendingSwitchboardIntegration`, representing the integration being offered control. + * @return conversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The conversation from which the switchboard event was fired. On success, the payload will include an `activeSwitchboardIntegration`, representing the integration from which control is being offered, and a `pendingSwitchboardIntegration`, representing the integration being offered control.") + @JsonProperty(JSON_PROPERTY_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationTruncated getConversation() { + return conversation; + } + + + public void setConversation(ConversationTruncated conversation) { + this.conversation = conversation; + } + + + public SwitchboardOfferControlAllOfPayload metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardOfferControlAllOfPayload switchboardOfferControlAllOfPayload = (SwitchboardOfferControlAllOfPayload) o; + return Objects.equals(this.conversation, switchboardOfferControlAllOfPayload.conversation) && + Objects.equals(this.metadata, switchboardOfferControlAllOfPayload.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(conversation, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardOfferControlAllOfPayload {\n"); + sb.append(" conversation: ").append(toIndentedString(conversation)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardOfferControlFailure.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardOfferControlFailure.java new file mode 100644 index 00000000..fd091c63 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardOfferControlFailure.java @@ -0,0 +1,198 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.EventSubSchema; +import com.zendesk.sunshine_conversations_client.model.SwitchboardAcceptControlFailureAllOf; +import com.zendesk.sunshine_conversations_client.model.SwitchboardAcceptControlFailureAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardOfferControlFailure + */ +@JsonPropertyOrder({ + SwitchboardOfferControlFailure.JSON_PROPERTY_ID, + SwitchboardOfferControlFailure.JSON_PROPERTY_TYPE, + SwitchboardOfferControlFailure.JSON_PROPERTY_CREATED_AT, + SwitchboardOfferControlFailure.JSON_PROPERTY_PAYLOAD +}) + +public class SwitchboardOfferControlFailure { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private SwitchboardAcceptControlFailureAllOfPayload payload; + + + public SwitchboardOfferControlFailure id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public SwitchboardOfferControlFailure type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public SwitchboardOfferControlFailure createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public SwitchboardOfferControlFailure payload(SwitchboardAcceptControlFailureAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SwitchboardAcceptControlFailureAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(SwitchboardAcceptControlFailureAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardOfferControlFailure switchboardOfferControlFailure = (SwitchboardOfferControlFailure) o; + return Objects.equals(this.id, switchboardOfferControlFailure.id) && + Objects.equals(this.type, switchboardOfferControlFailure.type) && + Objects.equals(this.createdAt, switchboardOfferControlFailure.createdAt) && + Objects.equals(this.payload, switchboardOfferControlFailure.payload); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardOfferControlFailure {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardPassControl.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardPassControl.java new file mode 100644 index 00000000..bfbc8202 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardPassControl.java @@ -0,0 +1,198 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.EventSubSchema; +import com.zendesk.sunshine_conversations_client.model.SwitchboardPassControlAllOf; +import com.zendesk.sunshine_conversations_client.model.SwitchboardPassControlAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardPassControl + */ +@JsonPropertyOrder({ + SwitchboardPassControl.JSON_PROPERTY_ID, + SwitchboardPassControl.JSON_PROPERTY_TYPE, + SwitchboardPassControl.JSON_PROPERTY_CREATED_AT, + SwitchboardPassControl.JSON_PROPERTY_PAYLOAD +}) + +public class SwitchboardPassControl { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private SwitchboardPassControlAllOfPayload payload; + + + public SwitchboardPassControl id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public SwitchboardPassControl type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public SwitchboardPassControl createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public SwitchboardPassControl payload(SwitchboardPassControlAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SwitchboardPassControlAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(SwitchboardPassControlAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardPassControl switchboardPassControl = (SwitchboardPassControl) o; + return Objects.equals(this.id, switchboardPassControl.id) && + Objects.equals(this.type, switchboardPassControl.type) && + Objects.equals(this.createdAt, switchboardPassControl.createdAt) && + Objects.equals(this.payload, switchboardPassControl.payload); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardPassControl {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardPassControlAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardPassControlAllOf.java new file mode 100644 index 00000000..eed1c811 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardPassControlAllOf.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.SwitchboardPassControlAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardPassControlAllOf + */ +@JsonPropertyOrder({ + SwitchboardPassControlAllOf.JSON_PROPERTY_PAYLOAD +}) + +public class SwitchboardPassControlAllOf { + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private SwitchboardPassControlAllOfPayload payload; + + + public SwitchboardPassControlAllOf payload(SwitchboardPassControlAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SwitchboardPassControlAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(SwitchboardPassControlAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardPassControlAllOf switchboardPassControlAllOf = (SwitchboardPassControlAllOf) o; + return Objects.equals(this.payload, switchboardPassControlAllOf.payload); + } + + @Override + public int hashCode() { + return Objects.hash(payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardPassControlAllOf {\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardPassControlAllOfPayload.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardPassControlAllOfPayload.java new file mode 100644 index 00000000..1d43426e --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardPassControlAllOfPayload.java @@ -0,0 +1,148 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationTruncated; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The payload of the event. The contents of this object depend on the type of event. + */ +@ApiModel(description = "The payload of the event. The contents of this object depend on the type of event.") +@JsonPropertyOrder({ + SwitchboardPassControlAllOfPayload.JSON_PROPERTY_CONVERSATION, + SwitchboardPassControlAllOfPayload.JSON_PROPERTY_METADATA +}) + +public class SwitchboardPassControlAllOfPayload { + public static final String JSON_PROPERTY_CONVERSATION = "conversation"; + private ConversationTruncated conversation = null; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public SwitchboardPassControlAllOfPayload conversation(ConversationTruncated conversation) { + + this.conversation = conversation; + return this; + } + + /** + * The conversation from which the switchboard event was fired. On success, the payload will include an `activeSwitchboardIntegration`, representing the switchboard integration that is now in control of the conversation. + * @return conversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The conversation from which the switchboard event was fired. On success, the payload will include an `activeSwitchboardIntegration`, representing the switchboard integration that is now in control of the conversation.") + @JsonProperty(JSON_PROPERTY_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationTruncated getConversation() { + return conversation; + } + + + public void setConversation(ConversationTruncated conversation) { + this.conversation = conversation; + } + + + public SwitchboardPassControlAllOfPayload metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardPassControlAllOfPayload switchboardPassControlAllOfPayload = (SwitchboardPassControlAllOfPayload) o; + return Objects.equals(this.conversation, switchboardPassControlAllOfPayload.conversation) && + Objects.equals(this.metadata, switchboardPassControlAllOfPayload.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(conversation, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardPassControlAllOfPayload {\n"); + sb.append(" conversation: ").append(toIndentedString(conversation)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardPassControlFailure.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardPassControlFailure.java new file mode 100644 index 00000000..46740772 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardPassControlFailure.java @@ -0,0 +1,198 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.EventSubSchema; +import com.zendesk.sunshine_conversations_client.model.SwitchboardAcceptControlFailureAllOf; +import com.zendesk.sunshine_conversations_client.model.SwitchboardAcceptControlFailureAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardPassControlFailure + */ +@JsonPropertyOrder({ + SwitchboardPassControlFailure.JSON_PROPERTY_ID, + SwitchboardPassControlFailure.JSON_PROPERTY_TYPE, + SwitchboardPassControlFailure.JSON_PROPERTY_CREATED_AT, + SwitchboardPassControlFailure.JSON_PROPERTY_PAYLOAD +}) + +public class SwitchboardPassControlFailure { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private SwitchboardAcceptControlFailureAllOfPayload payload; + + + public SwitchboardPassControlFailure id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public SwitchboardPassControlFailure type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public SwitchboardPassControlFailure createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public SwitchboardPassControlFailure payload(SwitchboardAcceptControlFailureAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SwitchboardAcceptControlFailureAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(SwitchboardAcceptControlFailureAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardPassControlFailure switchboardPassControlFailure = (SwitchboardPassControlFailure) o; + return Objects.equals(this.id, switchboardPassControlFailure.id) && + Objects.equals(this.type, switchboardPassControlFailure.type) && + Objects.equals(this.createdAt, switchboardPassControlFailure.createdAt) && + Objects.equals(this.payload, switchboardPassControlFailure.payload); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardPassControlFailure {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardResponse.java new file mode 100644 index 00000000..05c2bb12 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardResponse.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Switchboard; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardResponse + */ +@JsonPropertyOrder({ + SwitchboardResponse.JSON_PROPERTY_SWITCHBOARD +}) + +public class SwitchboardResponse { + public static final String JSON_PROPERTY_SWITCHBOARD = "switchboard"; + private Switchboard switchboard = null; + + + public SwitchboardResponse switchboard(Switchboard switchboard) { + + this.switchboard = switchboard; + return this; + } + + /** + * The switchboard. + * @return switchboard + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The switchboard.") + @JsonProperty(JSON_PROPERTY_SWITCHBOARD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Switchboard getSwitchboard() { + return switchboard; + } + + + public void setSwitchboard(Switchboard switchboard) { + this.switchboard = switchboard; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardResponse switchboardResponse = (SwitchboardResponse) o; + return Objects.equals(this.switchboard, switchboardResponse.switchboard); + } + + @Override + public int hashCode() { + return Objects.hash(switchboard); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardResponse {\n"); + sb.append(" switchboard: ").append(toIndentedString(switchboard)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardUpdateBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardUpdateBody.java new file mode 100644 index 00000000..fe805fda --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/SwitchboardUpdateBody.java @@ -0,0 +1,133 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SwitchboardUpdateBody + */ +@JsonPropertyOrder({ + SwitchboardUpdateBody.JSON_PROPERTY_ENABLED, + SwitchboardUpdateBody.JSON_PROPERTY_DEFAULT_SWITCHBOARD_INTEGRATION_ID +}) + +public class SwitchboardUpdateBody { + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_DEFAULT_SWITCHBOARD_INTEGRATION_ID = "defaultSwitchboardIntegrationId"; + private String defaultSwitchboardIntegrationId; + + + public SwitchboardUpdateBody enabled(Boolean enabled) { + + this.enabled = enabled; + return this; + } + + /** + * Whether the switchboard is enabled. Allows creating the switchboard in a disabled state so that messages don't get lost or misrouted during switchboard configuration. When a switchboard is disabled, integrations linked to the switchboard will receive all events. + * @return enabled + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether the switchboard is enabled. Allows creating the switchboard in a disabled state so that messages don't get lost or misrouted during switchboard configuration. When a switchboard is disabled, integrations linked to the switchboard will receive all events.") + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getEnabled() { + return enabled; + } + + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + + public SwitchboardUpdateBody defaultSwitchboardIntegrationId(String defaultSwitchboardIntegrationId) { + + this.defaultSwitchboardIntegrationId = defaultSwitchboardIntegrationId; + return this; + } + + /** + * The id of the switchboard integration that will be given control when a new conversation begins. It will also be used for conversations that existed before the switchboard was enabled. + * @return defaultSwitchboardIntegrationId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5ef21b132f21af34f088530e", value = "The id of the switchboard integration that will be given control when a new conversation begins. It will also be used for conversations that existed before the switchboard was enabled.") + @JsonProperty(JSON_PROPERTY_DEFAULT_SWITCHBOARD_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDefaultSwitchboardIntegrationId() { + return defaultSwitchboardIntegrationId; + } + + + public void setDefaultSwitchboardIntegrationId(String defaultSwitchboardIntegrationId) { + this.defaultSwitchboardIntegrationId = defaultSwitchboardIntegrationId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SwitchboardUpdateBody switchboardUpdateBody = (SwitchboardUpdateBody) o; + return Objects.equals(this.enabled, switchboardUpdateBody.enabled) && + Objects.equals(this.defaultSwitchboardIntegrationId, switchboardUpdateBody.defaultSwitchboardIntegrationId); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, defaultSwitchboardIntegrationId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SwitchboardUpdateBody {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" defaultSwitchboardIntegrationId: ").append(toIndentedString(defaultSwitchboardIntegrationId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Target.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Target.java new file mode 100644 index 00000000..14657786 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Target.java @@ -0,0 +1,102 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The target conversation to attach the client to. + */ +@ApiModel(description = "The target conversation to attach the client to.") +@JsonPropertyOrder({ + Target.JSON_PROPERTY_CONVERSATION_ID +}) + +public class Target { + public static final String JSON_PROPERTY_CONVERSATION_ID = "conversationId"; + private String conversationId; + + + public Target conversationId(String conversationId) { + + this.conversationId = conversationId; + return this; + } + + /** + * The conversation ID of the target conversation. + * @return conversationId + **/ + @ApiModelProperty(example = "029c31f25a21b47effd7be90", required = true, value = "The conversation ID of the target conversation.") + @JsonProperty(JSON_PROPERTY_CONVERSATION_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getConversationId() { + return conversationId; + } + + + public void setConversationId(String conversationId) { + this.conversationId = conversationId; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Target target = (Target) o; + return Objects.equals(this.conversationId, target.conversationId); + } + + @Override + public int hashCode() { + return Objects.hash(conversationId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Target {\n"); + sb.append(" conversationId: ").append(toIndentedString(conversationId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Telegram.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Telegram.java new file mode 100644 index 00000000..45771a9d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Telegram.java @@ -0,0 +1,215 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Android; +import com.zendesk.sunshine_conversations_client.model.Apple; +import com.zendesk.sunshine_conversations_client.model.Custom; +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.Ios; +import com.zendesk.sunshine_conversations_client.model.Line; +import com.zendesk.sunshine_conversations_client.model.Mailgun; +import com.zendesk.sunshine_conversations_client.model.MessageBird; +import com.zendesk.sunshine_conversations_client.model.Messenger; +import com.zendesk.sunshine_conversations_client.model.Status; +import com.zendesk.sunshine_conversations_client.model.Telegram; +import com.zendesk.sunshine_conversations_client.model.TelegramAllOf; +import com.zendesk.sunshine_conversations_client.model.Twilio; +import com.zendesk.sunshine_conversations_client.model.Twitter; +import com.zendesk.sunshine_conversations_client.model.Viber; +import com.zendesk.sunshine_conversations_client.model.Web; +import com.zendesk.sunshine_conversations_client.model.Whatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Telegram + */ +@JsonPropertyOrder({ + Telegram.JSON_PROPERTY_TYPE, + Telegram.JSON_PROPERTY_TOKEN, + Telegram.JSON_PROPERTY_USERNAME, + Telegram.JSON_PROPERTY_BOT_ID +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Android.class, name = "android"), + @JsonSubTypes.Type(value = Apple.class, name = "apple"), + @JsonSubTypes.Type(value = Custom.class, name = "custom"), + @JsonSubTypes.Type(value = Ios.class, name = "ios"), + @JsonSubTypes.Type(value = Line.class, name = "line"), + @JsonSubTypes.Type(value = Mailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messagebird"), + @JsonSubTypes.Type(value = Messenger.class, name = "messenger"), + @JsonSubTypes.Type(value = Telegram.class, name = "telegram"), + @JsonSubTypes.Type(value = Twilio.class, name = "twilio"), + @JsonSubTypes.Type(value = Twitter.class, name = "twitter"), + @JsonSubTypes.Type(value = Viber.class, name = "viber"), + @JsonSubTypes.Type(value = Web.class, name = "web"), + @JsonSubTypes.Type(value = Whatsapp.class, name = "whatsapp"), +}) + +public class Telegram extends Integration { + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type = "telegram"; + + public static final String JSON_PROPERTY_TOKEN = "token"; + private String token; + + public static final String JSON_PROPERTY_USERNAME = "username"; + private String username; + + public static final String JSON_PROPERTY_BOT_ID = "botId"; + private String botId; + + + public Telegram type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Telegram token(String token) { + + this.token = token; + return this; + } + + /** + * Telegram Bot Token. + * @return token + **/ + @ApiModelProperty(example = "192033615:AAEuee2FS2JYKWfDlTulfygjaIGJi4s", required = true, value = "Telegram Bot Token.") + @JsonProperty(JSON_PROPERTY_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getToken() { + return token; + } + + + public void setToken(String token) { + this.token = token; + } + + + /** + * Username of the botId + * @return username + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Username of the botId") + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUsername() { + return username; + } + + + + + /** + * A human-friendly name used to identify the integration. + * @return botId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A human-friendly name used to identify the integration.") + @JsonProperty(JSON_PROPERTY_BOT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBotId() { + return botId; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Telegram telegram = (Telegram) o; + return Objects.equals(this.type, telegram.type) && + Objects.equals(this.token, telegram.token) && + Objects.equals(this.username, telegram.username) && + Objects.equals(this.botId, telegram.botId) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, token, username, botId, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Telegram {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" botId: ").append(toIndentedString(botId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/TelegramAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/TelegramAllOf.java new file mode 100644 index 00000000..1b45551a --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/TelegramAllOf.java @@ -0,0 +1,177 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * To configure a Telegram integration, acquire the required information from the user and call the Create Integration endpoint. + */ +@ApiModel(description = "To configure a Telegram integration, acquire the required information from the user and call the Create Integration endpoint. ") +@JsonPropertyOrder({ + TelegramAllOf.JSON_PROPERTY_TYPE, + TelegramAllOf.JSON_PROPERTY_TOKEN, + TelegramAllOf.JSON_PROPERTY_USERNAME, + TelegramAllOf.JSON_PROPERTY_BOT_ID +}) + +public class TelegramAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "telegram"; + + public static final String JSON_PROPERTY_TOKEN = "token"; + private String token; + + public static final String JSON_PROPERTY_USERNAME = "username"; + private String username; + + public static final String JSON_PROPERTY_BOT_ID = "botId"; + private String botId; + + + public TelegramAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public TelegramAllOf token(String token) { + + this.token = token; + return this; + } + + /** + * Telegram Bot Token. + * @return token + **/ + @ApiModelProperty(example = "192033615:AAEuee2FS2JYKWfDlTulfygjaIGJi4s", required = true, value = "Telegram Bot Token.") + @JsonProperty(JSON_PROPERTY_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getToken() { + return token; + } + + + public void setToken(String token) { + this.token = token; + } + + + /** + * Username of the botId + * @return username + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Username of the botId") + @JsonProperty(JSON_PROPERTY_USERNAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUsername() { + return username; + } + + + + + /** + * A human-friendly name used to identify the integration. + * @return botId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A human-friendly name used to identify the integration.") + @JsonProperty(JSON_PROPERTY_BOT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBotId() { + return botId; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TelegramAllOf telegramAllOf = (TelegramAllOf) o; + return Objects.equals(this.type, telegramAllOf.type) && + Objects.equals(this.token, telegramAllOf.token) && + Objects.equals(this.username, telegramAllOf.username) && + Objects.equals(this.botId, telegramAllOf.botId); + } + + @Override + public int hashCode() { + return Objects.hash(type, token, username, botId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TelegramAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" botId: ").append(toIndentedString(botId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/TelegramUpdate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/TelegramUpdate.java new file mode 100644 index 00000000..115270ef --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/TelegramUpdate.java @@ -0,0 +1,79 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdateBase; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdate; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * TelegramUpdate + */ +@JsonPropertyOrder({ +}) + +public class TelegramUpdate extends IntegrationUpdateBase implements IntegrationUpdate { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TelegramUpdate {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/TextMessage.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/TextMessage.java new file mode 100644 index 00000000..77341811 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/TextMessage.java @@ -0,0 +1,179 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Action; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.zendesk.sunshine_conversations_client.model.Content; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.math.BigDecimal; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * TextMessage + */ +@JsonPropertyOrder({ + TextMessage.JSON_PROPERTY_TYPE, + TextMessage.JSON_PROPERTY_TEXT, + TextMessage.JSON_PROPERTY_ACTIONS +}) + +public class TextMessage implements Content { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "text"; + + public static final String JSON_PROPERTY_TEXT = "text"; + private String text; + + public static final String JSON_PROPERTY_ACTIONS = "actions"; + private List actions = null; + + + public TextMessage type(String type) { + + this.type = type; + return this; + } + + /** + * The type of message. + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of message.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public TextMessage text(String text) { + + this.text = text; + return this; + } + + /** + * The text content of the message. Optional only if actions are provided. + * @return text + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Hello!", value = "The text content of the message. Optional only if actions are provided.") + @JsonProperty(JSON_PROPERTY_TEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public TextMessage actions(List actions) { + + this.actions = actions; + return this; + } + + public TextMessage addActionsItem(Action actionsItem) { + if (this.actions == null) { + this.actions = new ArrayList(); + } + this.actions.add(actionsItem); + return this; + } + + /** + * Array of message actions. + * @return actions + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Array of message actions.") + @JsonProperty(JSON_PROPERTY_ACTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getActions() { + return actions; + } + + + public void setActions(List actions) { + this.actions = actions; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TextMessage textMessage = (TextMessage) o; + return Objects.equals(this.type, textMessage.type) && + Objects.equals(this.text, textMessage.text) && + Objects.equals(this.actions, textMessage.actions); + } + + @Override + public int hashCode() { + return Objects.hash(type, text, actions); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TextMessage {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Twilio.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Twilio.java new file mode 100644 index 00000000..e636ab18 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Twilio.java @@ -0,0 +1,231 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Android; +import com.zendesk.sunshine_conversations_client.model.Apple; +import com.zendesk.sunshine_conversations_client.model.Custom; +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.Ios; +import com.zendesk.sunshine_conversations_client.model.Line; +import com.zendesk.sunshine_conversations_client.model.Mailgun; +import com.zendesk.sunshine_conversations_client.model.MessageBird; +import com.zendesk.sunshine_conversations_client.model.Messenger; +import com.zendesk.sunshine_conversations_client.model.Status; +import com.zendesk.sunshine_conversations_client.model.Telegram; +import com.zendesk.sunshine_conversations_client.model.Twilio; +import com.zendesk.sunshine_conversations_client.model.TwilioAllOf; +import com.zendesk.sunshine_conversations_client.model.Twitter; +import com.zendesk.sunshine_conversations_client.model.Viber; +import com.zendesk.sunshine_conversations_client.model.Web; +import com.zendesk.sunshine_conversations_client.model.Whatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Twilio + */ +@JsonPropertyOrder({ + Twilio.JSON_PROPERTY_TYPE, + Twilio.JSON_PROPERTY_ACCOUNT_SID, + Twilio.JSON_PROPERTY_AUTH_TOKEN, + Twilio.JSON_PROPERTY_PHONE_NUMBER_SID +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Android.class, name = "android"), + @JsonSubTypes.Type(value = Apple.class, name = "apple"), + @JsonSubTypes.Type(value = Custom.class, name = "custom"), + @JsonSubTypes.Type(value = Ios.class, name = "ios"), + @JsonSubTypes.Type(value = Line.class, name = "line"), + @JsonSubTypes.Type(value = Mailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messagebird"), + @JsonSubTypes.Type(value = Messenger.class, name = "messenger"), + @JsonSubTypes.Type(value = Telegram.class, name = "telegram"), + @JsonSubTypes.Type(value = Twilio.class, name = "twilio"), + @JsonSubTypes.Type(value = Twitter.class, name = "twitter"), + @JsonSubTypes.Type(value = Viber.class, name = "viber"), + @JsonSubTypes.Type(value = Web.class, name = "web"), + @JsonSubTypes.Type(value = Whatsapp.class, name = "whatsapp"), +}) + +public class Twilio extends Integration { + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type = "twilio"; + + public static final String JSON_PROPERTY_ACCOUNT_SID = "accountSid"; + private String accountSid; + + public static final String JSON_PROPERTY_AUTH_TOKEN = "authToken"; + private String authToken; + + public static final String JSON_PROPERTY_PHONE_NUMBER_SID = "phoneNumberSid"; + private String phoneNumberSid; + + + public Twilio type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Twilio accountSid(String accountSid) { + + this.accountSid = accountSid; + return this; + } + + /** + * Twilio Account SID. + * @return accountSid + **/ + @ApiModelProperty(example = "ACa1b4c65ee0722712fab89867cb14eac7", required = true, value = "Twilio Account SID.") + @JsonProperty(JSON_PROPERTY_ACCOUNT_SID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAccountSid() { + return accountSid; + } + + + public void setAccountSid(String accountSid) { + this.accountSid = accountSid; + } + + + public Twilio authToken(String authToken) { + + this.authToken = authToken; + return this; + } + + /** + * Twilio Auth Token. + * @return authToken + **/ + @ApiModelProperty(example = "160c024303f53049e1e060fd67ca6aefc", required = true, value = "Twilio Auth Token.") + @JsonProperty(JSON_PROPERTY_AUTH_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAuthToken() { + return authToken; + } + + + public void setAuthToken(String authToken) { + this.authToken = authToken; + } + + + public Twilio phoneNumberSid(String phoneNumberSid) { + + this.phoneNumberSid = phoneNumberSid; + return this; + } + + /** + * SID for specific phone number. + * @return phoneNumberSid + **/ + @ApiModelProperty(example = "PN0674df0ecee0c9819bca0ff0bc0a159e", required = true, value = "SID for specific phone number.") + @JsonProperty(JSON_PROPERTY_PHONE_NUMBER_SID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPhoneNumberSid() { + return phoneNumberSid; + } + + + public void setPhoneNumberSid(String phoneNumberSid) { + this.phoneNumberSid = phoneNumberSid; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Twilio twilio = (Twilio) o; + return Objects.equals(this.type, twilio.type) && + Objects.equals(this.accountSid, twilio.accountSid) && + Objects.equals(this.authToken, twilio.authToken) && + Objects.equals(this.phoneNumberSid, twilio.phoneNumberSid) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, accountSid, authToken, phoneNumberSid, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Twilio {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" accountSid: ").append(toIndentedString(accountSid)).append("\n"); + sb.append(" authToken: ").append(toIndentedString(authToken)).append("\n"); + sb.append(" phoneNumberSid: ").append(toIndentedString(phoneNumberSid)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/TwilioAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/TwilioAllOf.java new file mode 100644 index 00000000..c6947195 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/TwilioAllOf.java @@ -0,0 +1,193 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * To configure a Twilio integration, acquire the required information from the user and call the Create Integration endpoint. + */ +@ApiModel(description = "To configure a Twilio integration, acquire the required information from the user and call the Create Integration endpoint. ") +@JsonPropertyOrder({ + TwilioAllOf.JSON_PROPERTY_TYPE, + TwilioAllOf.JSON_PROPERTY_ACCOUNT_SID, + TwilioAllOf.JSON_PROPERTY_AUTH_TOKEN, + TwilioAllOf.JSON_PROPERTY_PHONE_NUMBER_SID +}) + +public class TwilioAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "twilio"; + + public static final String JSON_PROPERTY_ACCOUNT_SID = "accountSid"; + private String accountSid; + + public static final String JSON_PROPERTY_AUTH_TOKEN = "authToken"; + private String authToken; + + public static final String JSON_PROPERTY_PHONE_NUMBER_SID = "phoneNumberSid"; + private String phoneNumberSid; + + + public TwilioAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public TwilioAllOf accountSid(String accountSid) { + + this.accountSid = accountSid; + return this; + } + + /** + * Twilio Account SID. + * @return accountSid + **/ + @ApiModelProperty(example = "ACa1b4c65ee0722712fab89867cb14eac7", required = true, value = "Twilio Account SID.") + @JsonProperty(JSON_PROPERTY_ACCOUNT_SID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAccountSid() { + return accountSid; + } + + + public void setAccountSid(String accountSid) { + this.accountSid = accountSid; + } + + + public TwilioAllOf authToken(String authToken) { + + this.authToken = authToken; + return this; + } + + /** + * Twilio Auth Token. + * @return authToken + **/ + @ApiModelProperty(example = "160c024303f53049e1e060fd67ca6aefc", required = true, value = "Twilio Auth Token.") + @JsonProperty(JSON_PROPERTY_AUTH_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAuthToken() { + return authToken; + } + + + public void setAuthToken(String authToken) { + this.authToken = authToken; + } + + + public TwilioAllOf phoneNumberSid(String phoneNumberSid) { + + this.phoneNumberSid = phoneNumberSid; + return this; + } + + /** + * SID for specific phone number. + * @return phoneNumberSid + **/ + @ApiModelProperty(example = "PN0674df0ecee0c9819bca0ff0bc0a159e", required = true, value = "SID for specific phone number.") + @JsonProperty(JSON_PROPERTY_PHONE_NUMBER_SID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPhoneNumberSid() { + return phoneNumberSid; + } + + + public void setPhoneNumberSid(String phoneNumberSid) { + this.phoneNumberSid = phoneNumberSid; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TwilioAllOf twilioAllOf = (TwilioAllOf) o; + return Objects.equals(this.type, twilioAllOf.type) && + Objects.equals(this.accountSid, twilioAllOf.accountSid) && + Objects.equals(this.authToken, twilioAllOf.authToken) && + Objects.equals(this.phoneNumberSid, twilioAllOf.phoneNumberSid); + } + + @Override + public int hashCode() { + return Objects.hash(type, accountSid, authToken, phoneNumberSid); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TwilioAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" accountSid: ").append(toIndentedString(accountSid)).append("\n"); + sb.append(" authToken: ").append(toIndentedString(authToken)).append("\n"); + sb.append(" phoneNumberSid: ").append(toIndentedString(phoneNumberSid)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/TwilioUpdate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/TwilioUpdate.java new file mode 100644 index 00000000..13e05e24 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/TwilioUpdate.java @@ -0,0 +1,79 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdateBase; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdate; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * TwilioUpdate + */ +@JsonPropertyOrder({ +}) + +public class TwilioUpdate extends IntegrationUpdateBase implements IntegrationUpdate { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TwilioUpdate {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Twitter.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Twitter.java new file mode 100644 index 00000000..12a42e3f --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Twitter.java @@ -0,0 +1,360 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Android; +import com.zendesk.sunshine_conversations_client.model.Apple; +import com.zendesk.sunshine_conversations_client.model.Custom; +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.Ios; +import com.zendesk.sunshine_conversations_client.model.Line; +import com.zendesk.sunshine_conversations_client.model.Mailgun; +import com.zendesk.sunshine_conversations_client.model.MessageBird; +import com.zendesk.sunshine_conversations_client.model.Messenger; +import com.zendesk.sunshine_conversations_client.model.Status; +import com.zendesk.sunshine_conversations_client.model.Telegram; +import com.zendesk.sunshine_conversations_client.model.Twilio; +import com.zendesk.sunshine_conversations_client.model.Twitter; +import com.zendesk.sunshine_conversations_client.model.TwitterAllOf; +import com.zendesk.sunshine_conversations_client.model.Viber; +import com.zendesk.sunshine_conversations_client.model.Web; +import com.zendesk.sunshine_conversations_client.model.Whatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Twitter + */ +@JsonPropertyOrder({ + Twitter.JSON_PROPERTY_TYPE, + Twitter.JSON_PROPERTY_TIER, + Twitter.JSON_PROPERTY_ENV_NAME, + Twitter.JSON_PROPERTY_CONSUMER_KEY, + Twitter.JSON_PROPERTY_CONSUMER_SECRET, + Twitter.JSON_PROPERTY_ACCESS_TOKEN_KEY, + Twitter.JSON_PROPERTY_ACCESS_TOKEN_SECRET +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Android.class, name = "android"), + @JsonSubTypes.Type(value = Apple.class, name = "apple"), + @JsonSubTypes.Type(value = Custom.class, name = "custom"), + @JsonSubTypes.Type(value = Ios.class, name = "ios"), + @JsonSubTypes.Type(value = Line.class, name = "line"), + @JsonSubTypes.Type(value = Mailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messagebird"), + @JsonSubTypes.Type(value = Messenger.class, name = "messenger"), + @JsonSubTypes.Type(value = Telegram.class, name = "telegram"), + @JsonSubTypes.Type(value = Twilio.class, name = "twilio"), + @JsonSubTypes.Type(value = Twitter.class, name = "twitter"), + @JsonSubTypes.Type(value = Viber.class, name = "viber"), + @JsonSubTypes.Type(value = Web.class, name = "web"), + @JsonSubTypes.Type(value = Whatsapp.class, name = "whatsapp"), +}) + +public class Twitter extends Integration { + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type = "twitter"; + + /** + * Your Twitter app’s tier, sandbox, premium or enterprise. + */ + public enum TierEnum { + SANDBOX("sandbox"), + + PREMIUM("premium"), + + ENTERPRISE("enterprise"); + + private String value; + + TierEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TierEnum fromValue(String value) { + for (TierEnum b : TierEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TIER = "tier"; + private TierEnum tier; + + public static final String JSON_PROPERTY_ENV_NAME = "envName"; + private String envName; + + public static final String JSON_PROPERTY_CONSUMER_KEY = "consumerKey"; + private String consumerKey; + + public static final String JSON_PROPERTY_CONSUMER_SECRET = "consumerSecret"; + private String consumerSecret; + + public static final String JSON_PROPERTY_ACCESS_TOKEN_KEY = "accessTokenKey"; + private String accessTokenKey; + + public static final String JSON_PROPERTY_ACCESS_TOKEN_SECRET = "accessTokenSecret"; + private String accessTokenSecret; + + + public Twitter type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Twitter tier(TierEnum tier) { + + this.tier = tier; + return this; + } + + /** + * Your Twitter app’s tier, sandbox, premium or enterprise. + * @return tier + **/ + @ApiModelProperty(required = true, value = "Your Twitter app’s tier, sandbox, premium or enterprise.") + @JsonProperty(JSON_PROPERTY_TIER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public TierEnum getTier() { + return tier; + } + + + public void setTier(TierEnum tier) { + this.tier = tier; + } + + + public Twitter envName(String envName) { + + this.envName = envName; + return this; + } + + /** + * The Twitter dev environments label (required for sandbox and premium tiers). + * @return envName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_env_label", value = "The Twitter dev environments label (required for sandbox and premium tiers).") + @JsonProperty(JSON_PROPERTY_ENV_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getEnvName() { + return envName; + } + + + public void setEnvName(String envName) { + this.envName = envName; + } + + + public Twitter consumerKey(String consumerKey) { + + this.consumerKey = consumerKey; + return this; + } + + /** + * The consumer key for your Twitter app. + * @return consumerKey + **/ + @ApiModelProperty(example = "your_consumer_key", required = true, value = "The consumer key for your Twitter app.") + @JsonProperty(JSON_PROPERTY_CONSUMER_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getConsumerKey() { + return consumerKey; + } + + + public void setConsumerKey(String consumerKey) { + this.consumerKey = consumerKey; + } + + + public Twitter consumerSecret(String consumerSecret) { + + this.consumerSecret = consumerSecret; + return this; + } + + /** + * The consumer key secret for your Twitter app. + * @return consumerSecret + **/ + @ApiModelProperty(example = "your_consumer_secret", required = true, value = "The consumer key secret for your Twitter app.") + @JsonProperty(JSON_PROPERTY_CONSUMER_SECRET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getConsumerSecret() { + return consumerSecret; + } + + + public void setConsumerSecret(String consumerSecret) { + this.consumerSecret = consumerSecret; + } + + + public Twitter accessTokenKey(String accessTokenKey) { + + this.accessTokenKey = accessTokenKey; + return this; + } + + /** + * The access token key obtained from your user via oauth. + * @return accessTokenKey + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_access_token_key", value = "The access token key obtained from your user via oauth.") + @JsonProperty(JSON_PROPERTY_ACCESS_TOKEN_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAccessTokenKey() { + return accessTokenKey; + } + + + public void setAccessTokenKey(String accessTokenKey) { + this.accessTokenKey = accessTokenKey; + } + + + public Twitter accessTokenSecret(String accessTokenSecret) { + + this.accessTokenSecret = accessTokenSecret; + return this; + } + + /** + * The access token secret obtained from your user via oauth. + * @return accessTokenSecret + **/ + @ApiModelProperty(example = "your_access_token_secret", required = true, value = "The access token secret obtained from your user via oauth.") + @JsonProperty(JSON_PROPERTY_ACCESS_TOKEN_SECRET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAccessTokenSecret() { + return accessTokenSecret; + } + + + public void setAccessTokenSecret(String accessTokenSecret) { + this.accessTokenSecret = accessTokenSecret; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Twitter twitter = (Twitter) o; + return Objects.equals(this.type, twitter.type) && + Objects.equals(this.tier, twitter.tier) && + Objects.equals(this.envName, twitter.envName) && + Objects.equals(this.consumerKey, twitter.consumerKey) && + Objects.equals(this.consumerSecret, twitter.consumerSecret) && + Objects.equals(this.accessTokenKey, twitter.accessTokenKey) && + Objects.equals(this.accessTokenSecret, twitter.accessTokenSecret) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, tier, envName, consumerKey, consumerSecret, accessTokenKey, accessTokenSecret, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Twitter {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" tier: ").append(toIndentedString(tier)).append("\n"); + sb.append(" envName: ").append(toIndentedString(envName)).append("\n"); + sb.append(" consumerKey: ").append(toIndentedString(consumerKey)).append("\n"); + sb.append(" consumerSecret: ").append(toIndentedString(consumerSecret)).append("\n"); + sb.append(" accessTokenKey: ").append(toIndentedString(accessTokenKey)).append("\n"); + sb.append(" accessTokenSecret: ").append(toIndentedString(accessTokenSecret)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/TwitterAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/TwitterAllOf.java new file mode 100644 index 00000000..020e0241 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/TwitterAllOf.java @@ -0,0 +1,322 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * To set up a Twitter integration, please follow the steps outlined in the [Twitter Setup Guide](https://docs.smooch.io/guide/twitter/#setup). + */ +@ApiModel(description = "To set up a Twitter integration, please follow the steps outlined in the [Twitter Setup Guide](https://docs.smooch.io/guide/twitter/#setup). ") +@JsonPropertyOrder({ + TwitterAllOf.JSON_PROPERTY_TYPE, + TwitterAllOf.JSON_PROPERTY_TIER, + TwitterAllOf.JSON_PROPERTY_ENV_NAME, + TwitterAllOf.JSON_PROPERTY_CONSUMER_KEY, + TwitterAllOf.JSON_PROPERTY_CONSUMER_SECRET, + TwitterAllOf.JSON_PROPERTY_ACCESS_TOKEN_KEY, + TwitterAllOf.JSON_PROPERTY_ACCESS_TOKEN_SECRET +}) + +public class TwitterAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "twitter"; + + /** + * Your Twitter app’s tier, sandbox, premium or enterprise. + */ + public enum TierEnum { + SANDBOX("sandbox"), + + PREMIUM("premium"), + + ENTERPRISE("enterprise"); + + private String value; + + TierEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TierEnum fromValue(String value) { + for (TierEnum b : TierEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TIER = "tier"; + private TierEnum tier; + + public static final String JSON_PROPERTY_ENV_NAME = "envName"; + private String envName; + + public static final String JSON_PROPERTY_CONSUMER_KEY = "consumerKey"; + private String consumerKey; + + public static final String JSON_PROPERTY_CONSUMER_SECRET = "consumerSecret"; + private String consumerSecret; + + public static final String JSON_PROPERTY_ACCESS_TOKEN_KEY = "accessTokenKey"; + private String accessTokenKey; + + public static final String JSON_PROPERTY_ACCESS_TOKEN_SECRET = "accessTokenSecret"; + private String accessTokenSecret; + + + public TwitterAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public TwitterAllOf tier(TierEnum tier) { + + this.tier = tier; + return this; + } + + /** + * Your Twitter app’s tier, sandbox, premium or enterprise. + * @return tier + **/ + @ApiModelProperty(required = true, value = "Your Twitter app’s tier, sandbox, premium or enterprise.") + @JsonProperty(JSON_PROPERTY_TIER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public TierEnum getTier() { + return tier; + } + + + public void setTier(TierEnum tier) { + this.tier = tier; + } + + + public TwitterAllOf envName(String envName) { + + this.envName = envName; + return this; + } + + /** + * The Twitter dev environments label (required for sandbox and premium tiers). + * @return envName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_env_label", value = "The Twitter dev environments label (required for sandbox and premium tiers).") + @JsonProperty(JSON_PROPERTY_ENV_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getEnvName() { + return envName; + } + + + public void setEnvName(String envName) { + this.envName = envName; + } + + + public TwitterAllOf consumerKey(String consumerKey) { + + this.consumerKey = consumerKey; + return this; + } + + /** + * The consumer key for your Twitter app. + * @return consumerKey + **/ + @ApiModelProperty(example = "your_consumer_key", required = true, value = "The consumer key for your Twitter app.") + @JsonProperty(JSON_PROPERTY_CONSUMER_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getConsumerKey() { + return consumerKey; + } + + + public void setConsumerKey(String consumerKey) { + this.consumerKey = consumerKey; + } + + + public TwitterAllOf consumerSecret(String consumerSecret) { + + this.consumerSecret = consumerSecret; + return this; + } + + /** + * The consumer key secret for your Twitter app. + * @return consumerSecret + **/ + @ApiModelProperty(example = "your_consumer_secret", required = true, value = "The consumer key secret for your Twitter app.") + @JsonProperty(JSON_PROPERTY_CONSUMER_SECRET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getConsumerSecret() { + return consumerSecret; + } + + + public void setConsumerSecret(String consumerSecret) { + this.consumerSecret = consumerSecret; + } + + + public TwitterAllOf accessTokenKey(String accessTokenKey) { + + this.accessTokenKey = accessTokenKey; + return this; + } + + /** + * The access token key obtained from your user via oauth. + * @return accessTokenKey + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_access_token_key", value = "The access token key obtained from your user via oauth.") + @JsonProperty(JSON_PROPERTY_ACCESS_TOKEN_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAccessTokenKey() { + return accessTokenKey; + } + + + public void setAccessTokenKey(String accessTokenKey) { + this.accessTokenKey = accessTokenKey; + } + + + public TwitterAllOf accessTokenSecret(String accessTokenSecret) { + + this.accessTokenSecret = accessTokenSecret; + return this; + } + + /** + * The access token secret obtained from your user via oauth. + * @return accessTokenSecret + **/ + @ApiModelProperty(example = "your_access_token_secret", required = true, value = "The access token secret obtained from your user via oauth.") + @JsonProperty(JSON_PROPERTY_ACCESS_TOKEN_SECRET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getAccessTokenSecret() { + return accessTokenSecret; + } + + + public void setAccessTokenSecret(String accessTokenSecret) { + this.accessTokenSecret = accessTokenSecret; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TwitterAllOf twitterAllOf = (TwitterAllOf) o; + return Objects.equals(this.type, twitterAllOf.type) && + Objects.equals(this.tier, twitterAllOf.tier) && + Objects.equals(this.envName, twitterAllOf.envName) && + Objects.equals(this.consumerKey, twitterAllOf.consumerKey) && + Objects.equals(this.consumerSecret, twitterAllOf.consumerSecret) && + Objects.equals(this.accessTokenKey, twitterAllOf.accessTokenKey) && + Objects.equals(this.accessTokenSecret, twitterAllOf.accessTokenSecret); + } + + @Override + public int hashCode() { + return Objects.hash(type, tier, envName, consumerKey, consumerSecret, accessTokenKey, accessTokenSecret); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TwitterAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" tier: ").append(toIndentedString(tier)).append("\n"); + sb.append(" envName: ").append(toIndentedString(envName)).append("\n"); + sb.append(" consumerKey: ").append(toIndentedString(consumerKey)).append("\n"); + sb.append(" consumerSecret: ").append(toIndentedString(consumerSecret)).append("\n"); + sb.append(" accessTokenKey: ").append(toIndentedString(accessTokenKey)).append("\n"); + sb.append(" accessTokenSecret: ").append(toIndentedString(accessTokenSecret)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/TwitterUpdate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/TwitterUpdate.java new file mode 100644 index 00000000..4268e5b9 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/TwitterUpdate.java @@ -0,0 +1,79 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdateBase; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdate; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * TwitterUpdate + */ +@JsonPropertyOrder({ +}) + +public class TwitterUpdate extends IntegrationUpdateBase implements IntegrationUpdate { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TwitterUpdate {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/User.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/User.java new file mode 100644 index 00000000..7b9eeae2 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/User.java @@ -0,0 +1,242 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Profile; +import com.zendesk.sunshine_conversations_client.model.UserAllOf; +import com.zendesk.sunshine_conversations_client.model.UserTruncated; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * User + */ +@JsonPropertyOrder({ + User.JSON_PROPERTY_ID, + User.JSON_PROPERTY_EXTERNAL_ID, + User.JSON_PROPERTY_SIGNED_UP_AT, + User.JSON_PROPERTY_PROFILE, + User.JSON_PROPERTY_METADATA +}) + +public class User { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_EXTERNAL_ID = "externalId"; + private JsonNullable externalId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SIGNED_UP_AT = "signedUpAt"; + private String signedUpAt = null; + + public static final String JSON_PROPERTY_PROFILE = "profile"; + private Profile profile = null; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private Object metadata = null; + + + public User id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the user. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "7494535bff5cef41a15be74d", value = "The unique ID of the user.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public User externalId(String externalId) { + this.externalId = JsonNullable.of(externalId); + + return this; + } + + /** + * An optional ID that if specified can also be used to retrieve the user. + * @return externalId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your-own-id", value = "An optional ID that if specified can also be used to retrieve the user. ") + @JsonIgnore + + public String getExternalId() { + return externalId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EXTERNAL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getExternalId_JsonNullable() { + return externalId; + } + + @JsonProperty(JSON_PROPERTY_EXTERNAL_ID) + public void setExternalId_JsonNullable(JsonNullable externalId) { + this.externalId = externalId; + } + + public void setExternalId(String externalId) { + this.externalId = JsonNullable.of(externalId); + } + + + public User signedUpAt(String signedUpAt) { + + this.signedUpAt = signedUpAt; + return this; + } + + /** + * Get signedUpAt + * @return signedUpAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SIGNED_UP_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSignedUpAt() { + return signedUpAt; + } + + + public void setSignedUpAt(String signedUpAt) { + this.signedUpAt = signedUpAt; + } + + + public User profile(Profile profile) { + + this.profile = profile; + return this; + } + + /** + * Get profile + * @return profile + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROFILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Profile getProfile() { + return profile; + } + + + public void setProfile(Profile profile) { + this.profile = profile; + } + + + public User metadata(Object metadata) { + + this.metadata = metadata; + return this; + } + + /** + * Get metadata + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getMetadata() { + return metadata; + } + + + public void setMetadata(Object metadata) { + this.metadata = metadata; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.externalId, user.externalId) && + Objects.equals(this.signedUpAt, user.signedUpAt) && + Objects.equals(this.profile, user.profile) && + Objects.equals(this.metadata, user.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(id, externalId, signedUpAt, profile, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" externalId: ").append(toIndentedString(externalId)).append("\n"); + sb.append(" signedUpAt: ").append(toIndentedString(signedUpAt)).append("\n"); + sb.append(" profile: ").append(toIndentedString(profile)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/UserAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserAllOf.java new file mode 100644 index 00000000..ad6c25e0 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserAllOf.java @@ -0,0 +1,165 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Profile; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * UserAllOf + */ +@JsonPropertyOrder({ + UserAllOf.JSON_PROPERTY_SIGNED_UP_AT, + UserAllOf.JSON_PROPERTY_PROFILE, + UserAllOf.JSON_PROPERTY_METADATA +}) + +public class UserAllOf { + public static final String JSON_PROPERTY_SIGNED_UP_AT = "signedUpAt"; + private String signedUpAt = null; + + public static final String JSON_PROPERTY_PROFILE = "profile"; + private Profile profile = null; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private Object metadata = null; + + + public UserAllOf signedUpAt(String signedUpAt) { + + this.signedUpAt = signedUpAt; + return this; + } + + /** + * Get signedUpAt + * @return signedUpAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SIGNED_UP_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSignedUpAt() { + return signedUpAt; + } + + + public void setSignedUpAt(String signedUpAt) { + this.signedUpAt = signedUpAt; + } + + + public UserAllOf profile(Profile profile) { + + this.profile = profile; + return this; + } + + /** + * Get profile + * @return profile + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROFILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Profile getProfile() { + return profile; + } + + + public void setProfile(Profile profile) { + this.profile = profile; + } + + + public UserAllOf metadata(Object metadata) { + + this.metadata = metadata; + return this; + } + + /** + * Get metadata + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getMetadata() { + return metadata; + } + + + public void setMetadata(Object metadata) { + this.metadata = metadata; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserAllOf userAllOf = (UserAllOf) o; + return Objects.equals(this.signedUpAt, userAllOf.signedUpAt) && + Objects.equals(this.profile, userAllOf.profile) && + Objects.equals(this.metadata, userAllOf.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(signedUpAt, profile, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserAllOf {\n"); + sb.append(" signedUpAt: ").append(toIndentedString(signedUpAt)).append("\n"); + sb.append(" profile: ").append(toIndentedString(profile)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/UserCreateBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserCreateBody.java new file mode 100644 index 00000000..2e72505d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserCreateBody.java @@ -0,0 +1,208 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Profile; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * UserCreateBody + */ +@JsonPropertyOrder({ + UserCreateBody.JSON_PROPERTY_EXTERNAL_ID, + UserCreateBody.JSON_PROPERTY_SIGNED_UP_AT, + UserCreateBody.JSON_PROPERTY_PROFILE, + UserCreateBody.JSON_PROPERTY_METADATA +}) + +public class UserCreateBody { + public static final String JSON_PROPERTY_EXTERNAL_ID = "externalId"; + private String externalId; + + public static final String JSON_PROPERTY_SIGNED_UP_AT = "signedUpAt"; + private String signedUpAt; + + public static final String JSON_PROPERTY_PROFILE = "profile"; + private Profile profile; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public UserCreateBody externalId(String externalId) { + + this.externalId = externalId; + return this; + } + + /** + * A unique identifier for the user. The `externalId` can be used to link a user to the same conversation [across multiple devices](https://docs.smooch.io/guide/authenticating-users/). + * @return externalId + **/ + @ApiModelProperty(example = "your-own-id", required = true, value = "A unique identifier for the user. The `externalId` can be used to link a user to the same conversation [across multiple devices](https://docs.smooch.io/guide/authenticating-users/). ") + @JsonProperty(JSON_PROPERTY_EXTERNAL_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getExternalId() { + return externalId; + } + + + public void setExternalId(String externalId) { + this.externalId = externalId; + } + + + public UserCreateBody signedUpAt(String signedUpAt) { + + this.signedUpAt = signedUpAt; + return this; + } + + /** + * The date at which the user signed up. Must be ISO 8601 time format `YYYY-MM-DDThh:mm:ss.sssZ`. + * @return signedUpAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "2020-05-21T15:53:30.197Z", value = "The date at which the user signed up. Must be ISO 8601 time format `YYYY-MM-DDThh:mm:ss.sssZ`.") + @JsonProperty(JSON_PROPERTY_SIGNED_UP_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSignedUpAt() { + return signedUpAt; + } + + + public void setSignedUpAt(String signedUpAt) { + this.signedUpAt = signedUpAt; + } + + + public UserCreateBody profile(Profile profile) { + + this.profile = profile; + return this; + } + + /** + * Get profile + * @return profile + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROFILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Profile getProfile() { + return profile; + } + + + public void setProfile(Profile profile) { + this.profile = profile; + } + + + public UserCreateBody metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserCreateBody userCreateBody = (UserCreateBody) o; + return Objects.equals(this.externalId, userCreateBody.externalId) && + Objects.equals(this.signedUpAt, userCreateBody.signedUpAt) && + Objects.equals(this.profile, userCreateBody.profile) && + Objects.equals(this.metadata, userCreateBody.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(externalId, signedUpAt, profile, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserCreateBody {\n"); + sb.append(" externalId: ").append(toIndentedString(externalId)).append("\n"); + sb.append(" signedUpAt: ").append(toIndentedString(signedUpAt)).append("\n"); + sb.append(" profile: ").append(toIndentedString(profile)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/UserMergeEvent.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserMergeEvent.java new file mode 100644 index 00000000..70488040 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserMergeEvent.java @@ -0,0 +1,198 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.EventSubSchema; +import com.zendesk.sunshine_conversations_client.model.UserMergeEventAllOf; +import com.zendesk.sunshine_conversations_client.model.UserMergeEventAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * UserMergeEvent + */ +@JsonPropertyOrder({ + UserMergeEvent.JSON_PROPERTY_ID, + UserMergeEvent.JSON_PROPERTY_TYPE, + UserMergeEvent.JSON_PROPERTY_CREATED_AT, + UserMergeEvent.JSON_PROPERTY_PAYLOAD +}) + +public class UserMergeEvent { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + private String createdAt; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private UserMergeEventAllOfPayload payload; + + + public UserMergeEvent id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the event. May be used to ensure that an event is not processed twice in the case of a webhook that is re-tried due to an error or timeout.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public UserMergeEvent type(String type) { + + this.type = type; + return this; + } + + /** + * The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook). + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of the event. Will match one of the subscribed triggers for your [webhook](#operation/createWebhook).") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public UserMergeEvent createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`. + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A timestamp signifying when the event was generated. Formatted as `YYYY-MM-DDThh:mm:ss.SSSZ`.") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public UserMergeEvent payload(UserMergeEventAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UserMergeEventAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(UserMergeEventAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserMergeEvent userMergeEvent = (UserMergeEvent) o; + return Objects.equals(this.id, userMergeEvent.id) && + Objects.equals(this.type, userMergeEvent.type) && + Objects.equals(this.createdAt, userMergeEvent.createdAt) && + Objects.equals(this.payload, userMergeEvent.payload); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, createdAt, payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserMergeEvent {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/UserMergeEventAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserMergeEventAllOf.java new file mode 100644 index 00000000..b2f55faa --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserMergeEventAllOf.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.UserMergeEventAllOfPayload; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * UserMergeEventAllOf + */ +@JsonPropertyOrder({ + UserMergeEventAllOf.JSON_PROPERTY_PAYLOAD +}) + +public class UserMergeEventAllOf { + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private UserMergeEventAllOfPayload payload; + + + public UserMergeEventAllOf payload(UserMergeEventAllOfPayload payload) { + + this.payload = payload; + return this; + } + + /** + * Get payload + * @return payload + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UserMergeEventAllOfPayload getPayload() { + return payload; + } + + + public void setPayload(UserMergeEventAllOfPayload payload) { + this.payload = payload; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserMergeEventAllOf userMergeEventAllOf = (UserMergeEventAllOf) o; + return Objects.equals(this.payload, userMergeEventAllOf.payload); + } + + @Override + public int hashCode() { + return Objects.hash(payload); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserMergeEventAllOf {\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/UserMergeEventAllOfPayload.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserMergeEventAllOfPayload.java new file mode 100644 index 00000000..9b2f2bba --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserMergeEventAllOfPayload.java @@ -0,0 +1,190 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.UserMergeEventAllOfPayloadMergedConversations; +import com.zendesk.sunshine_conversations_client.model.UserMergeEventAllOfPayloadMergedUsers; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The payload of the event. The contents of this object depend on the type of event. + */ +@ApiModel(description = "The payload of the event. The contents of this object depend on the type of event.") +@JsonPropertyOrder({ + UserMergeEventAllOfPayload.JSON_PROPERTY_MERGED_USERS, + UserMergeEventAllOfPayload.JSON_PROPERTY_MERGED_CONVERSATIONS, + UserMergeEventAllOfPayload.JSON_PROPERTY_DISCARDED_METADATA +}) + +public class UserMergeEventAllOfPayload { + public static final String JSON_PROPERTY_MERGED_USERS = "mergedUsers"; + private UserMergeEventAllOfPayloadMergedUsers mergedUsers; + + public static final String JSON_PROPERTY_MERGED_CONVERSATIONS = "mergedConversations"; + private JsonNullable mergedConversations = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DISCARDED_METADATA = "discardedMetadata"; + private JsonNullable discardedMetadata = JsonNullable.of(null); + + + public UserMergeEventAllOfPayload mergedUsers(UserMergeEventAllOfPayloadMergedUsers mergedUsers) { + + this.mergedUsers = mergedUsers; + return this; + } + + /** + * Get mergedUsers + * @return mergedUsers + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MERGED_USERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public UserMergeEventAllOfPayloadMergedUsers getMergedUsers() { + return mergedUsers; + } + + + public void setMergedUsers(UserMergeEventAllOfPayloadMergedUsers mergedUsers) { + this.mergedUsers = mergedUsers; + } + + + public UserMergeEventAllOfPayload mergedConversations(UserMergeEventAllOfPayloadMergedConversations mergedConversations) { + this.mergedConversations = JsonNullable.of(mergedConversations); + + return this; + } + + /** + * Get mergedConversations + * @return mergedConversations + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public UserMergeEventAllOfPayloadMergedConversations getMergedConversations() { + return mergedConversations.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_MERGED_CONVERSATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMergedConversations_JsonNullable() { + return mergedConversations; + } + + @JsonProperty(JSON_PROPERTY_MERGED_CONVERSATIONS) + public void setMergedConversations_JsonNullable(JsonNullable mergedConversations) { + this.mergedConversations = mergedConversations; + } + + public void setMergedConversations(UserMergeEventAllOfPayloadMergedConversations mergedConversations) { + this.mergedConversations = JsonNullable.of(mergedConversations); + } + + + public UserMergeEventAllOfPayload discardedMetadata(Object discardedMetadata) { + this.discardedMetadata = JsonNullable.of(discardedMetadata); + + return this; + } + + /** + * A flat object with the set of metadata properties that were discarded when merging the two users. This should contain values only if the combined metadata fields exceed the 4KB limit. + * @return discardedMetadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A flat object with the set of metadata properties that were discarded when merging the two users. This should contain values only if the combined metadata fields exceed the 4KB limit.") + @JsonIgnore + + public Object getDiscardedMetadata() { + return discardedMetadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DISCARDED_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDiscardedMetadata_JsonNullable() { + return discardedMetadata; + } + + @JsonProperty(JSON_PROPERTY_DISCARDED_METADATA) + public void setDiscardedMetadata_JsonNullable(JsonNullable discardedMetadata) { + this.discardedMetadata = discardedMetadata; + } + + public void setDiscardedMetadata(Object discardedMetadata) { + this.discardedMetadata = JsonNullable.of(discardedMetadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserMergeEventAllOfPayload userMergeEventAllOfPayload = (UserMergeEventAllOfPayload) o; + return Objects.equals(this.mergedUsers, userMergeEventAllOfPayload.mergedUsers) && + Objects.equals(this.mergedConversations, userMergeEventAllOfPayload.mergedConversations) && + Objects.equals(this.discardedMetadata, userMergeEventAllOfPayload.discardedMetadata); + } + + @Override + public int hashCode() { + return Objects.hash(mergedUsers, mergedConversations, discardedMetadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserMergeEventAllOfPayload {\n"); + sb.append(" mergedUsers: ").append(toIndentedString(mergedUsers)).append("\n"); + sb.append(" mergedConversations: ").append(toIndentedString(mergedConversations)).append("\n"); + sb.append(" discardedMetadata: ").append(toIndentedString(discardedMetadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/UserMergeEventAllOfPayloadMergedConversations.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserMergeEventAllOfPayloadMergedConversations.java new file mode 100644 index 00000000..c7cdc872 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserMergeEventAllOfPayloadMergedConversations.java @@ -0,0 +1,135 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ConversationTruncated; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Contains information about the conversations that were merged together as a result of the operation, if applicable. If no conversations were merged, this property is omitted. + */ +@ApiModel(description = "Contains information about the conversations that were merged together as a result of the operation, if applicable. If no conversations were merged, this property is omitted.") +@JsonPropertyOrder({ + UserMergeEventAllOfPayloadMergedConversations.JSON_PROPERTY_SURVIVING, + UserMergeEventAllOfPayloadMergedConversations.JSON_PROPERTY_DISCARDED +}) + +public class UserMergeEventAllOfPayloadMergedConversations { + public static final String JSON_PROPERTY_SURVIVING = "surviving"; + private ConversationTruncated surviving = null; + + public static final String JSON_PROPERTY_DISCARDED = "discarded"; + private ConversationTruncated discarded = null; + + + public UserMergeEventAllOfPayloadMergedConversations surviving(ConversationTruncated surviving) { + + this.surviving = surviving; + return this; + } + + /** + * The conversation that now represents the merged conversation object. + * @return surviving + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The conversation that now represents the merged conversation object.") + @JsonProperty(JSON_PROPERTY_SURVIVING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationTruncated getSurviving() { + return surviving; + } + + + public void setSurviving(ConversationTruncated surviving) { + this.surviving = surviving; + } + + + public UserMergeEventAllOfPayloadMergedConversations discarded(ConversationTruncated discarded) { + + this.discarded = discarded; + return this; + } + + /** + * The conversation that was unified into the surviving conversation object. + * @return discarded + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The conversation that was unified into the surviving conversation object.") + @JsonProperty(JSON_PROPERTY_DISCARDED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ConversationTruncated getDiscarded() { + return discarded; + } + + + public void setDiscarded(ConversationTruncated discarded) { + this.discarded = discarded; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserMergeEventAllOfPayloadMergedConversations userMergeEventAllOfPayloadMergedConversations = (UserMergeEventAllOfPayloadMergedConversations) o; + return Objects.equals(this.surviving, userMergeEventAllOfPayloadMergedConversations.surviving) && + Objects.equals(this.discarded, userMergeEventAllOfPayloadMergedConversations.discarded); + } + + @Override + public int hashCode() { + return Objects.hash(surviving, discarded); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserMergeEventAllOfPayloadMergedConversations {\n"); + sb.append(" surviving: ").append(toIndentedString(surviving)).append("\n"); + sb.append(" discarded: ").append(toIndentedString(discarded)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/UserMergeEventAllOfPayloadMergedUsers.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserMergeEventAllOfPayloadMergedUsers.java new file mode 100644 index 00000000..a95d7ec5 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserMergeEventAllOfPayloadMergedUsers.java @@ -0,0 +1,135 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.User; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Contains information about the users that were merged together. + */ +@ApiModel(description = "Contains information about the users that were merged together.") +@JsonPropertyOrder({ + UserMergeEventAllOfPayloadMergedUsers.JSON_PROPERTY_SURVIVING, + UserMergeEventAllOfPayloadMergedUsers.JSON_PROPERTY_DISCARDED +}) + +public class UserMergeEventAllOfPayloadMergedUsers { + public static final String JSON_PROPERTY_SURVIVING = "surviving"; + private User surviving = null; + + public static final String JSON_PROPERTY_DISCARDED = "discarded"; + private User discarded = null; + + + public UserMergeEventAllOfPayloadMergedUsers surviving(User surviving) { + + this.surviving = surviving; + return this; + } + + /** + * The user that now represents the merged user object. + * @return surviving + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The user that now represents the merged user object.") + @JsonProperty(JSON_PROPERTY_SURVIVING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public User getSurviving() { + return surviving; + } + + + public void setSurviving(User surviving) { + this.surviving = surviving; + } + + + public UserMergeEventAllOfPayloadMergedUsers discarded(User discarded) { + + this.discarded = discarded; + return this; + } + + /** + * The user that was unified into the surviving user object. + * @return discarded + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The user that was unified into the surviving user object.") + @JsonProperty(JSON_PROPERTY_DISCARDED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public User getDiscarded() { + return discarded; + } + + + public void setDiscarded(User discarded) { + this.discarded = discarded; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserMergeEventAllOfPayloadMergedUsers userMergeEventAllOfPayloadMergedUsers = (UserMergeEventAllOfPayloadMergedUsers) o; + return Objects.equals(this.surviving, userMergeEventAllOfPayloadMergedUsers.surviving) && + Objects.equals(this.discarded, userMergeEventAllOfPayloadMergedUsers.discarded); + } + + @Override + public int hashCode() { + return Objects.hash(surviving, discarded); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserMergeEventAllOfPayloadMergedUsers {\n"); + sb.append(" surviving: ").append(toIndentedString(surviving)).append("\n"); + sb.append(" discarded: ").append(toIndentedString(discarded)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/UserResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserResponse.java new file mode 100644 index 00000000..36c899be --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserResponse.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.User; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * UserResponse + */ +@JsonPropertyOrder({ + UserResponse.JSON_PROPERTY_USER +}) + +public class UserResponse { + public static final String JSON_PROPERTY_USER = "user"; + private User user = null; + + + public UserResponse user(User user) { + + this.user = user; + return this; + } + + /** + * The user. + * @return user + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The user.") + @JsonProperty(JSON_PROPERTY_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public User getUser() { + return user; + } + + + public void setUser(User user) { + this.user = user; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserResponse userResponse = (UserResponse) o; + return Objects.equals(this.user, userResponse.user); + } + + @Override + public int hashCode() { + return Objects.hash(user); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserResponse {\n"); + sb.append(" user: ").append(toIndentedString(user)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/UserTruncated.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserTruncated.java new file mode 100644 index 00000000..6c5c183c --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserTruncated.java @@ -0,0 +1,146 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * UserTruncated + */ +@JsonPropertyOrder({ + UserTruncated.JSON_PROPERTY_ID, + UserTruncated.JSON_PROPERTY_EXTERNAL_ID +}) + +public class UserTruncated { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_EXTERNAL_ID = "externalId"; + private JsonNullable externalId = JsonNullable.undefined(); + + + public UserTruncated id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the user. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "7494535bff5cef41a15be74d", value = "The unique ID of the user.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public UserTruncated externalId(String externalId) { + this.externalId = JsonNullable.of(externalId); + + return this; + } + + /** + * An optional ID that if specified can also be used to retrieve the user. + * @return externalId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your-own-id", value = "An optional ID that if specified can also be used to retrieve the user. ") + @JsonIgnore + + public String getExternalId() { + return externalId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EXTERNAL_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getExternalId_JsonNullable() { + return externalId; + } + + @JsonProperty(JSON_PROPERTY_EXTERNAL_ID) + public void setExternalId_JsonNullable(JsonNullable externalId) { + this.externalId = externalId; + } + + public void setExternalId(String externalId) { + this.externalId = JsonNullable.of(externalId); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserTruncated userTruncated = (UserTruncated) o; + return Objects.equals(this.id, userTruncated.id) && + Objects.equals(this.externalId, userTruncated.externalId); + } + + @Override + public int hashCode() { + return Objects.hash(id, externalId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserTruncated {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" externalId: ").append(toIndentedString(externalId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/UserUpdateBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserUpdateBody.java new file mode 100644 index 00000000..1ec5921b --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/UserUpdateBody.java @@ -0,0 +1,178 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Profile; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * UserUpdateBody + */ +@JsonPropertyOrder({ + UserUpdateBody.JSON_PROPERTY_SIGNED_UP_AT, + UserUpdateBody.JSON_PROPERTY_PROFILE, + UserUpdateBody.JSON_PROPERTY_METADATA +}) + +public class UserUpdateBody { + public static final String JSON_PROPERTY_SIGNED_UP_AT = "signedUpAt"; + private String signedUpAt = null; + + public static final String JSON_PROPERTY_PROFILE = "profile"; + private Profile profile = null; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + + public UserUpdateBody signedUpAt(String signedUpAt) { + + this.signedUpAt = signedUpAt; + return this; + } + + /** + * Get signedUpAt + * @return signedUpAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SIGNED_UP_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSignedUpAt() { + return signedUpAt; + } + + + public void setSignedUpAt(String signedUpAt) { + this.signedUpAt = signedUpAt; + } + + + public UserUpdateBody profile(Profile profile) { + + this.profile = profile; + return this; + } + + /** + * Get profile + * @return profile + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PROFILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Profile getProfile() { + return profile; + } + + + public void setProfile(Profile profile) { + this.profile = profile; + } + + + public UserUpdateBody metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UserUpdateBody userUpdateBody = (UserUpdateBody) o; + return Objects.equals(this.signedUpAt, userUpdateBody.signedUpAt) && + Objects.equals(this.profile, userUpdateBody.profile) && + Objects.equals(this.metadata, userUpdateBody.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(signedUpAt, profile, metadata); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserUpdateBody {\n"); + sb.append(" signedUpAt: ").append(toIndentedString(signedUpAt)).append("\n"); + sb.append(" profile: ").append(toIndentedString(profile)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Viber.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Viber.java new file mode 100644 index 00000000..a61a44bf --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Viber.java @@ -0,0 +1,215 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Android; +import com.zendesk.sunshine_conversations_client.model.Apple; +import com.zendesk.sunshine_conversations_client.model.Custom; +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.Ios; +import com.zendesk.sunshine_conversations_client.model.Line; +import com.zendesk.sunshine_conversations_client.model.Mailgun; +import com.zendesk.sunshine_conversations_client.model.MessageBird; +import com.zendesk.sunshine_conversations_client.model.Messenger; +import com.zendesk.sunshine_conversations_client.model.Status; +import com.zendesk.sunshine_conversations_client.model.Telegram; +import com.zendesk.sunshine_conversations_client.model.Twilio; +import com.zendesk.sunshine_conversations_client.model.Twitter; +import com.zendesk.sunshine_conversations_client.model.Viber; +import com.zendesk.sunshine_conversations_client.model.ViberAllOf; +import com.zendesk.sunshine_conversations_client.model.Web; +import com.zendesk.sunshine_conversations_client.model.Whatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Viber + */ +@JsonPropertyOrder({ + Viber.JSON_PROPERTY_TYPE, + Viber.JSON_PROPERTY_TOKEN, + Viber.JSON_PROPERTY_URI, + Viber.JSON_PROPERTY_ACCOUNT_ID +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Android.class, name = "android"), + @JsonSubTypes.Type(value = Apple.class, name = "apple"), + @JsonSubTypes.Type(value = Custom.class, name = "custom"), + @JsonSubTypes.Type(value = Ios.class, name = "ios"), + @JsonSubTypes.Type(value = Line.class, name = "line"), + @JsonSubTypes.Type(value = Mailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messagebird"), + @JsonSubTypes.Type(value = Messenger.class, name = "messenger"), + @JsonSubTypes.Type(value = Telegram.class, name = "telegram"), + @JsonSubTypes.Type(value = Twilio.class, name = "twilio"), + @JsonSubTypes.Type(value = Twitter.class, name = "twitter"), + @JsonSubTypes.Type(value = Viber.class, name = "viber"), + @JsonSubTypes.Type(value = Web.class, name = "web"), + @JsonSubTypes.Type(value = Whatsapp.class, name = "whatsapp"), +}) + +public class Viber extends Integration { + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type = "viber"; + + public static final String JSON_PROPERTY_TOKEN = "token"; + private String token; + + public static final String JSON_PROPERTY_URI = "uri"; + private String uri; + + public static final String JSON_PROPERTY_ACCOUNT_ID = "accountId"; + private String accountId; + + + public Viber type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Viber token(String token) { + + this.token = token; + return this; + } + + /** + * Viber Public Account token. + * @return token + **/ + @ApiModelProperty(example = "445da6az1s345z78-dazcczb2542zv51a-e0vc5fva17480im9", required = true, value = "Viber Public Account token.") + @JsonProperty(JSON_PROPERTY_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getToken() { + return token; + } + + + public void setToken(String token) { + this.token = token; + } + + + /** + * Unique URI of the Viber account. + * @return uri + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Unique URI of the Viber account.") + @JsonProperty(JSON_PROPERTY_URI) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUri() { + return uri; + } + + + + + /** + * Unique ID of the Viber account. + * @return accountId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Unique ID of the Viber account.") + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAccountId() { + return accountId; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Viber viber = (Viber) o; + return Objects.equals(this.type, viber.type) && + Objects.equals(this.token, viber.token) && + Objects.equals(this.uri, viber.uri) && + Objects.equals(this.accountId, viber.accountId) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, token, uri, accountId, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Viber {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" uri: ").append(toIndentedString(uri)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ViberAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ViberAllOf.java new file mode 100644 index 00000000..f258d105 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ViberAllOf.java @@ -0,0 +1,177 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * To configure a Viber integration, acquire the Viber Public Account token from the user and call the Create Integration endpoint. + */ +@ApiModel(description = "To configure a Viber integration, acquire the Viber Public Account token from the user and call the Create Integration endpoint. ") +@JsonPropertyOrder({ + ViberAllOf.JSON_PROPERTY_TYPE, + ViberAllOf.JSON_PROPERTY_TOKEN, + ViberAllOf.JSON_PROPERTY_URI, + ViberAllOf.JSON_PROPERTY_ACCOUNT_ID +}) + +public class ViberAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "viber"; + + public static final String JSON_PROPERTY_TOKEN = "token"; + private String token; + + public static final String JSON_PROPERTY_URI = "uri"; + private String uri; + + public static final String JSON_PROPERTY_ACCOUNT_ID = "accountId"; + private String accountId; + + + public ViberAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public ViberAllOf token(String token) { + + this.token = token; + return this; + } + + /** + * Viber Public Account token. + * @return token + **/ + @ApiModelProperty(example = "445da6az1s345z78-dazcczb2542zv51a-e0vc5fva17480im9", required = true, value = "Viber Public Account token.") + @JsonProperty(JSON_PROPERTY_TOKEN) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getToken() { + return token; + } + + + public void setToken(String token) { + this.token = token; + } + + + /** + * Unique URI of the Viber account. + * @return uri + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Unique URI of the Viber account.") + @JsonProperty(JSON_PROPERTY_URI) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getUri() { + return uri; + } + + + + + /** + * Unique ID of the Viber account. + * @return accountId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Unique ID of the Viber account.") + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAccountId() { + return accountId; + } + + + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ViberAllOf viberAllOf = (ViberAllOf) o; + return Objects.equals(this.type, viberAllOf.type) && + Objects.equals(this.token, viberAllOf.token) && + Objects.equals(this.uri, viberAllOf.uri) && + Objects.equals(this.accountId, viberAllOf.accountId); + } + + @Override + public int hashCode() { + return Objects.hash(type, token, uri, accountId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ViberAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" uri: ").append(toIndentedString(uri)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/ViberUpdate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/ViberUpdate.java new file mode 100644 index 00000000..cb0e1b4b --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/ViberUpdate.java @@ -0,0 +1,79 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdateBase; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdate; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ViberUpdate + */ +@JsonPropertyOrder({ +}) + +public class ViberUpdate extends IntegrationUpdateBase implements IntegrationUpdate { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ViberUpdate {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Web.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Web.java new file mode 100644 index 00000000..12922f37 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Web.java @@ -0,0 +1,666 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Android; +import com.zendesk.sunshine_conversations_client.model.Apple; +import com.zendesk.sunshine_conversations_client.model.Custom; +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.Ios; +import com.zendesk.sunshine_conversations_client.model.Line; +import com.zendesk.sunshine_conversations_client.model.Mailgun; +import com.zendesk.sunshine_conversations_client.model.MessageBird; +import com.zendesk.sunshine_conversations_client.model.Messenger; +import com.zendesk.sunshine_conversations_client.model.PrechatCapture; +import com.zendesk.sunshine_conversations_client.model.Status; +import com.zendesk.sunshine_conversations_client.model.Telegram; +import com.zendesk.sunshine_conversations_client.model.Twilio; +import com.zendesk.sunshine_conversations_client.model.Twitter; +import com.zendesk.sunshine_conversations_client.model.Viber; +import com.zendesk.sunshine_conversations_client.model.Web; +import com.zendesk.sunshine_conversations_client.model.WebAllOf; +import com.zendesk.sunshine_conversations_client.model.Whatsapp; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Web + */ +@JsonPropertyOrder({ + Web.JSON_PROPERTY_TYPE, + Web.JSON_PROPERTY_BRAND_COLOR, + Web.JSON_PROPERTY_FIXED_INTRO_PANE, + Web.JSON_PROPERTY_CONVERSATION_COLOR, + Web.JSON_PROPERTY_ACTION_COLOR, + Web.JSON_PROPERTY_DISPLAY_STYLE, + Web.JSON_PROPERTY_BUTTON_ICON_URL, + Web.JSON_PROPERTY_BUTTON_WIDTH, + Web.JSON_PROPERTY_BUTTON_HEIGHT, + Web.JSON_PROPERTY_INTEGRATION_ORDER, + Web.JSON_PROPERTY_BUSINESS_NAME, + Web.JSON_PROPERTY_BUSINESS_ICON_URL, + Web.JSON_PROPERTY_BACKGROUND_IMAGE_URL, + Web.JSON_PROPERTY_ORIGIN_WHITELIST, + Web.JSON_PROPERTY_PRECHAT_CAPTURE, + Web.JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Android.class, name = "android"), + @JsonSubTypes.Type(value = Apple.class, name = "apple"), + @JsonSubTypes.Type(value = Custom.class, name = "custom"), + @JsonSubTypes.Type(value = Ios.class, name = "ios"), + @JsonSubTypes.Type(value = Line.class, name = "line"), + @JsonSubTypes.Type(value = Mailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messagebird"), + @JsonSubTypes.Type(value = Messenger.class, name = "messenger"), + @JsonSubTypes.Type(value = Telegram.class, name = "telegram"), + @JsonSubTypes.Type(value = Twilio.class, name = "twilio"), + @JsonSubTypes.Type(value = Twitter.class, name = "twitter"), + @JsonSubTypes.Type(value = Viber.class, name = "viber"), + @JsonSubTypes.Type(value = Web.class, name = "web"), + @JsonSubTypes.Type(value = Whatsapp.class, name = "whatsapp"), +}) + +public class Web extends Integration { + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type = "web"; + + public static final String JSON_PROPERTY_BRAND_COLOR = "brandColor"; + private String brandColor = "65758e"; + + public static final String JSON_PROPERTY_FIXED_INTRO_PANE = "fixedIntroPane"; + private Boolean fixedIntroPane = false; + + public static final String JSON_PROPERTY_CONVERSATION_COLOR = "conversationColor"; + private String conversationColor = "0099ff"; + + public static final String JSON_PROPERTY_ACTION_COLOR = "actionColor"; + private String actionColor = "0099ff"; + + public static final String JSON_PROPERTY_DISPLAY_STYLE = "displayStyle"; + private String displayStyle = "button"; + + public static final String JSON_PROPERTY_BUTTON_ICON_URL = "buttonIconUrl"; + private JsonNullable buttonIconUrl = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_BUTTON_WIDTH = "buttonWidth"; + private String buttonWidth = "58"; + + public static final String JSON_PROPERTY_BUTTON_HEIGHT = "buttonHeight"; + private String buttonHeight = "58"; + + public static final String JSON_PROPERTY_INTEGRATION_ORDER = "integrationOrder"; + private JsonNullable> integrationOrder = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_BUSINESS_NAME = "businessName"; + private String businessName; + + public static final String JSON_PROPERTY_BUSINESS_ICON_URL = "businessIconUrl"; + private String businessIconUrl; + + public static final String JSON_PROPERTY_BACKGROUND_IMAGE_URL = "backgroundImageUrl"; + private String backgroundImageUrl; + + public static final String JSON_PROPERTY_ORIGIN_WHITELIST = "originWhitelist"; + private JsonNullable> originWhitelist = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_PRECHAT_CAPTURE = "prechatCapture"; + private PrechatCapture prechatCapture = null; + + public static final String JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS = "canUserCreateMoreConversations"; + private Boolean canUserCreateMoreConversations; + + + public Web type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Web brandColor(String brandColor) { + + this.brandColor = brandColor; + return this; + } + + /** + * This color will be used in the messenger header and the button or tab in idle state. Must be a 3 or 6-character hexadecimal color. + * @return brandColor + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This color will be used in the messenger header and the button or tab in idle state. Must be a 3 or 6-character hexadecimal color.") + @JsonProperty(JSON_PROPERTY_BRAND_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBrandColor() { + return brandColor; + } + + + public void setBrandColor(String brandColor) { + this.brandColor = brandColor; + } + + + public Web fixedIntroPane(Boolean fixedIntroPane) { + + this.fixedIntroPane = fixedIntroPane; + return this; + } + + /** + * When true, the introduction pane will be pinned at the top of the conversation instead of scrolling with it. + * @return fixedIntroPane + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "When true, the introduction pane will be pinned at the top of the conversation instead of scrolling with it.") + @JsonProperty(JSON_PROPERTY_FIXED_INTRO_PANE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getFixedIntroPane() { + return fixedIntroPane; + } + + + public void setFixedIntroPane(Boolean fixedIntroPane) { + this.fixedIntroPane = fixedIntroPane; + } + + + public Web conversationColor(String conversationColor) { + + this.conversationColor = conversationColor; + return this; + } + + /** + * This color will be used for customer messages, quick replies and actions in the footer. Must be a 3 or 6-character hexadecimal color. + * @return conversationColor + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This color will be used for customer messages, quick replies and actions in the footer. Must be a 3 or 6-character hexadecimal color.") + @JsonProperty(JSON_PROPERTY_CONVERSATION_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getConversationColor() { + return conversationColor; + } + + + public void setConversationColor(String conversationColor) { + this.conversationColor = conversationColor; + } + + + public Web actionColor(String actionColor) { + + this.actionColor = actionColor; + return this; + } + + /** + * This color will be used for call-to-actions inside your messages. Must be a 3 or 6-character hexadecimal color. + * @return actionColor + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This color will be used for call-to-actions inside your messages. Must be a 3 or 6-character hexadecimal color.") + @JsonProperty(JSON_PROPERTY_ACTION_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getActionColor() { + return actionColor; + } + + + public void setActionColor(String actionColor) { + this.actionColor = actionColor; + } + + + public Web displayStyle(String displayStyle) { + + this.displayStyle = displayStyle; + return this; + } + + /** + * Choose how the messenger will appear on your website. Must be either button or tab. + * @return displayStyle + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Choose how the messenger will appear on your website. Must be either button or tab.") + @JsonProperty(JSON_PROPERTY_DISPLAY_STYLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDisplayStyle() { + return displayStyle; + } + + + public void setDisplayStyle(String displayStyle) { + this.displayStyle = displayStyle; + } + + + public Web buttonIconUrl(String buttonIconUrl) { + this.buttonIconUrl = JsonNullable.of(buttonIconUrl); + + return this; + } + + /** + * With the button style Web Messenger, you have the option of selecting your own button icon. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. + * @return buttonIconUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "http://domain.com/images/avatar.png", value = "With the button style Web Messenger, you have the option of selecting your own button icon. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format.") + @JsonIgnore + + public String getButtonIconUrl() { + return buttonIconUrl.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_BUTTON_ICON_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getButtonIconUrl_JsonNullable() { + return buttonIconUrl; + } + + @JsonProperty(JSON_PROPERTY_BUTTON_ICON_URL) + public void setButtonIconUrl_JsonNullable(JsonNullable buttonIconUrl) { + this.buttonIconUrl = buttonIconUrl; + } + + public void setButtonIconUrl(String buttonIconUrl) { + this.buttonIconUrl = JsonNullable.of(buttonIconUrl); + } + + + public Web buttonWidth(String buttonWidth) { + + this.buttonWidth = buttonWidth; + return this; + } + + /** + * With the button style Web Messenger, you have the option of specifying the button width. + * @return buttonWidth + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "With the button style Web Messenger, you have the option of specifying the button width.") + @JsonProperty(JSON_PROPERTY_BUTTON_WIDTH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getButtonWidth() { + return buttonWidth; + } + + + public void setButtonWidth(String buttonWidth) { + this.buttonWidth = buttonWidth; + } + + + public Web buttonHeight(String buttonHeight) { + + this.buttonHeight = buttonHeight; + return this; + } + + /** + * With the button style Web Messenger, you have the option of specifying the button height. + * @return buttonHeight + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "With the button style Web Messenger, you have the option of specifying the button height.") + @JsonProperty(JSON_PROPERTY_BUTTON_HEIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getButtonHeight() { + return buttonHeight; + } + + + public void setButtonHeight(String buttonHeight) { + this.buttonHeight = buttonHeight; + } + + + public Web integrationOrder(List integrationOrder) { + this.integrationOrder = JsonNullable.>of(integrationOrder); + + return this; + } + + public Web addIntegrationOrderItem(String integrationOrderItem) { + if (this.integrationOrder == null || !this.integrationOrder.isPresent()) { + this.integrationOrder = JsonNullable.>of(new ArrayList()); + } + try { + this.integrationOrder.get().add(integrationOrderItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed. + * @return integrationOrder + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "[\"59fc8466260f48003505228b\",\"59d79780481d34002b7d3617\"]", value = "Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed.") + @JsonIgnore + + public List getIntegrationOrder() { + return integrationOrder.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTEGRATION_ORDER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getIntegrationOrder_JsonNullable() { + return integrationOrder; + } + + @JsonProperty(JSON_PROPERTY_INTEGRATION_ORDER) + public void setIntegrationOrder_JsonNullable(JsonNullable> integrationOrder) { + this.integrationOrder = integrationOrder; + } + + public void setIntegrationOrder(List integrationOrder) { + this.integrationOrder = JsonNullable.>of(integrationOrder); + } + + + public Web businessName(String businessName) { + + this.businessName = businessName; + return this; + } + + /** + * A custom business name for the Web Messenger. + * @return businessName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Kent Shop", value = "A custom business name for the Web Messenger.") + @JsonProperty(JSON_PROPERTY_BUSINESS_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBusinessName() { + return businessName; + } + + + public void setBusinessName(String businessName) { + this.businessName = businessName; + } + + + public Web businessIconUrl(String businessIconUrl) { + + this.businessIconUrl = businessIconUrl; + return this; + } + + /** + * A custom business icon url for the Web Messenger. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. + * @return businessIconUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://www.gravatar.com/image.jpg", value = "A custom business icon url for the Web Messenger. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format.") + @JsonProperty(JSON_PROPERTY_BUSINESS_ICON_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBusinessIconUrl() { + return businessIconUrl; + } + + + public void setBusinessIconUrl(String businessIconUrl) { + this.businessIconUrl = businessIconUrl; + } + + + public Web backgroundImageUrl(String backgroundImageUrl) { + + this.backgroundImageUrl = backgroundImageUrl; + return this; + } + + /** + * A background image url for the conversation. Image will be tiled to fit the window. + * @return backgroundImageUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://a-beautiful-tile.png", value = "A background image url for the conversation. Image will be tiled to fit the window.") + @JsonProperty(JSON_PROPERTY_BACKGROUND_IMAGE_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBackgroundImageUrl() { + return backgroundImageUrl; + } + + + public void setBackgroundImageUrl(String backgroundImageUrl) { + this.backgroundImageUrl = backgroundImageUrl; + } + + + public Web originWhitelist(List originWhitelist) { + this.originWhitelist = JsonNullable.>of(originWhitelist); + + return this; + } + + public Web addOriginWhitelistItem(String originWhitelistItem) { + if (this.originWhitelist == null || !this.originWhitelist.isPresent()) { + this.originWhitelist = JsonNullable.>of(new ArrayList()); + } + try { + this.originWhitelist.get().add(originWhitelistItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454: scheme \"://\" host [ \":\" port ], where scheme is http or https. + * @return originWhitelist + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "[\"https://yourdomain.com\"]", value = "A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454: scheme \"://\" host [ \":\" port ], where scheme is http or https. ") + @JsonIgnore + + public List getOriginWhitelist() { + return originWhitelist.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ORIGIN_WHITELIST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getOriginWhitelist_JsonNullable() { + return originWhitelist; + } + + @JsonProperty(JSON_PROPERTY_ORIGIN_WHITELIST) + public void setOriginWhitelist_JsonNullable(JsonNullable> originWhitelist) { + this.originWhitelist = originWhitelist; + } + + public void setOriginWhitelist(List originWhitelist) { + this.originWhitelist = JsonNullable.>of(originWhitelist); + } + + + public Web prechatCapture(PrechatCapture prechatCapture) { + + this.prechatCapture = prechatCapture; + return this; + } + + /** + * Object whose properties can be set to specify the add-on’s options. See the [guide](https://docs.smooch.io/guide/web-messenger/#prechat-capture) to learn more about Prechat Capture. + * @return prechatCapture + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Object whose properties can be set to specify the add-on’s options. See the [guide](https://docs.smooch.io/guide/web-messenger/#prechat-capture) to learn more about Prechat Capture.") + @JsonProperty(JSON_PROPERTY_PRECHAT_CAPTURE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public PrechatCapture getPrechatCapture() { + return prechatCapture; + } + + + public void setPrechatCapture(PrechatCapture prechatCapture) { + this.prechatCapture = prechatCapture; + } + + + public Web canUserCreateMoreConversations(Boolean canUserCreateMoreConversations) { + + this.canUserCreateMoreConversations = canUserCreateMoreConversations; + return this; + } + + /** + * Allows users to create more than one conversation on the web messenger integration. + * @return canUserCreateMoreConversations + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Allows users to create more than one conversation on the web messenger integration.") + @JsonProperty(JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getCanUserCreateMoreConversations() { + return canUserCreateMoreConversations; + } + + + public void setCanUserCreateMoreConversations(Boolean canUserCreateMoreConversations) { + this.canUserCreateMoreConversations = canUserCreateMoreConversations; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Web web = (Web) o; + return Objects.equals(this.type, web.type) && + Objects.equals(this.brandColor, web.brandColor) && + Objects.equals(this.fixedIntroPane, web.fixedIntroPane) && + Objects.equals(this.conversationColor, web.conversationColor) && + Objects.equals(this.actionColor, web.actionColor) && + Objects.equals(this.displayStyle, web.displayStyle) && + Objects.equals(this.buttonIconUrl, web.buttonIconUrl) && + Objects.equals(this.buttonWidth, web.buttonWidth) && + Objects.equals(this.buttonHeight, web.buttonHeight) && + Objects.equals(this.integrationOrder, web.integrationOrder) && + Objects.equals(this.businessName, web.businessName) && + Objects.equals(this.businessIconUrl, web.businessIconUrl) && + Objects.equals(this.backgroundImageUrl, web.backgroundImageUrl) && + Objects.equals(this.originWhitelist, web.originWhitelist) && + Objects.equals(this.prechatCapture, web.prechatCapture) && + Objects.equals(this.canUserCreateMoreConversations, web.canUserCreateMoreConversations) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, brandColor, fixedIntroPane, conversationColor, actionColor, displayStyle, buttonIconUrl, buttonWidth, buttonHeight, integrationOrder, businessName, businessIconUrl, backgroundImageUrl, originWhitelist, prechatCapture, canUserCreateMoreConversations, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Web {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" brandColor: ").append(toIndentedString(brandColor)).append("\n"); + sb.append(" fixedIntroPane: ").append(toIndentedString(fixedIntroPane)).append("\n"); + sb.append(" conversationColor: ").append(toIndentedString(conversationColor)).append("\n"); + sb.append(" actionColor: ").append(toIndentedString(actionColor)).append("\n"); + sb.append(" displayStyle: ").append(toIndentedString(displayStyle)).append("\n"); + sb.append(" buttonIconUrl: ").append(toIndentedString(buttonIconUrl)).append("\n"); + sb.append(" buttonWidth: ").append(toIndentedString(buttonWidth)).append("\n"); + sb.append(" buttonHeight: ").append(toIndentedString(buttonHeight)).append("\n"); + sb.append(" integrationOrder: ").append(toIndentedString(integrationOrder)).append("\n"); + sb.append(" businessName: ").append(toIndentedString(businessName)).append("\n"); + sb.append(" businessIconUrl: ").append(toIndentedString(businessIconUrl)).append("\n"); + sb.append(" backgroundImageUrl: ").append(toIndentedString(backgroundImageUrl)).append("\n"); + sb.append(" originWhitelist: ").append(toIndentedString(originWhitelist)).append("\n"); + sb.append(" prechatCapture: ").append(toIndentedString(prechatCapture)).append("\n"); + sb.append(" canUserCreateMoreConversations: ").append(toIndentedString(canUserCreateMoreConversations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/WebAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebAllOf.java new file mode 100644 index 00000000..ef49c627 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebAllOf.java @@ -0,0 +1,628 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.PrechatCapture; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * To configure a Web Messenger integration, acquire the required information and call the Create Integration endpoint. + */ +@ApiModel(description = "To configure a Web Messenger integration, acquire the required information and call the Create Integration endpoint. ") +@JsonPropertyOrder({ + WebAllOf.JSON_PROPERTY_TYPE, + WebAllOf.JSON_PROPERTY_BRAND_COLOR, + WebAllOf.JSON_PROPERTY_FIXED_INTRO_PANE, + WebAllOf.JSON_PROPERTY_CONVERSATION_COLOR, + WebAllOf.JSON_PROPERTY_ACTION_COLOR, + WebAllOf.JSON_PROPERTY_DISPLAY_STYLE, + WebAllOf.JSON_PROPERTY_BUTTON_ICON_URL, + WebAllOf.JSON_PROPERTY_BUTTON_WIDTH, + WebAllOf.JSON_PROPERTY_BUTTON_HEIGHT, + WebAllOf.JSON_PROPERTY_INTEGRATION_ORDER, + WebAllOf.JSON_PROPERTY_BUSINESS_NAME, + WebAllOf.JSON_PROPERTY_BUSINESS_ICON_URL, + WebAllOf.JSON_PROPERTY_BACKGROUND_IMAGE_URL, + WebAllOf.JSON_PROPERTY_ORIGIN_WHITELIST, + WebAllOf.JSON_PROPERTY_PRECHAT_CAPTURE, + WebAllOf.JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS +}) + +public class WebAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "web"; + + public static final String JSON_PROPERTY_BRAND_COLOR = "brandColor"; + private String brandColor = "65758e"; + + public static final String JSON_PROPERTY_FIXED_INTRO_PANE = "fixedIntroPane"; + private Boolean fixedIntroPane = false; + + public static final String JSON_PROPERTY_CONVERSATION_COLOR = "conversationColor"; + private String conversationColor = "0099ff"; + + public static final String JSON_PROPERTY_ACTION_COLOR = "actionColor"; + private String actionColor = "0099ff"; + + public static final String JSON_PROPERTY_DISPLAY_STYLE = "displayStyle"; + private String displayStyle = "button"; + + public static final String JSON_PROPERTY_BUTTON_ICON_URL = "buttonIconUrl"; + private JsonNullable buttonIconUrl = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_BUTTON_WIDTH = "buttonWidth"; + private String buttonWidth = "58"; + + public static final String JSON_PROPERTY_BUTTON_HEIGHT = "buttonHeight"; + private String buttonHeight = "58"; + + public static final String JSON_PROPERTY_INTEGRATION_ORDER = "integrationOrder"; + private JsonNullable> integrationOrder = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_BUSINESS_NAME = "businessName"; + private String businessName; + + public static final String JSON_PROPERTY_BUSINESS_ICON_URL = "businessIconUrl"; + private String businessIconUrl; + + public static final String JSON_PROPERTY_BACKGROUND_IMAGE_URL = "backgroundImageUrl"; + private String backgroundImageUrl; + + public static final String JSON_PROPERTY_ORIGIN_WHITELIST = "originWhitelist"; + private JsonNullable> originWhitelist = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_PRECHAT_CAPTURE = "prechatCapture"; + private PrechatCapture prechatCapture = null; + + public static final String JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS = "canUserCreateMoreConversations"; + private Boolean canUserCreateMoreConversations; + + + public WebAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public WebAllOf brandColor(String brandColor) { + + this.brandColor = brandColor; + return this; + } + + /** + * This color will be used in the messenger header and the button or tab in idle state. Must be a 3 or 6-character hexadecimal color. + * @return brandColor + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This color will be used in the messenger header and the button or tab in idle state. Must be a 3 or 6-character hexadecimal color.") + @JsonProperty(JSON_PROPERTY_BRAND_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBrandColor() { + return brandColor; + } + + + public void setBrandColor(String brandColor) { + this.brandColor = brandColor; + } + + + public WebAllOf fixedIntroPane(Boolean fixedIntroPane) { + + this.fixedIntroPane = fixedIntroPane; + return this; + } + + /** + * When true, the introduction pane will be pinned at the top of the conversation instead of scrolling with it. + * @return fixedIntroPane + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "When true, the introduction pane will be pinned at the top of the conversation instead of scrolling with it.") + @JsonProperty(JSON_PROPERTY_FIXED_INTRO_PANE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getFixedIntroPane() { + return fixedIntroPane; + } + + + public void setFixedIntroPane(Boolean fixedIntroPane) { + this.fixedIntroPane = fixedIntroPane; + } + + + public WebAllOf conversationColor(String conversationColor) { + + this.conversationColor = conversationColor; + return this; + } + + /** + * This color will be used for customer messages, quick replies and actions in the footer. Must be a 3 or 6-character hexadecimal color. + * @return conversationColor + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This color will be used for customer messages, quick replies and actions in the footer. Must be a 3 or 6-character hexadecimal color.") + @JsonProperty(JSON_PROPERTY_CONVERSATION_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getConversationColor() { + return conversationColor; + } + + + public void setConversationColor(String conversationColor) { + this.conversationColor = conversationColor; + } + + + public WebAllOf actionColor(String actionColor) { + + this.actionColor = actionColor; + return this; + } + + /** + * This color will be used for call-to-actions inside your messages. Must be a 3 or 6-character hexadecimal color. + * @return actionColor + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This color will be used for call-to-actions inside your messages. Must be a 3 or 6-character hexadecimal color.") + @JsonProperty(JSON_PROPERTY_ACTION_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getActionColor() { + return actionColor; + } + + + public void setActionColor(String actionColor) { + this.actionColor = actionColor; + } + + + public WebAllOf displayStyle(String displayStyle) { + + this.displayStyle = displayStyle; + return this; + } + + /** + * Choose how the messenger will appear on your website. Must be either button or tab. + * @return displayStyle + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Choose how the messenger will appear on your website. Must be either button or tab.") + @JsonProperty(JSON_PROPERTY_DISPLAY_STYLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDisplayStyle() { + return displayStyle; + } + + + public void setDisplayStyle(String displayStyle) { + this.displayStyle = displayStyle; + } + + + public WebAllOf buttonIconUrl(String buttonIconUrl) { + this.buttonIconUrl = JsonNullable.of(buttonIconUrl); + + return this; + } + + /** + * With the button style Web Messenger, you have the option of selecting your own button icon. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. + * @return buttonIconUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "http://domain.com/images/avatar.png", value = "With the button style Web Messenger, you have the option of selecting your own button icon. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format.") + @JsonIgnore + + public String getButtonIconUrl() { + return buttonIconUrl.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_BUTTON_ICON_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getButtonIconUrl_JsonNullable() { + return buttonIconUrl; + } + + @JsonProperty(JSON_PROPERTY_BUTTON_ICON_URL) + public void setButtonIconUrl_JsonNullable(JsonNullable buttonIconUrl) { + this.buttonIconUrl = buttonIconUrl; + } + + public void setButtonIconUrl(String buttonIconUrl) { + this.buttonIconUrl = JsonNullable.of(buttonIconUrl); + } + + + public WebAllOf buttonWidth(String buttonWidth) { + + this.buttonWidth = buttonWidth; + return this; + } + + /** + * With the button style Web Messenger, you have the option of specifying the button width. + * @return buttonWidth + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "With the button style Web Messenger, you have the option of specifying the button width.") + @JsonProperty(JSON_PROPERTY_BUTTON_WIDTH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getButtonWidth() { + return buttonWidth; + } + + + public void setButtonWidth(String buttonWidth) { + this.buttonWidth = buttonWidth; + } + + + public WebAllOf buttonHeight(String buttonHeight) { + + this.buttonHeight = buttonHeight; + return this; + } + + /** + * With the button style Web Messenger, you have the option of specifying the button height. + * @return buttonHeight + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "With the button style Web Messenger, you have the option of specifying the button height.") + @JsonProperty(JSON_PROPERTY_BUTTON_HEIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getButtonHeight() { + return buttonHeight; + } + + + public void setButtonHeight(String buttonHeight) { + this.buttonHeight = buttonHeight; + } + + + public WebAllOf integrationOrder(List integrationOrder) { + this.integrationOrder = JsonNullable.>of(integrationOrder); + + return this; + } + + public WebAllOf addIntegrationOrderItem(String integrationOrderItem) { + if (this.integrationOrder == null || !this.integrationOrder.isPresent()) { + this.integrationOrder = JsonNullable.>of(new ArrayList()); + } + try { + this.integrationOrder.get().add(integrationOrderItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed. + * @return integrationOrder + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "[\"59fc8466260f48003505228b\",\"59d79780481d34002b7d3617\"]", value = "Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed.") + @JsonIgnore + + public List getIntegrationOrder() { + return integrationOrder.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTEGRATION_ORDER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getIntegrationOrder_JsonNullable() { + return integrationOrder; + } + + @JsonProperty(JSON_PROPERTY_INTEGRATION_ORDER) + public void setIntegrationOrder_JsonNullable(JsonNullable> integrationOrder) { + this.integrationOrder = integrationOrder; + } + + public void setIntegrationOrder(List integrationOrder) { + this.integrationOrder = JsonNullable.>of(integrationOrder); + } + + + public WebAllOf businessName(String businessName) { + + this.businessName = businessName; + return this; + } + + /** + * A custom business name for the Web Messenger. + * @return businessName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Kent Shop", value = "A custom business name for the Web Messenger.") + @JsonProperty(JSON_PROPERTY_BUSINESS_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBusinessName() { + return businessName; + } + + + public void setBusinessName(String businessName) { + this.businessName = businessName; + } + + + public WebAllOf businessIconUrl(String businessIconUrl) { + + this.businessIconUrl = businessIconUrl; + return this; + } + + /** + * A custom business icon url for the Web Messenger. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. + * @return businessIconUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://www.gravatar.com/image.jpg", value = "A custom business icon url for the Web Messenger. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format.") + @JsonProperty(JSON_PROPERTY_BUSINESS_ICON_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBusinessIconUrl() { + return businessIconUrl; + } + + + public void setBusinessIconUrl(String businessIconUrl) { + this.businessIconUrl = businessIconUrl; + } + + + public WebAllOf backgroundImageUrl(String backgroundImageUrl) { + + this.backgroundImageUrl = backgroundImageUrl; + return this; + } + + /** + * A background image url for the conversation. Image will be tiled to fit the window. + * @return backgroundImageUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://a-beautiful-tile.png", value = "A background image url for the conversation. Image will be tiled to fit the window.") + @JsonProperty(JSON_PROPERTY_BACKGROUND_IMAGE_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBackgroundImageUrl() { + return backgroundImageUrl; + } + + + public void setBackgroundImageUrl(String backgroundImageUrl) { + this.backgroundImageUrl = backgroundImageUrl; + } + + + public WebAllOf originWhitelist(List originWhitelist) { + this.originWhitelist = JsonNullable.>of(originWhitelist); + + return this; + } + + public WebAllOf addOriginWhitelistItem(String originWhitelistItem) { + if (this.originWhitelist == null || !this.originWhitelist.isPresent()) { + this.originWhitelist = JsonNullable.>of(new ArrayList()); + } + try { + this.originWhitelist.get().add(originWhitelistItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454: scheme \"://\" host [ \":\" port ], where scheme is http or https. + * @return originWhitelist + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "[\"https://yourdomain.com\"]", value = "A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454: scheme \"://\" host [ \":\" port ], where scheme is http or https. ") + @JsonIgnore + + public List getOriginWhitelist() { + return originWhitelist.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ORIGIN_WHITELIST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getOriginWhitelist_JsonNullable() { + return originWhitelist; + } + + @JsonProperty(JSON_PROPERTY_ORIGIN_WHITELIST) + public void setOriginWhitelist_JsonNullable(JsonNullable> originWhitelist) { + this.originWhitelist = originWhitelist; + } + + public void setOriginWhitelist(List originWhitelist) { + this.originWhitelist = JsonNullable.>of(originWhitelist); + } + + + public WebAllOf prechatCapture(PrechatCapture prechatCapture) { + + this.prechatCapture = prechatCapture; + return this; + } + + /** + * Object whose properties can be set to specify the add-on’s options. See the [guide](https://docs.smooch.io/guide/web-messenger/#prechat-capture) to learn more about Prechat Capture. + * @return prechatCapture + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Object whose properties can be set to specify the add-on’s options. See the [guide](https://docs.smooch.io/guide/web-messenger/#prechat-capture) to learn more about Prechat Capture.") + @JsonProperty(JSON_PROPERTY_PRECHAT_CAPTURE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public PrechatCapture getPrechatCapture() { + return prechatCapture; + } + + + public void setPrechatCapture(PrechatCapture prechatCapture) { + this.prechatCapture = prechatCapture; + } + + + public WebAllOf canUserCreateMoreConversations(Boolean canUserCreateMoreConversations) { + + this.canUserCreateMoreConversations = canUserCreateMoreConversations; + return this; + } + + /** + * Allows users to create more than one conversation on the web messenger integration. + * @return canUserCreateMoreConversations + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Allows users to create more than one conversation on the web messenger integration.") + @JsonProperty(JSON_PROPERTY_CAN_USER_CREATE_MORE_CONVERSATIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getCanUserCreateMoreConversations() { + return canUserCreateMoreConversations; + } + + + public void setCanUserCreateMoreConversations(Boolean canUserCreateMoreConversations) { + this.canUserCreateMoreConversations = canUserCreateMoreConversations; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebAllOf webAllOf = (WebAllOf) o; + return Objects.equals(this.type, webAllOf.type) && + Objects.equals(this.brandColor, webAllOf.brandColor) && + Objects.equals(this.fixedIntroPane, webAllOf.fixedIntroPane) && + Objects.equals(this.conversationColor, webAllOf.conversationColor) && + Objects.equals(this.actionColor, webAllOf.actionColor) && + Objects.equals(this.displayStyle, webAllOf.displayStyle) && + Objects.equals(this.buttonIconUrl, webAllOf.buttonIconUrl) && + Objects.equals(this.buttonWidth, webAllOf.buttonWidth) && + Objects.equals(this.buttonHeight, webAllOf.buttonHeight) && + Objects.equals(this.integrationOrder, webAllOf.integrationOrder) && + Objects.equals(this.businessName, webAllOf.businessName) && + Objects.equals(this.businessIconUrl, webAllOf.businessIconUrl) && + Objects.equals(this.backgroundImageUrl, webAllOf.backgroundImageUrl) && + Objects.equals(this.originWhitelist, webAllOf.originWhitelist) && + Objects.equals(this.prechatCapture, webAllOf.prechatCapture) && + Objects.equals(this.canUserCreateMoreConversations, webAllOf.canUserCreateMoreConversations); + } + + @Override + public int hashCode() { + return Objects.hash(type, brandColor, fixedIntroPane, conversationColor, actionColor, displayStyle, buttonIconUrl, buttonWidth, buttonHeight, integrationOrder, businessName, businessIconUrl, backgroundImageUrl, originWhitelist, prechatCapture, canUserCreateMoreConversations); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" brandColor: ").append(toIndentedString(brandColor)).append("\n"); + sb.append(" fixedIntroPane: ").append(toIndentedString(fixedIntroPane)).append("\n"); + sb.append(" conversationColor: ").append(toIndentedString(conversationColor)).append("\n"); + sb.append(" actionColor: ").append(toIndentedString(actionColor)).append("\n"); + sb.append(" displayStyle: ").append(toIndentedString(displayStyle)).append("\n"); + sb.append(" buttonIconUrl: ").append(toIndentedString(buttonIconUrl)).append("\n"); + sb.append(" buttonWidth: ").append(toIndentedString(buttonWidth)).append("\n"); + sb.append(" buttonHeight: ").append(toIndentedString(buttonHeight)).append("\n"); + sb.append(" integrationOrder: ").append(toIndentedString(integrationOrder)).append("\n"); + sb.append(" businessName: ").append(toIndentedString(businessName)).append("\n"); + sb.append(" businessIconUrl: ").append(toIndentedString(businessIconUrl)).append("\n"); + sb.append(" backgroundImageUrl: ").append(toIndentedString(backgroundImageUrl)).append("\n"); + sb.append(" originWhitelist: ").append(toIndentedString(originWhitelist)).append("\n"); + sb.append(" prechatCapture: ").append(toIndentedString(prechatCapture)).append("\n"); + sb.append(" canUserCreateMoreConversations: ").append(toIndentedString(canUserCreateMoreConversations)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/WebUpdate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebUpdate.java new file mode 100644 index 00000000..8d1124ba --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebUpdate.java @@ -0,0 +1,640 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdateBase; +import com.zendesk.sunshine_conversations_client.model.PrechatCapture; +import com.zendesk.sunshine_conversations_client.model.WebUpdateAllOf; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdate; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * WebUpdate + */ +@JsonPropertyOrder({ + WebUpdate.JSON_PROPERTY_DISPLAY_NAME, + WebUpdate.JSON_PROPERTY_BRAND_COLOR, + WebUpdate.JSON_PROPERTY_FIXED_INTRO_PANE, + WebUpdate.JSON_PROPERTY_CONVERSATION_COLOR, + WebUpdate.JSON_PROPERTY_ACTION_COLOR, + WebUpdate.JSON_PROPERTY_DISPLAY_STYLE, + WebUpdate.JSON_PROPERTY_BUTTON_ICON_URL, + WebUpdate.JSON_PROPERTY_BUTTON_WIDTH, + WebUpdate.JSON_PROPERTY_BUTTON_HEIGHT, + WebUpdate.JSON_PROPERTY_INTEGRATION_ORDER, + WebUpdate.JSON_PROPERTY_BUSINESS_NAME, + WebUpdate.JSON_PROPERTY_BUSINESS_ICON_URL, + WebUpdate.JSON_PROPERTY_BACKGROUND_IMAGE_URL, + WebUpdate.JSON_PROPERTY_ORIGIN_WHITELIST, + WebUpdate.JSON_PROPERTY_PRECHAT_CAPTURE, + WebUpdate.JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION +}) + +public class WebUpdate implements IntegrationUpdate { + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private JsonNullable displayName = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_BRAND_COLOR = "brandColor"; + private String brandColor = "65758e"; + + public static final String JSON_PROPERTY_FIXED_INTRO_PANE = "fixedIntroPane"; + private Boolean fixedIntroPane = false; + + public static final String JSON_PROPERTY_CONVERSATION_COLOR = "conversationColor"; + private String conversationColor = "0099ff"; + + public static final String JSON_PROPERTY_ACTION_COLOR = "actionColor"; + private String actionColor = "0099ff"; + + public static final String JSON_PROPERTY_DISPLAY_STYLE = "displayStyle"; + private String displayStyle = "button"; + + public static final String JSON_PROPERTY_BUTTON_ICON_URL = "buttonIconUrl"; + private JsonNullable buttonIconUrl = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_BUTTON_WIDTH = "buttonWidth"; + private String buttonWidth = "58"; + + public static final String JSON_PROPERTY_BUTTON_HEIGHT = "buttonHeight"; + private String buttonHeight = "58"; + + public static final String JSON_PROPERTY_INTEGRATION_ORDER = "integrationOrder"; + private JsonNullable> integrationOrder = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_BUSINESS_NAME = "businessName"; + private String businessName; + + public static final String JSON_PROPERTY_BUSINESS_ICON_URL = "businessIconUrl"; + private String businessIconUrl; + + public static final String JSON_PROPERTY_BACKGROUND_IMAGE_URL = "backgroundImageUrl"; + private String backgroundImageUrl; + + public static final String JSON_PROPERTY_ORIGIN_WHITELIST = "originWhitelist"; + private JsonNullable> originWhitelist = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_PRECHAT_CAPTURE = "prechatCapture"; + private PrechatCapture prechatCapture = null; + + public static final String JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION = "canUserCreateConversation"; + private Boolean canUserCreateConversation; + + + public WebUpdate displayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + + return this; + } + + /** + * A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "My awesome integration", value = "A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`.") + @JsonIgnore + + public String getDisplayName() { + return displayName.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDisplayName_JsonNullable() { + return displayName; + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + public void setDisplayName_JsonNullable(JsonNullable displayName) { + this.displayName = displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + } + + + public WebUpdate brandColor(String brandColor) { + + this.brandColor = brandColor; + return this; + } + + /** + * This color will be used in the messenger header and the button or tab in idle state. Must be a 3 or 6-character hexadecimal color. + * @return brandColor + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This color will be used in the messenger header and the button or tab in idle state. Must be a 3 or 6-character hexadecimal color.") + @JsonProperty(JSON_PROPERTY_BRAND_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBrandColor() { + return brandColor; + } + + + public void setBrandColor(String brandColor) { + this.brandColor = brandColor; + } + + + public WebUpdate fixedIntroPane(Boolean fixedIntroPane) { + + this.fixedIntroPane = fixedIntroPane; + return this; + } + + /** + * When true, the introduction pane will be pinned at the top of the conversation instead of scrolling with it. + * @return fixedIntroPane + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "When true, the introduction pane will be pinned at the top of the conversation instead of scrolling with it.") + @JsonProperty(JSON_PROPERTY_FIXED_INTRO_PANE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getFixedIntroPane() { + return fixedIntroPane; + } + + + public void setFixedIntroPane(Boolean fixedIntroPane) { + this.fixedIntroPane = fixedIntroPane; + } + + + public WebUpdate conversationColor(String conversationColor) { + + this.conversationColor = conversationColor; + return this; + } + + /** + * This color will be used for customer messages, quick replies and actions in the footer. Must be a 3 or 6-character hexadecimal color. + * @return conversationColor + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This color will be used for customer messages, quick replies and actions in the footer. Must be a 3 or 6-character hexadecimal color.") + @JsonProperty(JSON_PROPERTY_CONVERSATION_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getConversationColor() { + return conversationColor; + } + + + public void setConversationColor(String conversationColor) { + this.conversationColor = conversationColor; + } + + + public WebUpdate actionColor(String actionColor) { + + this.actionColor = actionColor; + return this; + } + + /** + * This color will be used for call-to-actions inside your messages. Must be a 3 or 6-character hexadecimal color. + * @return actionColor + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This color will be used for call-to-actions inside your messages. Must be a 3 or 6-character hexadecimal color.") + @JsonProperty(JSON_PROPERTY_ACTION_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getActionColor() { + return actionColor; + } + + + public void setActionColor(String actionColor) { + this.actionColor = actionColor; + } + + + public WebUpdate displayStyle(String displayStyle) { + + this.displayStyle = displayStyle; + return this; + } + + /** + * Choose how the messenger will appear on your website. Must be either button or tab. + * @return displayStyle + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Choose how the messenger will appear on your website. Must be either button or tab.") + @JsonProperty(JSON_PROPERTY_DISPLAY_STYLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDisplayStyle() { + return displayStyle; + } + + + public void setDisplayStyle(String displayStyle) { + this.displayStyle = displayStyle; + } + + + public WebUpdate buttonIconUrl(String buttonIconUrl) { + this.buttonIconUrl = JsonNullable.of(buttonIconUrl); + + return this; + } + + /** + * With the button style Web Messenger, you have the option of selecting your own button icon. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. + * @return buttonIconUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "With the button style Web Messenger, you have the option of selecting your own button icon. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format.") + @JsonIgnore + + public String getButtonIconUrl() { + return buttonIconUrl.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_BUTTON_ICON_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getButtonIconUrl_JsonNullable() { + return buttonIconUrl; + } + + @JsonProperty(JSON_PROPERTY_BUTTON_ICON_URL) + public void setButtonIconUrl_JsonNullable(JsonNullable buttonIconUrl) { + this.buttonIconUrl = buttonIconUrl; + } + + public void setButtonIconUrl(String buttonIconUrl) { + this.buttonIconUrl = JsonNullable.of(buttonIconUrl); + } + + + public WebUpdate buttonWidth(String buttonWidth) { + + this.buttonWidth = buttonWidth; + return this; + } + + /** + * With the button style Web Messenger, you have the option of specifying the button width. + * @return buttonWidth + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "With the button style Web Messenger, you have the option of specifying the button width.") + @JsonProperty(JSON_PROPERTY_BUTTON_WIDTH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getButtonWidth() { + return buttonWidth; + } + + + public void setButtonWidth(String buttonWidth) { + this.buttonWidth = buttonWidth; + } + + + public WebUpdate buttonHeight(String buttonHeight) { + + this.buttonHeight = buttonHeight; + return this; + } + + /** + * With the button style Web Messenger, you have the option of specifying the button height. + * @return buttonHeight + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "With the button style Web Messenger, you have the option of specifying the button height.") + @JsonProperty(JSON_PROPERTY_BUTTON_HEIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getButtonHeight() { + return buttonHeight; + } + + + public void setButtonHeight(String buttonHeight) { + this.buttonHeight = buttonHeight; + } + + + public WebUpdate integrationOrder(List integrationOrder) { + this.integrationOrder = JsonNullable.>of(integrationOrder); + + return this; + } + + public WebUpdate addIntegrationOrderItem(String integrationOrderItem) { + if (this.integrationOrder == null || !this.integrationOrder.isPresent()) { + this.integrationOrder = JsonNullable.>of(new ArrayList()); + } + try { + this.integrationOrder.get().add(integrationOrderItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed. + * @return integrationOrder + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "[\"59fc8466260f48003505228b\",\"59d79780481d34002b7d3617\"]", value = "Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed.") + @JsonIgnore + + public List getIntegrationOrder() { + return integrationOrder.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTEGRATION_ORDER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getIntegrationOrder_JsonNullable() { + return integrationOrder; + } + + @JsonProperty(JSON_PROPERTY_INTEGRATION_ORDER) + public void setIntegrationOrder_JsonNullable(JsonNullable> integrationOrder) { + this.integrationOrder = integrationOrder; + } + + public void setIntegrationOrder(List integrationOrder) { + this.integrationOrder = JsonNullable.>of(integrationOrder); + } + + + public WebUpdate businessName(String businessName) { + + this.businessName = businessName; + return this; + } + + /** + * A custom business name for the Web Messenger. + * @return businessName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Kent Shop", value = "A custom business name for the Web Messenger.") + @JsonProperty(JSON_PROPERTY_BUSINESS_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBusinessName() { + return businessName; + } + + + public void setBusinessName(String businessName) { + this.businessName = businessName; + } + + + public WebUpdate businessIconUrl(String businessIconUrl) { + + this.businessIconUrl = businessIconUrl; + return this; + } + + /** + * A custom business icon url for the Web Messenger. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. + * @return businessIconUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://www.gravatar.com/image.jpg", value = "A custom business icon url for the Web Messenger. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format.") + @JsonProperty(JSON_PROPERTY_BUSINESS_ICON_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBusinessIconUrl() { + return businessIconUrl; + } + + + public void setBusinessIconUrl(String businessIconUrl) { + this.businessIconUrl = businessIconUrl; + } + + + public WebUpdate backgroundImageUrl(String backgroundImageUrl) { + + this.backgroundImageUrl = backgroundImageUrl; + return this; + } + + /** + * A background image url for the conversation. Image will be tiled to fit the window. + * @return backgroundImageUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://a-beautiful-tile.png", value = "A background image url for the conversation. Image will be tiled to fit the window.") + @JsonProperty(JSON_PROPERTY_BACKGROUND_IMAGE_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBackgroundImageUrl() { + return backgroundImageUrl; + } + + + public void setBackgroundImageUrl(String backgroundImageUrl) { + this.backgroundImageUrl = backgroundImageUrl; + } + + + public WebUpdate originWhitelist(List originWhitelist) { + this.originWhitelist = JsonNullable.>of(originWhitelist); + + return this; + } + + public WebUpdate addOriginWhitelistItem(String originWhitelistItem) { + if (this.originWhitelist == null || !this.originWhitelist.isPresent()) { + this.originWhitelist = JsonNullable.>of(new ArrayList()); + } + try { + this.originWhitelist.get().add(originWhitelistItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454: scheme \"://\" host [ \":\" port ], where scheme is http or https. + * @return originWhitelist + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454: scheme \"://\" host [ \":\" port ], where scheme is http or https. ") + @JsonIgnore + + public List getOriginWhitelist() { + return originWhitelist.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ORIGIN_WHITELIST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getOriginWhitelist_JsonNullable() { + return originWhitelist; + } + + @JsonProperty(JSON_PROPERTY_ORIGIN_WHITELIST) + public void setOriginWhitelist_JsonNullable(JsonNullable> originWhitelist) { + this.originWhitelist = originWhitelist; + } + + public void setOriginWhitelist(List originWhitelist) { + this.originWhitelist = JsonNullable.>of(originWhitelist); + } + + + public WebUpdate prechatCapture(PrechatCapture prechatCapture) { + + this.prechatCapture = prechatCapture; + return this; + } + + /** + * Object whose properties can be set to specify the add-on’s options. See the [guide](https://docs.smooch.io/guide/web-messenger/#prechat-capture) to learn more about Prechat Capture. + * @return prechatCapture + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Object whose properties can be set to specify the add-on’s options. See the [guide](https://docs.smooch.io/guide/web-messenger/#prechat-capture) to learn more about Prechat Capture.") + @JsonProperty(JSON_PROPERTY_PRECHAT_CAPTURE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public PrechatCapture getPrechatCapture() { + return prechatCapture; + } + + + public void setPrechatCapture(PrechatCapture prechatCapture) { + this.prechatCapture = prechatCapture; + } + + + public WebUpdate canUserCreateConversation(Boolean canUserCreateConversation) { + + this.canUserCreateConversation = canUserCreateConversation; + return this; + } + + /** + * Allows users to create more than one conversation on the web messenger integration. + * @return canUserCreateConversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Allows users to create more than one conversation on the web messenger integration.") + @JsonProperty(JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getCanUserCreateConversation() { + return canUserCreateConversation; + } + + + public void setCanUserCreateConversation(Boolean canUserCreateConversation) { + this.canUserCreateConversation = canUserCreateConversation; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebUpdate webUpdate = (WebUpdate) o; + return Objects.equals(this.displayName, webUpdate.displayName) && + Objects.equals(this.brandColor, webUpdate.brandColor) && + Objects.equals(this.fixedIntroPane, webUpdate.fixedIntroPane) && + Objects.equals(this.conversationColor, webUpdate.conversationColor) && + Objects.equals(this.actionColor, webUpdate.actionColor) && + Objects.equals(this.displayStyle, webUpdate.displayStyle) && + Objects.equals(this.buttonIconUrl, webUpdate.buttonIconUrl) && + Objects.equals(this.buttonWidth, webUpdate.buttonWidth) && + Objects.equals(this.buttonHeight, webUpdate.buttonHeight) && + Objects.equals(this.integrationOrder, webUpdate.integrationOrder) && + Objects.equals(this.businessName, webUpdate.businessName) && + Objects.equals(this.businessIconUrl, webUpdate.businessIconUrl) && + Objects.equals(this.backgroundImageUrl, webUpdate.backgroundImageUrl) && + Objects.equals(this.originWhitelist, webUpdate.originWhitelist) && + Objects.equals(this.prechatCapture, webUpdate.prechatCapture) && + Objects.equals(this.canUserCreateConversation, webUpdate.canUserCreateConversation); + } + + @Override + public int hashCode() { + return Objects.hash(displayName, brandColor, fixedIntroPane, conversationColor, actionColor, displayStyle, buttonIconUrl, buttonWidth, buttonHeight, integrationOrder, businessName, businessIconUrl, backgroundImageUrl, originWhitelist, prechatCapture, canUserCreateConversation); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebUpdate {\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" brandColor: ").append(toIndentedString(brandColor)).append("\n"); + sb.append(" fixedIntroPane: ").append(toIndentedString(fixedIntroPane)).append("\n"); + sb.append(" conversationColor: ").append(toIndentedString(conversationColor)).append("\n"); + sb.append(" actionColor: ").append(toIndentedString(actionColor)).append("\n"); + sb.append(" displayStyle: ").append(toIndentedString(displayStyle)).append("\n"); + sb.append(" buttonIconUrl: ").append(toIndentedString(buttonIconUrl)).append("\n"); + sb.append(" buttonWidth: ").append(toIndentedString(buttonWidth)).append("\n"); + sb.append(" buttonHeight: ").append(toIndentedString(buttonHeight)).append("\n"); + sb.append(" integrationOrder: ").append(toIndentedString(integrationOrder)).append("\n"); + sb.append(" businessName: ").append(toIndentedString(businessName)).append("\n"); + sb.append(" businessIconUrl: ").append(toIndentedString(businessIconUrl)).append("\n"); + sb.append(" backgroundImageUrl: ").append(toIndentedString(backgroundImageUrl)).append("\n"); + sb.append(" originWhitelist: ").append(toIndentedString(originWhitelist)).append("\n"); + sb.append(" prechatCapture: ").append(toIndentedString(prechatCapture)).append("\n"); + sb.append(" canUserCreateConversation: ").append(toIndentedString(canUserCreateConversation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/WebUpdateAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebUpdateAllOf.java new file mode 100644 index 00000000..7184bb67 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebUpdateAllOf.java @@ -0,0 +1,597 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.PrechatCapture; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * To configure a Web Messenger integration, acquire the required information and call the Create Integration endpoint. + */ +@ApiModel(description = "To configure a Web Messenger integration, acquire the required information and call the Create Integration endpoint. ") +@JsonPropertyOrder({ + WebUpdateAllOf.JSON_PROPERTY_BRAND_COLOR, + WebUpdateAllOf.JSON_PROPERTY_FIXED_INTRO_PANE, + WebUpdateAllOf.JSON_PROPERTY_CONVERSATION_COLOR, + WebUpdateAllOf.JSON_PROPERTY_ACTION_COLOR, + WebUpdateAllOf.JSON_PROPERTY_DISPLAY_STYLE, + WebUpdateAllOf.JSON_PROPERTY_BUTTON_ICON_URL, + WebUpdateAllOf.JSON_PROPERTY_BUTTON_WIDTH, + WebUpdateAllOf.JSON_PROPERTY_BUTTON_HEIGHT, + WebUpdateAllOf.JSON_PROPERTY_INTEGRATION_ORDER, + WebUpdateAllOf.JSON_PROPERTY_BUSINESS_NAME, + WebUpdateAllOf.JSON_PROPERTY_BUSINESS_ICON_URL, + WebUpdateAllOf.JSON_PROPERTY_BACKGROUND_IMAGE_URL, + WebUpdateAllOf.JSON_PROPERTY_ORIGIN_WHITELIST, + WebUpdateAllOf.JSON_PROPERTY_PRECHAT_CAPTURE, + WebUpdateAllOf.JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION +}) + +public class WebUpdateAllOf { + public static final String JSON_PROPERTY_BRAND_COLOR = "brandColor"; + private String brandColor = "65758e"; + + public static final String JSON_PROPERTY_FIXED_INTRO_PANE = "fixedIntroPane"; + private Boolean fixedIntroPane = false; + + public static final String JSON_PROPERTY_CONVERSATION_COLOR = "conversationColor"; + private String conversationColor = "0099ff"; + + public static final String JSON_PROPERTY_ACTION_COLOR = "actionColor"; + private String actionColor = "0099ff"; + + public static final String JSON_PROPERTY_DISPLAY_STYLE = "displayStyle"; + private String displayStyle = "button"; + + public static final String JSON_PROPERTY_BUTTON_ICON_URL = "buttonIconUrl"; + private JsonNullable buttonIconUrl = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_BUTTON_WIDTH = "buttonWidth"; + private String buttonWidth = "58"; + + public static final String JSON_PROPERTY_BUTTON_HEIGHT = "buttonHeight"; + private String buttonHeight = "58"; + + public static final String JSON_PROPERTY_INTEGRATION_ORDER = "integrationOrder"; + private JsonNullable> integrationOrder = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_BUSINESS_NAME = "businessName"; + private String businessName; + + public static final String JSON_PROPERTY_BUSINESS_ICON_URL = "businessIconUrl"; + private String businessIconUrl; + + public static final String JSON_PROPERTY_BACKGROUND_IMAGE_URL = "backgroundImageUrl"; + private String backgroundImageUrl; + + public static final String JSON_PROPERTY_ORIGIN_WHITELIST = "originWhitelist"; + private JsonNullable> originWhitelist = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_PRECHAT_CAPTURE = "prechatCapture"; + private PrechatCapture prechatCapture = null; + + public static final String JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION = "canUserCreateConversation"; + private Boolean canUserCreateConversation; + + + public WebUpdateAllOf brandColor(String brandColor) { + + this.brandColor = brandColor; + return this; + } + + /** + * This color will be used in the messenger header and the button or tab in idle state. Must be a 3 or 6-character hexadecimal color. + * @return brandColor + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This color will be used in the messenger header and the button or tab in idle state. Must be a 3 or 6-character hexadecimal color.") + @JsonProperty(JSON_PROPERTY_BRAND_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBrandColor() { + return brandColor; + } + + + public void setBrandColor(String brandColor) { + this.brandColor = brandColor; + } + + + public WebUpdateAllOf fixedIntroPane(Boolean fixedIntroPane) { + + this.fixedIntroPane = fixedIntroPane; + return this; + } + + /** + * When true, the introduction pane will be pinned at the top of the conversation instead of scrolling with it. + * @return fixedIntroPane + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "When true, the introduction pane will be pinned at the top of the conversation instead of scrolling with it.") + @JsonProperty(JSON_PROPERTY_FIXED_INTRO_PANE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getFixedIntroPane() { + return fixedIntroPane; + } + + + public void setFixedIntroPane(Boolean fixedIntroPane) { + this.fixedIntroPane = fixedIntroPane; + } + + + public WebUpdateAllOf conversationColor(String conversationColor) { + + this.conversationColor = conversationColor; + return this; + } + + /** + * This color will be used for customer messages, quick replies and actions in the footer. Must be a 3 or 6-character hexadecimal color. + * @return conversationColor + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This color will be used for customer messages, quick replies and actions in the footer. Must be a 3 or 6-character hexadecimal color.") + @JsonProperty(JSON_PROPERTY_CONVERSATION_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getConversationColor() { + return conversationColor; + } + + + public void setConversationColor(String conversationColor) { + this.conversationColor = conversationColor; + } + + + public WebUpdateAllOf actionColor(String actionColor) { + + this.actionColor = actionColor; + return this; + } + + /** + * This color will be used for call-to-actions inside your messages. Must be a 3 or 6-character hexadecimal color. + * @return actionColor + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This color will be used for call-to-actions inside your messages. Must be a 3 or 6-character hexadecimal color.") + @JsonProperty(JSON_PROPERTY_ACTION_COLOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getActionColor() { + return actionColor; + } + + + public void setActionColor(String actionColor) { + this.actionColor = actionColor; + } + + + public WebUpdateAllOf displayStyle(String displayStyle) { + + this.displayStyle = displayStyle; + return this; + } + + /** + * Choose how the messenger will appear on your website. Must be either button or tab. + * @return displayStyle + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Choose how the messenger will appear on your website. Must be either button or tab.") + @JsonProperty(JSON_PROPERTY_DISPLAY_STYLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDisplayStyle() { + return displayStyle; + } + + + public void setDisplayStyle(String displayStyle) { + this.displayStyle = displayStyle; + } + + + public WebUpdateAllOf buttonIconUrl(String buttonIconUrl) { + this.buttonIconUrl = JsonNullable.of(buttonIconUrl); + + return this; + } + + /** + * With the button style Web Messenger, you have the option of selecting your own button icon. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. + * @return buttonIconUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "With the button style Web Messenger, you have the option of selecting your own button icon. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format.") + @JsonIgnore + + public String getButtonIconUrl() { + return buttonIconUrl.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_BUTTON_ICON_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getButtonIconUrl_JsonNullable() { + return buttonIconUrl; + } + + @JsonProperty(JSON_PROPERTY_BUTTON_ICON_URL) + public void setButtonIconUrl_JsonNullable(JsonNullable buttonIconUrl) { + this.buttonIconUrl = buttonIconUrl; + } + + public void setButtonIconUrl(String buttonIconUrl) { + this.buttonIconUrl = JsonNullable.of(buttonIconUrl); + } + + + public WebUpdateAllOf buttonWidth(String buttonWidth) { + + this.buttonWidth = buttonWidth; + return this; + } + + /** + * With the button style Web Messenger, you have the option of specifying the button width. + * @return buttonWidth + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "With the button style Web Messenger, you have the option of specifying the button width.") + @JsonProperty(JSON_PROPERTY_BUTTON_WIDTH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getButtonWidth() { + return buttonWidth; + } + + + public void setButtonWidth(String buttonWidth) { + this.buttonWidth = buttonWidth; + } + + + public WebUpdateAllOf buttonHeight(String buttonHeight) { + + this.buttonHeight = buttonHeight; + return this; + } + + /** + * With the button style Web Messenger, you have the option of specifying the button height. + * @return buttonHeight + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "With the button style Web Messenger, you have the option of specifying the button height.") + @JsonProperty(JSON_PROPERTY_BUTTON_HEIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getButtonHeight() { + return buttonHeight; + } + + + public void setButtonHeight(String buttonHeight) { + this.buttonHeight = buttonHeight; + } + + + public WebUpdateAllOf integrationOrder(List integrationOrder) { + this.integrationOrder = JsonNullable.>of(integrationOrder); + + return this; + } + + public WebUpdateAllOf addIntegrationOrderItem(String integrationOrderItem) { + if (this.integrationOrder == null || !this.integrationOrder.isPresent()) { + this.integrationOrder = JsonNullable.>of(new ArrayList()); + } + try { + this.integrationOrder.get().add(integrationOrderItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed. + * @return integrationOrder + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "[\"59fc8466260f48003505228b\",\"59d79780481d34002b7d3617\"]", value = "Array of integration IDs, order will be reflected in the Web Messenger. When set, only integrations from this list will be displayed in the Web Messenger. If unset, all integrations will be displayed.") + @JsonIgnore + + public List getIntegrationOrder() { + return integrationOrder.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTEGRATION_ORDER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getIntegrationOrder_JsonNullable() { + return integrationOrder; + } + + @JsonProperty(JSON_PROPERTY_INTEGRATION_ORDER) + public void setIntegrationOrder_JsonNullable(JsonNullable> integrationOrder) { + this.integrationOrder = integrationOrder; + } + + public void setIntegrationOrder(List integrationOrder) { + this.integrationOrder = JsonNullable.>of(integrationOrder); + } + + + public WebUpdateAllOf businessName(String businessName) { + + this.businessName = businessName; + return this; + } + + /** + * A custom business name for the Web Messenger. + * @return businessName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Kent Shop", value = "A custom business name for the Web Messenger.") + @JsonProperty(JSON_PROPERTY_BUSINESS_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBusinessName() { + return businessName; + } + + + public void setBusinessName(String businessName) { + this.businessName = businessName; + } + + + public WebUpdateAllOf businessIconUrl(String businessIconUrl) { + + this.businessIconUrl = businessIconUrl; + return this; + } + + /** + * A custom business icon url for the Web Messenger. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format. + * @return businessIconUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://www.gravatar.com/image.jpg", value = "A custom business icon url for the Web Messenger. The image must be at least 200 x 200 pixels and must be in either JPG, PNG, or GIF format.") + @JsonProperty(JSON_PROPERTY_BUSINESS_ICON_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBusinessIconUrl() { + return businessIconUrl; + } + + + public void setBusinessIconUrl(String businessIconUrl) { + this.businessIconUrl = businessIconUrl; + } + + + public WebUpdateAllOf backgroundImageUrl(String backgroundImageUrl) { + + this.backgroundImageUrl = backgroundImageUrl; + return this; + } + + /** + * A background image url for the conversation. Image will be tiled to fit the window. + * @return backgroundImageUrl + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "https://a-beautiful-tile.png", value = "A background image url for the conversation. Image will be tiled to fit the window.") + @JsonProperty(JSON_PROPERTY_BACKGROUND_IMAGE_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getBackgroundImageUrl() { + return backgroundImageUrl; + } + + + public void setBackgroundImageUrl(String backgroundImageUrl) { + this.backgroundImageUrl = backgroundImageUrl; + } + + + public WebUpdateAllOf originWhitelist(List originWhitelist) { + this.originWhitelist = JsonNullable.>of(originWhitelist); + + return this; + } + + public WebUpdateAllOf addOriginWhitelistItem(String originWhitelistItem) { + if (this.originWhitelist == null || !this.originWhitelist.isPresent()) { + this.originWhitelist = JsonNullable.>of(new ArrayList()); + } + try { + this.originWhitelist.get().add(originWhitelistItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454: scheme \"://\" host [ \":\" port ], where scheme is http or https. + * @return originWhitelist + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A list of origins to whitelist. When set, only the origins from this list will be able to initialize the Web Messenger. If unset, all origins are whitelisted. The elements in the list should follow the serialized-origin format from RFC 6454: scheme \"://\" host [ \":\" port ], where scheme is http or https. ") + @JsonIgnore + + public List getOriginWhitelist() { + return originWhitelist.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ORIGIN_WHITELIST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getOriginWhitelist_JsonNullable() { + return originWhitelist; + } + + @JsonProperty(JSON_PROPERTY_ORIGIN_WHITELIST) + public void setOriginWhitelist_JsonNullable(JsonNullable> originWhitelist) { + this.originWhitelist = originWhitelist; + } + + public void setOriginWhitelist(List originWhitelist) { + this.originWhitelist = JsonNullable.>of(originWhitelist); + } + + + public WebUpdateAllOf prechatCapture(PrechatCapture prechatCapture) { + + this.prechatCapture = prechatCapture; + return this; + } + + /** + * Object whose properties can be set to specify the add-on’s options. See the [guide](https://docs.smooch.io/guide/web-messenger/#prechat-capture) to learn more about Prechat Capture. + * @return prechatCapture + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Object whose properties can be set to specify the add-on’s options. See the [guide](https://docs.smooch.io/guide/web-messenger/#prechat-capture) to learn more about Prechat Capture.") + @JsonProperty(JSON_PROPERTY_PRECHAT_CAPTURE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public PrechatCapture getPrechatCapture() { + return prechatCapture; + } + + + public void setPrechatCapture(PrechatCapture prechatCapture) { + this.prechatCapture = prechatCapture; + } + + + public WebUpdateAllOf canUserCreateConversation(Boolean canUserCreateConversation) { + + this.canUserCreateConversation = canUserCreateConversation; + return this; + } + + /** + * Allows users to create more than one conversation on the web messenger integration. + * @return canUserCreateConversation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Allows users to create more than one conversation on the web messenger integration.") + @JsonProperty(JSON_PROPERTY_CAN_USER_CREATE_CONVERSATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getCanUserCreateConversation() { + return canUserCreateConversation; + } + + + public void setCanUserCreateConversation(Boolean canUserCreateConversation) { + this.canUserCreateConversation = canUserCreateConversation; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebUpdateAllOf webUpdateAllOf = (WebUpdateAllOf) o; + return Objects.equals(this.brandColor, webUpdateAllOf.brandColor) && + Objects.equals(this.fixedIntroPane, webUpdateAllOf.fixedIntroPane) && + Objects.equals(this.conversationColor, webUpdateAllOf.conversationColor) && + Objects.equals(this.actionColor, webUpdateAllOf.actionColor) && + Objects.equals(this.displayStyle, webUpdateAllOf.displayStyle) && + Objects.equals(this.buttonIconUrl, webUpdateAllOf.buttonIconUrl) && + Objects.equals(this.buttonWidth, webUpdateAllOf.buttonWidth) && + Objects.equals(this.buttonHeight, webUpdateAllOf.buttonHeight) && + Objects.equals(this.integrationOrder, webUpdateAllOf.integrationOrder) && + Objects.equals(this.businessName, webUpdateAllOf.businessName) && + Objects.equals(this.businessIconUrl, webUpdateAllOf.businessIconUrl) && + Objects.equals(this.backgroundImageUrl, webUpdateAllOf.backgroundImageUrl) && + Objects.equals(this.originWhitelist, webUpdateAllOf.originWhitelist) && + Objects.equals(this.prechatCapture, webUpdateAllOf.prechatCapture) && + Objects.equals(this.canUserCreateConversation, webUpdateAllOf.canUserCreateConversation); + } + + @Override + public int hashCode() { + return Objects.hash(brandColor, fixedIntroPane, conversationColor, actionColor, displayStyle, buttonIconUrl, buttonWidth, buttonHeight, integrationOrder, businessName, businessIconUrl, backgroundImageUrl, originWhitelist, prechatCapture, canUserCreateConversation); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebUpdateAllOf {\n"); + sb.append(" brandColor: ").append(toIndentedString(brandColor)).append("\n"); + sb.append(" fixedIntroPane: ").append(toIndentedString(fixedIntroPane)).append("\n"); + sb.append(" conversationColor: ").append(toIndentedString(conversationColor)).append("\n"); + sb.append(" actionColor: ").append(toIndentedString(actionColor)).append("\n"); + sb.append(" displayStyle: ").append(toIndentedString(displayStyle)).append("\n"); + sb.append(" buttonIconUrl: ").append(toIndentedString(buttonIconUrl)).append("\n"); + sb.append(" buttonWidth: ").append(toIndentedString(buttonWidth)).append("\n"); + sb.append(" buttonHeight: ").append(toIndentedString(buttonHeight)).append("\n"); + sb.append(" integrationOrder: ").append(toIndentedString(integrationOrder)).append("\n"); + sb.append(" businessName: ").append(toIndentedString(businessName)).append("\n"); + sb.append(" businessIconUrl: ").append(toIndentedString(businessIconUrl)).append("\n"); + sb.append(" backgroundImageUrl: ").append(toIndentedString(backgroundImageUrl)).append("\n"); + sb.append(" originWhitelist: ").append(toIndentedString(originWhitelist)).append("\n"); + sb.append(" prechatCapture: ").append(toIndentedString(prechatCapture)).append("\n"); + sb.append(" canUserCreateConversation: ").append(toIndentedString(canUserCreateConversation)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Webhook.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Webhook.java new file mode 100644 index 00000000..dc4b13e7 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Webhook.java @@ -0,0 +1,275 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Webhook + */ +@JsonPropertyOrder({ + Webhook.JSON_PROPERTY_ID, + Webhook.JSON_PROPERTY_VERSION, + Webhook.JSON_PROPERTY_TARGET, + Webhook.JSON_PROPERTY_TRIGGERS, + Webhook.JSON_PROPERTY_SECRET, + Webhook.JSON_PROPERTY_INCLUDE_FULL_USER, + Webhook.JSON_PROPERTY_INCLUDE_FULL_SOURCE +}) + +public class Webhook { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_VERSION = "version"; + private String version; + + public static final String JSON_PROPERTY_TARGET = "target"; + private String target; + + public static final String JSON_PROPERTY_TRIGGERS = "triggers"; + private List triggers = new ArrayList(); + + public static final String JSON_PROPERTY_SECRET = "secret"; + private String secret; + + public static final String JSON_PROPERTY_INCLUDE_FULL_USER = "includeFullUser"; + private Boolean includeFullUser = false; + + public static final String JSON_PROPERTY_INCLUDE_FULL_SOURCE = "includeFullSource"; + private Boolean includeFullSource = false; + + + /** + * A unique identifier for the webhook. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "5e554d2cac66fb73a3c01871", value = "A unique identifier for the webhook.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + + + /** + * Schema version of the payload delivered to this webhook. Can be `v1`, `v1.1` or `v2`. + * @return version + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "v2", value = "Schema version of the payload delivered to this webhook. Can be `v1`, `v1.1` or `v2`.") + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getVersion() { + return version; + } + + + + + public Webhook target(String target) { + + this.target = target; + return this; + } + + /** + * URL to be called when the webhook is triggered. + * @return target + **/ + @ApiModelProperty(example = "http://example.com/callback", required = true, value = "URL to be called when the webhook is triggered.") + @JsonProperty(JSON_PROPERTY_TARGET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTarget() { + return target; + } + + + public void setTarget(String target) { + this.target = target; + } + + + public Webhook triggers(List triggers) { + + this.triggers = triggers; + return this; + } + + public Webhook addTriggersItem(String triggersItem) { + this.triggers.add(triggersItem); + return this; + } + + /** + * An array of triggers the integration is subscribed to. This property is case sensitive. Current supported triggers in v2 are `conversation:create`, `conversation:message:delivery:channel`, `conversation:message:delivery:failure`, `conversation:message:delivery:user`, `conversation:message`, `conversation:read`, `conversation:typing`, `conversation:postback`, and `user:merge` + * @return triggers + **/ + @ApiModelProperty(example = "[\"conversation:read\",\"conversation:message\"]", required = true, value = "An array of triggers the integration is subscribed to. This property is case sensitive. Current supported triggers in v2 are `conversation:create`, `conversation:message:delivery:channel`, `conversation:message:delivery:failure`, `conversation:message:delivery:user`, `conversation:message`, `conversation:read`, `conversation:typing`, `conversation:postback`, and `user:merge`") + @JsonProperty(JSON_PROPERTY_TRIGGERS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public List getTriggers() { + return triggers; + } + + + public void setTriggers(List triggers) { + this.triggers = triggers; + } + + + public Webhook secret(String secret) { + + this.secret = secret; + return this; + } + + /** + * Webhook secret, used to verify the origin of incoming requests. + * @return secret + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "8564b3e6a8b20a4bdb68b05ce9bc5936", value = "Webhook secret, used to verify the origin of incoming requests.") + @JsonProperty(JSON_PROPERTY_SECRET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSecret() { + return secret; + } + + + public void setSecret(String secret) { + this.secret = secret; + } + + + public Webhook includeFullUser(Boolean includeFullUser) { + + this.includeFullUser = includeFullUser; + return this; + } + + /** + * A boolean specifying whether webhook payloads should include the complete user schema for events involving a specific user. + * @return includeFullUser + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A boolean specifying whether webhook payloads should include the complete user schema for events involving a specific user.") + @JsonProperty(JSON_PROPERTY_INCLUDE_FULL_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getIncludeFullUser() { + return includeFullUser; + } + + + public void setIncludeFullUser(Boolean includeFullUser) { + this.includeFullUser = includeFullUser; + } + + + public Webhook includeFullSource(Boolean includeFullSource) { + + this.includeFullSource = includeFullSource; + return this; + } + + /** + * A boolean specifying whether webhook payloads should include the client and device object (when applicable). + * @return includeFullSource + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A boolean specifying whether webhook payloads should include the client and device object (when applicable).") + @JsonProperty(JSON_PROPERTY_INCLUDE_FULL_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getIncludeFullSource() { + return includeFullSource; + } + + + public void setIncludeFullSource(Boolean includeFullSource) { + this.includeFullSource = includeFullSource; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Webhook webhook = (Webhook) o; + return Objects.equals(this.id, webhook.id) && + Objects.equals(this.version, webhook.version) && + Objects.equals(this.target, webhook.target) && + Objects.equals(this.triggers, webhook.triggers) && + Objects.equals(this.secret, webhook.secret) && + Objects.equals(this.includeFullUser, webhook.includeFullUser) && + Objects.equals(this.includeFullSource, webhook.includeFullSource); + } + + @Override + public int hashCode() { + return Objects.hash(id, version, target, triggers, secret, includeFullUser, includeFullSource); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Webhook {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" target: ").append(toIndentedString(target)).append("\n"); + sb.append(" triggers: ").append(toIndentedString(triggers)).append("\n"); + sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); + sb.append(" includeFullUser: ").append(toIndentedString(includeFullUser)).append("\n"); + sb.append(" includeFullSource: ").append(toIndentedString(includeFullSource)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/WebhookBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebhookBody.java new file mode 100644 index 00000000..5f90706f --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebhookBody.java @@ -0,0 +1,205 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * WebhookBody + */ +@JsonPropertyOrder({ + WebhookBody.JSON_PROPERTY_TARGET, + WebhookBody.JSON_PROPERTY_TRIGGERS, + WebhookBody.JSON_PROPERTY_INCLUDE_FULL_USER, + WebhookBody.JSON_PROPERTY_INCLUDE_FULL_SOURCE +}) + +public class WebhookBody { + public static final String JSON_PROPERTY_TARGET = "target"; + private String target; + + public static final String JSON_PROPERTY_TRIGGERS = "triggers"; + private List triggers = null; + + public static final String JSON_PROPERTY_INCLUDE_FULL_USER = "includeFullUser"; + private Boolean includeFullUser = false; + + public static final String JSON_PROPERTY_INCLUDE_FULL_SOURCE = "includeFullSource"; + private Boolean includeFullSource = false; + + + public WebhookBody target(String target) { + + this.target = target; + return this; + } + + /** + * URL to be called when the webhook is triggered. + * @return target + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "http://example.com/callback", value = "URL to be called when the webhook is triggered.") + @JsonProperty(JSON_PROPERTY_TARGET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getTarget() { + return target; + } + + + public void setTarget(String target) { + this.target = target; + } + + + public WebhookBody triggers(List triggers) { + + this.triggers = triggers; + return this; + } + + public WebhookBody addTriggersItem(String triggersItem) { + if (this.triggers == null) { + this.triggers = new ArrayList(); + } + this.triggers.add(triggersItem); + return this; + } + + /** + * An array of triggers the integration is subscribed to. This property is case sensitive. Current supported triggers in v2 are `conversation:create`, `conversation:message:delivery:channel`, `conversation:message:delivery:failure`, `conversation:message:delivery:user`, `conversation:message`, `conversation:read`, `conversation:typing`, `conversation:postback`, and `user:merge` + * @return triggers + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "[\"conversation:read\",\"conversation:message\"]", value = "An array of triggers the integration is subscribed to. This property is case sensitive. Current supported triggers in v2 are `conversation:create`, `conversation:message:delivery:channel`, `conversation:message:delivery:failure`, `conversation:message:delivery:user`, `conversation:message`, `conversation:read`, `conversation:typing`, `conversation:postback`, and `user:merge`") + @JsonProperty(JSON_PROPERTY_TRIGGERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getTriggers() { + return triggers; + } + + + public void setTriggers(List triggers) { + this.triggers = triggers; + } + + + public WebhookBody includeFullUser(Boolean includeFullUser) { + + this.includeFullUser = includeFullUser; + return this; + } + + /** + * A boolean specifying whether webhook payloads should include the complete user schema for events involving a specific user. + * @return includeFullUser + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A boolean specifying whether webhook payloads should include the complete user schema for events involving a specific user.") + @JsonProperty(JSON_PROPERTY_INCLUDE_FULL_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getIncludeFullUser() { + return includeFullUser; + } + + + public void setIncludeFullUser(Boolean includeFullUser) { + this.includeFullUser = includeFullUser; + } + + + public WebhookBody includeFullSource(Boolean includeFullSource) { + + this.includeFullSource = includeFullSource; + return this; + } + + /** + * A boolean specifying whether webhook payloads should include the client and device object (when applicable). + * @return includeFullSource + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A boolean specifying whether webhook payloads should include the client and device object (when applicable).") + @JsonProperty(JSON_PROPERTY_INCLUDE_FULL_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getIncludeFullSource() { + return includeFullSource; + } + + + public void setIncludeFullSource(Boolean includeFullSource) { + this.includeFullSource = includeFullSource; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookBody webhookBody = (WebhookBody) o; + return Objects.equals(this.target, webhookBody.target) && + Objects.equals(this.triggers, webhookBody.triggers) && + Objects.equals(this.includeFullUser, webhookBody.includeFullUser) && + Objects.equals(this.includeFullSource, webhookBody.includeFullSource); + } + + @Override + public int hashCode() { + return Objects.hash(target, triggers, includeFullUser, includeFullSource); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookBody {\n"); + sb.append(" target: ").append(toIndentedString(target)).append("\n"); + sb.append(" triggers: ").append(toIndentedString(triggers)).append("\n"); + sb.append(" includeFullUser: ").append(toIndentedString(includeFullUser)).append("\n"); + sb.append(" includeFullSource: ").append(toIndentedString(includeFullSource)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/WebhookCreateBody.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebhookCreateBody.java new file mode 100644 index 00000000..9b27ce3d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebhookCreateBody.java @@ -0,0 +1,75 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.WebhookBody; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * WebhookCreateBody + */ +@JsonPropertyOrder({ +}) + +public class WebhookCreateBody extends WebhookBody { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookCreateBody {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/WebhookListResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebhookListResponse.java new file mode 100644 index 00000000..ec710bb7 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebhookListResponse.java @@ -0,0 +1,113 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Webhook; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * WebhookListResponse + */ +@JsonPropertyOrder({ + WebhookListResponse.JSON_PROPERTY_WEBHOOKS +}) + +public class WebhookListResponse { + public static final String JSON_PROPERTY_WEBHOOKS = "webhooks"; + private List webhooks = null; + + + public WebhookListResponse webhooks(List webhooks) { + + this.webhooks = webhooks; + return this; + } + + public WebhookListResponse addWebhooksItem(Webhook webhooksItem) { + if (this.webhooks == null) { + this.webhooks = new ArrayList(); + } + this.webhooks.add(webhooksItem); + return this; + } + + /** + * List of webhooks associated with the integration. + * @return webhooks + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of webhooks associated with the integration.") + @JsonProperty(JSON_PROPERTY_WEBHOOKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getWebhooks() { + return webhooks; + } + + + public void setWebhooks(List webhooks) { + this.webhooks = webhooks; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookListResponse webhookListResponse = (WebhookListResponse) o; + return Objects.equals(this.webhooks, webhookListResponse.webhooks); + } + + @Override + public int hashCode() { + return Objects.hash(webhooks); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookListResponse {\n"); + sb.append(" webhooks: ").append(toIndentedString(webhooks)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/WebhookResponse.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebhookResponse.java new file mode 100644 index 00000000..9be61f02 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebhookResponse.java @@ -0,0 +1,103 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Webhook; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * WebhookResponse + */ +@JsonPropertyOrder({ + WebhookResponse.JSON_PROPERTY_WEBHOOK +}) + +public class WebhookResponse { + public static final String JSON_PROPERTY_WEBHOOK = "webhook"; + private Webhook webhook = null; + + + public WebhookResponse webhook(Webhook webhook) { + + this.webhook = webhook; + return this; + } + + /** + * The webhook. + * @return webhook + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The webhook.") + @JsonProperty(JSON_PROPERTY_WEBHOOK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Webhook getWebhook() { + return webhook; + } + + + public void setWebhook(Webhook webhook) { + this.webhook = webhook; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookResponse webhookResponse = (WebhookResponse) o; + return Objects.equals(this.webhook, webhookResponse.webhook); + } + + @Override + public int hashCode() { + return Objects.hash(webhook); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookResponse {\n"); + sb.append(" webhook: ").append(toIndentedString(webhook)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/WebhookSubSchema.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebhookSubSchema.java new file mode 100644 index 00000000..9b8b1fab --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/WebhookSubSchema.java @@ -0,0 +1,134 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * The webhook that generated the payload. + */ +@ApiModel(description = "The webhook that generated the payload.") +@JsonPropertyOrder({ + WebhookSubSchema.JSON_PROPERTY_ID, + WebhookSubSchema.JSON_PROPERTY_VERSION +}) + +public class WebhookSubSchema { + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_VERSION = "version"; + private String version; + + + public WebhookSubSchema id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the webhook. + * @return id + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The unique ID of the webhook.") + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public WebhookSubSchema version(String version) { + + this.version = version; + return this; + } + + /** + * Schema version of the payload delivered to this webhook (v2). + * @return version + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Schema version of the payload delivered to this webhook (v2).") + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getVersion() { + return version; + } + + + public void setVersion(String version) { + this.version = version; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookSubSchema webhookSubSchema = (WebhookSubSchema) o; + return Objects.equals(this.id, webhookSubSchema.id) && + Objects.equals(this.version, webhookSubSchema.version); + } + + @Override + public int hashCode() { + return Objects.hash(id, version); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookSubSchema {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Webview.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Webview.java new file mode 100644 index 00000000..6a7f41b5 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Webview.java @@ -0,0 +1,403 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.ExtraChannelOptions; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.net.URI; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.zendesk.sunshine_conversations_client.model.Action; +import com.zendesk.sunshine_conversations_client.model.ActionSubset; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * When a webview actions is clicked/tapped, the provided URI will be loaded in a webview. Channels that do not support webviews will open the fallback URI instead. + */ +@ApiModel(description = "When a webview actions is clicked/tapped, the provided URI will be loaded in a webview. Channels that do not support webviews will open the fallback URI instead.") +@JsonPropertyOrder({ + Webview.JSON_PROPERTY_TYPE, + Webview.JSON_PROPERTY_URI, + Webview.JSON_PROPERTY_TEXT, + Webview.JSON_PROPERTY_DEFAULT, + Webview.JSON_PROPERTY_METADATA, + Webview.JSON_PROPERTY_EXTRA_CHANNEL_OPTIONS, + Webview.JSON_PROPERTY_SIZE, + Webview.JSON_PROPERTY_FALLBACK, + Webview.JSON_PROPERTY_OPEN_ON_RECEIVE +}) + +public class Webview implements Action, ActionSubset { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public static final String JSON_PROPERTY_URI = "uri"; + private URI uri; + + public static final String JSON_PROPERTY_TEXT = "text"; + private String text; + + public static final String JSON_PROPERTY_DEFAULT = "default"; + private Boolean _default; + + public static final String JSON_PROPERTY_METADATA = "metadata"; + private JsonNullable metadata = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_EXTRA_CHANNEL_OPTIONS = "extraChannelOptions"; + private ExtraChannelOptions extraChannelOptions; + + /** + * The size to display a webview. Used for actions of type webview. + */ + public enum SizeEnum { + COMPACT("compact"), + + TALL("tall"), + + FULL("full"); + + private String value; + + SizeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SizeEnum fromValue(String value) { + for (SizeEnum b : SizeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_SIZE = "size"; + private SizeEnum size; + + public static final String JSON_PROPERTY_FALLBACK = "fallback"; + private String fallback; + + public static final String JSON_PROPERTY_OPEN_ON_RECEIVE = "openOnReceive"; + private Boolean openOnReceive; + + + public Webview type(String type) { + + this.type = type; + return this; + } + + /** + * The type of action. + * @return type + **/ + @ApiModelProperty(required = true, value = "The type of action.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Webview uri(URI uri) { + + this.uri = uri; + return this; + } + + /** + * The webview URI. This is the URI that will open in the webview when clicking the button. + * @return uri + **/ + @ApiModelProperty(required = true, value = "The webview URI. This is the URI that will open in the webview when clicking the button.") + @JsonProperty(JSON_PROPERTY_URI) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public URI getUri() { + return uri; + } + + + public void setUri(URI uri) { + this.uri = uri; + } + + + public Webview text(String text) { + + this.text = text; + return this; + } + + /** + * The button text. + * @return text + **/ + @ApiModelProperty(required = true, value = "The button text.") + @JsonProperty(JSON_PROPERTY_TEXT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public Webview _default(Boolean _default) { + + this._default = _default; + return this; + } + + /** + * Boolean value indicating whether the action is the default action for a message item in Facebook Messenger. + * @return _default + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Boolean value indicating whether the action is the default action for a message item in Facebook Messenger.") + @JsonProperty(JSON_PROPERTY_DEFAULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getDefault() { + return _default; + } + + + public void setDefault(Boolean _default) { + this._default = _default; + } + + + public Webview metadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + + return this; + } + + /** + * Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. + * @return metadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"lang\":\"en-ca\"}", value = "Flat object containing custom properties. Strings, numbers and booleans are the only supported format that can be passed to metadata. The metadata is limited to 4KB in size. ") + @JsonIgnore + + public Object getMetadata() { + return metadata.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getMetadata_JsonNullable() { + return metadata; + } + + @JsonProperty(JSON_PROPERTY_METADATA) + public void setMetadata_JsonNullable(JsonNullable metadata) { + this.metadata = metadata; + } + + public void setMetadata(Object metadata) { + this.metadata = JsonNullable.of(metadata); + } + + + public Webview extraChannelOptions(ExtraChannelOptions extraChannelOptions) { + + this.extraChannelOptions = extraChannelOptions; + return this; + } + + /** + * Get extraChannelOptions + * @return extraChannelOptions + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_EXTRA_CHANNEL_OPTIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ExtraChannelOptions getExtraChannelOptions() { + return extraChannelOptions; + } + + + public void setExtraChannelOptions(ExtraChannelOptions extraChannelOptions) { + this.extraChannelOptions = extraChannelOptions; + } + + + public Webview size(SizeEnum size) { + + this.size = size; + return this; + } + + /** + * The size to display a webview. Used for actions of type webview. + * @return size + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The size to display a webview. Used for actions of type webview.") + @JsonProperty(JSON_PROPERTY_SIZE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public SizeEnum getSize() { + return size; + } + + + public void setSize(SizeEnum size) { + this.size = size; + } + + + public Webview fallback(String fallback) { + + this.fallback = fallback; + return this; + } + + /** + * The fallback uri for channels that don’t support webviews. Used for actions of type webview. + * @return fallback + **/ + @ApiModelProperty(required = true, value = "The fallback uri for channels that don’t support webviews. Used for actions of type webview.") + @JsonProperty(JSON_PROPERTY_FALLBACK) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getFallback() { + return fallback; + } + + + public void setFallback(String fallback) { + this.fallback = fallback; + } + + + public Webview openOnReceive(Boolean openOnReceive) { + + this.openOnReceive = openOnReceive; + return this; + } + + /** + * Boolean value indicating if the webview should open automatically. Only one action per message can be set to true. Currently only supported on the Web Messenger. + * @return openOnReceive + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Boolean value indicating if the webview should open automatically. Only one action per message can be set to true. Currently only supported on the Web Messenger.") + @JsonProperty(JSON_PROPERTY_OPEN_ON_RECEIVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getOpenOnReceive() { + return openOnReceive; + } + + + public void setOpenOnReceive(Boolean openOnReceive) { + this.openOnReceive = openOnReceive; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Webview webview = (Webview) o; + return Objects.equals(this.type, webview.type) && + Objects.equals(this.uri, webview.uri) && + Objects.equals(this.text, webview.text) && + Objects.equals(this._default, webview._default) && + Objects.equals(this.metadata, webview.metadata) && + Objects.equals(this.extraChannelOptions, webview.extraChannelOptions) && + Objects.equals(this.size, webview.size) && + Objects.equals(this.fallback, webview.fallback) && + Objects.equals(this.openOnReceive, webview.openOnReceive); + } + + @Override + public int hashCode() { + return Objects.hash(type, uri, text, _default, metadata, extraChannelOptions, size, fallback, openOnReceive); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Webview {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" uri: ").append(toIndentedString(uri)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" _default: ").append(toIndentedString(_default)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" extraChannelOptions: ").append(toIndentedString(extraChannelOptions)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" fallback: ").append(toIndentedString(fallback)).append("\n"); + sb.append(" openOnReceive: ").append(toIndentedString(openOnReceive)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/WhatsAppUpdate.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/WhatsAppUpdate.java new file mode 100644 index 00000000..1fddc4b8 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/WhatsAppUpdate.java @@ -0,0 +1,243 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdateBase; +import com.zendesk.sunshine_conversations_client.model.WhatsAppUpdateAllOf; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.zendesk.sunshine_conversations_client.model.IntegrationUpdate; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * WhatsAppUpdate + */ +@JsonPropertyOrder({ + WhatsAppUpdate.JSON_PROPERTY_DISPLAY_NAME, + WhatsAppUpdate.JSON_PROPERTY_HSM_FALLBACK_LANGUAGE, + WhatsAppUpdate.JSON_PROPERTY_ACCOUNT_ID, + WhatsAppUpdate.JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN +}) + +public class WhatsAppUpdate implements IntegrationUpdate { + public static final String JSON_PROPERTY_DISPLAY_NAME = "displayName"; + private JsonNullable displayName = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_HSM_FALLBACK_LANGUAGE = "hsmFallbackLanguage"; + private JsonNullable hsmFallbackLanguage = JsonNullable.of("en_US"); + + public static final String JSON_PROPERTY_ACCOUNT_ID = "accountId"; + private JsonNullable accountId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN = "accountManagementAccessToken"; + private JsonNullable accountManagementAccessToken = JsonNullable.undefined(); + + + public WhatsAppUpdate displayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + + return this; + } + + /** + * A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`. + * @return displayName + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "My awesome integration", value = "A human-friendly name used to identify the integration. `displayName` can be unset by changing it to `null`.") + @JsonIgnore + + public String getDisplayName() { + return displayName.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDisplayName_JsonNullable() { + return displayName; + } + + @JsonProperty(JSON_PROPERTY_DISPLAY_NAME) + public void setDisplayName_JsonNullable(JsonNullable displayName) { + this.displayName = displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = JsonNullable.of(displayName); + } + + + public WhatsAppUpdate hsmFallbackLanguage(String hsmFallbackLanguage) { + this.hsmFallbackLanguage = JsonNullable.of(hsmFallbackLanguage); + + return this; + } + + /** + * Specify a fallback language to use when sending WhatsApp message template using the short hand syntax. Defaults to en_US. See WhatsApp documentation for more info. + * @return hsmFallbackLanguage + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specify a fallback language to use when sending WhatsApp message template using the short hand syntax. Defaults to en_US. See WhatsApp documentation for more info.") + @JsonIgnore + + public String getHsmFallbackLanguage() { + return hsmFallbackLanguage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_HSM_FALLBACK_LANGUAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getHsmFallbackLanguage_JsonNullable() { + return hsmFallbackLanguage; + } + + @JsonProperty(JSON_PROPERTY_HSM_FALLBACK_LANGUAGE) + public void setHsmFallbackLanguage_JsonNullable(JsonNullable hsmFallbackLanguage) { + this.hsmFallbackLanguage = hsmFallbackLanguage; + } + + public void setHsmFallbackLanguage(String hsmFallbackLanguage) { + this.hsmFallbackLanguage = JsonNullable.of(hsmFallbackLanguage); + } + + + public WhatsAppUpdate accountId(String accountId) { + this.accountId = JsonNullable.of(accountId); + + return this; + } + + /** + * The business ID associated with the WhatsApp account. In combination with accountManagementAccessToken, it’s used for Message Template Reconstruction. + * @return accountId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_whatsApp_account_id", value = "The business ID associated with the WhatsApp account. In combination with accountManagementAccessToken, it’s used for Message Template Reconstruction.") + @JsonIgnore + + public String getAccountId() { + return accountId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAccountId_JsonNullable() { + return accountId; + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + public void setAccountId_JsonNullable(JsonNullable accountId) { + this.accountId = accountId; + } + + public void setAccountId(String accountId) { + this.accountId = JsonNullable.of(accountId); + } + + + public WhatsAppUpdate accountManagementAccessToken(String accountManagementAccessToken) { + this.accountManagementAccessToken = JsonNullable.of(accountManagementAccessToken); + + return this; + } + + /** + * An access token associated with the accountId used to query the WhatsApp Account Management API. In combination with accountId, it’s used for Message Template Reconstruction. + * @return accountManagementAccessToken + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_access_token", value = "An access token associated with the accountId used to query the WhatsApp Account Management API. In combination with accountId, it’s used for Message Template Reconstruction.") + @JsonIgnore + + public String getAccountManagementAccessToken() { + return accountManagementAccessToken.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAccountManagementAccessToken_JsonNullable() { + return accountManagementAccessToken; + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN) + public void setAccountManagementAccessToken_JsonNullable(JsonNullable accountManagementAccessToken) { + this.accountManagementAccessToken = accountManagementAccessToken; + } + + public void setAccountManagementAccessToken(String accountManagementAccessToken) { + this.accountManagementAccessToken = JsonNullable.of(accountManagementAccessToken); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WhatsAppUpdate whatsAppUpdate = (WhatsAppUpdate) o; + return Objects.equals(this.displayName, whatsAppUpdate.displayName) && + Objects.equals(this.hsmFallbackLanguage, whatsAppUpdate.hsmFallbackLanguage) && + Objects.equals(this.accountId, whatsAppUpdate.accountId) && + Objects.equals(this.accountManagementAccessToken, whatsAppUpdate.accountManagementAccessToken); + } + + @Override + public int hashCode() { + return Objects.hash(displayName, hsmFallbackLanguage, accountId, accountManagementAccessToken); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WhatsAppUpdate {\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" hsmFallbackLanguage: ").append(toIndentedString(hsmFallbackLanguage)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" accountManagementAccessToken: ").append(toIndentedString(accountManagementAccessToken)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/WhatsAppUpdateAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/WhatsAppUpdateAllOf.java new file mode 100644 index 00000000..5158784d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/WhatsAppUpdateAllOf.java @@ -0,0 +1,197 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * WhatsAppUpdateAllOf + */ +@JsonPropertyOrder({ + WhatsAppUpdateAllOf.JSON_PROPERTY_HSM_FALLBACK_LANGUAGE, + WhatsAppUpdateAllOf.JSON_PROPERTY_ACCOUNT_ID, + WhatsAppUpdateAllOf.JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN +}) + +public class WhatsAppUpdateAllOf { + public static final String JSON_PROPERTY_HSM_FALLBACK_LANGUAGE = "hsmFallbackLanguage"; + private JsonNullable hsmFallbackLanguage = JsonNullable.of("en_US"); + + public static final String JSON_PROPERTY_ACCOUNT_ID = "accountId"; + private JsonNullable accountId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN = "accountManagementAccessToken"; + private JsonNullable accountManagementAccessToken = JsonNullable.undefined(); + + + public WhatsAppUpdateAllOf hsmFallbackLanguage(String hsmFallbackLanguage) { + this.hsmFallbackLanguage = JsonNullable.of(hsmFallbackLanguage); + + return this; + } + + /** + * Specify a fallback language to use when sending WhatsApp message template using the short hand syntax. Defaults to en_US. See WhatsApp documentation for more info. + * @return hsmFallbackLanguage + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specify a fallback language to use when sending WhatsApp message template using the short hand syntax. Defaults to en_US. See WhatsApp documentation for more info.") + @JsonIgnore + + public String getHsmFallbackLanguage() { + return hsmFallbackLanguage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_HSM_FALLBACK_LANGUAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getHsmFallbackLanguage_JsonNullable() { + return hsmFallbackLanguage; + } + + @JsonProperty(JSON_PROPERTY_HSM_FALLBACK_LANGUAGE) + public void setHsmFallbackLanguage_JsonNullable(JsonNullable hsmFallbackLanguage) { + this.hsmFallbackLanguage = hsmFallbackLanguage; + } + + public void setHsmFallbackLanguage(String hsmFallbackLanguage) { + this.hsmFallbackLanguage = JsonNullable.of(hsmFallbackLanguage); + } + + + public WhatsAppUpdateAllOf accountId(String accountId) { + this.accountId = JsonNullable.of(accountId); + + return this; + } + + /** + * The business ID associated with the WhatsApp account. In combination with accountManagementAccessToken, it’s used for Message Template Reconstruction. + * @return accountId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_whatsApp_account_id", value = "The business ID associated with the WhatsApp account. In combination with accountManagementAccessToken, it’s used for Message Template Reconstruction.") + @JsonIgnore + + public String getAccountId() { + return accountId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAccountId_JsonNullable() { + return accountId; + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + public void setAccountId_JsonNullable(JsonNullable accountId) { + this.accountId = accountId; + } + + public void setAccountId(String accountId) { + this.accountId = JsonNullable.of(accountId); + } + + + public WhatsAppUpdateAllOf accountManagementAccessToken(String accountManagementAccessToken) { + this.accountManagementAccessToken = JsonNullable.of(accountManagementAccessToken); + + return this; + } + + /** + * An access token associated with the accountId used to query the WhatsApp Account Management API. In combination with accountId, it’s used for Message Template Reconstruction. + * @return accountManagementAccessToken + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_access_token", value = "An access token associated with the accountId used to query the WhatsApp Account Management API. In combination with accountId, it’s used for Message Template Reconstruction.") + @JsonIgnore + + public String getAccountManagementAccessToken() { + return accountManagementAccessToken.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAccountManagementAccessToken_JsonNullable() { + return accountManagementAccessToken; + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN) + public void setAccountManagementAccessToken_JsonNullable(JsonNullable accountManagementAccessToken) { + this.accountManagementAccessToken = accountManagementAccessToken; + } + + public void setAccountManagementAccessToken(String accountManagementAccessToken) { + this.accountManagementAccessToken = JsonNullable.of(accountManagementAccessToken); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WhatsAppUpdateAllOf whatsAppUpdateAllOf = (WhatsAppUpdateAllOf) o; + return Objects.equals(this.hsmFallbackLanguage, whatsAppUpdateAllOf.hsmFallbackLanguage) && + Objects.equals(this.accountId, whatsAppUpdateAllOf.accountId) && + Objects.equals(this.accountManagementAccessToken, whatsAppUpdateAllOf.accountManagementAccessToken); + } + + @Override + public int hashCode() { + return Objects.hash(hsmFallbackLanguage, accountId, accountManagementAccessToken); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WhatsAppUpdateAllOf {\n"); + sb.append(" hsmFallbackLanguage: ").append(toIndentedString(hsmFallbackLanguage)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" accountManagementAccessToken: ").append(toIndentedString(accountManagementAccessToken)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/Whatsapp.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/Whatsapp.java new file mode 100644 index 00000000..5ff0a86d --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/Whatsapp.java @@ -0,0 +1,297 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import com.zendesk.sunshine_conversations_client.model.Android; +import com.zendesk.sunshine_conversations_client.model.Apple; +import com.zendesk.sunshine_conversations_client.model.Custom; +import com.zendesk.sunshine_conversations_client.model.Integration; +import com.zendesk.sunshine_conversations_client.model.Ios; +import com.zendesk.sunshine_conversations_client.model.Line; +import com.zendesk.sunshine_conversations_client.model.Mailgun; +import com.zendesk.sunshine_conversations_client.model.MessageBird; +import com.zendesk.sunshine_conversations_client.model.Messenger; +import com.zendesk.sunshine_conversations_client.model.Status; +import com.zendesk.sunshine_conversations_client.model.Telegram; +import com.zendesk.sunshine_conversations_client.model.Twilio; +import com.zendesk.sunshine_conversations_client.model.Twitter; +import com.zendesk.sunshine_conversations_client.model.Viber; +import com.zendesk.sunshine_conversations_client.model.Web; +import com.zendesk.sunshine_conversations_client.model.Whatsapp; +import com.zendesk.sunshine_conversations_client.model.WhatsappAllOf; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Whatsapp + */ +@JsonPropertyOrder({ + Whatsapp.JSON_PROPERTY_TYPE, + Whatsapp.JSON_PROPERTY_DEPLOYMENT_ID, + Whatsapp.JSON_PROPERTY_HSM_FALLBACK_LANGUAGE, + Whatsapp.JSON_PROPERTY_ACCOUNT_ID, + Whatsapp.JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Android.class, name = "android"), + @JsonSubTypes.Type(value = Apple.class, name = "apple"), + @JsonSubTypes.Type(value = Custom.class, name = "custom"), + @JsonSubTypes.Type(value = Ios.class, name = "ios"), + @JsonSubTypes.Type(value = Line.class, name = "line"), + @JsonSubTypes.Type(value = Mailgun.class, name = "mailgun"), + @JsonSubTypes.Type(value = MessageBird.class, name = "messagebird"), + @JsonSubTypes.Type(value = Messenger.class, name = "messenger"), + @JsonSubTypes.Type(value = Telegram.class, name = "telegram"), + @JsonSubTypes.Type(value = Twilio.class, name = "twilio"), + @JsonSubTypes.Type(value = Twitter.class, name = "twitter"), + @JsonSubTypes.Type(value = Viber.class, name = "viber"), + @JsonSubTypes.Type(value = Web.class, name = "web"), + @JsonSubTypes.Type(value = Whatsapp.class, name = "whatsapp"), +}) + +public class Whatsapp extends Integration { + public static final String JSON_PROPERTY_TYPE = "type"; + protected String type = "whatsapp"; + + public static final String JSON_PROPERTY_DEPLOYMENT_ID = "deploymentId"; + private String deploymentId; + + public static final String JSON_PROPERTY_HSM_FALLBACK_LANGUAGE = "hsmFallbackLanguage"; + private JsonNullable hsmFallbackLanguage = JsonNullable.of("en_US"); + + public static final String JSON_PROPERTY_ACCOUNT_ID = "accountId"; + private JsonNullable accountId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN = "accountManagementAccessToken"; + private JsonNullable accountManagementAccessToken = JsonNullable.undefined(); + + + public Whatsapp type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public Whatsapp deploymentId(String deploymentId) { + + this.deploymentId = deploymentId; + return this; + } + + /** + * The Id of the deployment. The integrationId and the appId will be added to the deployment. Additionally, the deployment’s status will be set to integrated. + * @return deploymentId + **/ + @ApiModelProperty(example = "55c8d9758590aa1900b9b9aa", required = true, value = "The Id of the deployment. The integrationId and the appId will be added to the deployment. Additionally, the deployment’s status will be set to integrated.") + @JsonProperty(JSON_PROPERTY_DEPLOYMENT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getDeploymentId() { + return deploymentId; + } + + + public void setDeploymentId(String deploymentId) { + this.deploymentId = deploymentId; + } + + + public Whatsapp hsmFallbackLanguage(String hsmFallbackLanguage) { + this.hsmFallbackLanguage = JsonNullable.of(hsmFallbackLanguage); + + return this; + } + + /** + * Specify a fallback language to use when sending WhatsApp message template using the short hand syntax. Defaults to en_US. See WhatsApp documentation for more info. + * @return hsmFallbackLanguage + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specify a fallback language to use when sending WhatsApp message template using the short hand syntax. Defaults to en_US. See WhatsApp documentation for more info.") + @JsonIgnore + + public String getHsmFallbackLanguage() { + return hsmFallbackLanguage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_HSM_FALLBACK_LANGUAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getHsmFallbackLanguage_JsonNullable() { + return hsmFallbackLanguage; + } + + @JsonProperty(JSON_PROPERTY_HSM_FALLBACK_LANGUAGE) + public void setHsmFallbackLanguage_JsonNullable(JsonNullable hsmFallbackLanguage) { + this.hsmFallbackLanguage = hsmFallbackLanguage; + } + + public void setHsmFallbackLanguage(String hsmFallbackLanguage) { + this.hsmFallbackLanguage = JsonNullable.of(hsmFallbackLanguage); + } + + + public Whatsapp accountId(String accountId) { + this.accountId = JsonNullable.of(accountId); + + return this; + } + + /** + * The business ID associated with the WhatsApp account. In combination with accountManagementAccessToken, it’s used for Message Template Reconstruction. + * @return accountId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_whatsApp_account_id", value = "The business ID associated with the WhatsApp account. In combination with accountManagementAccessToken, it’s used for Message Template Reconstruction.") + @JsonIgnore + + public String getAccountId() { + return accountId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAccountId_JsonNullable() { + return accountId; + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + public void setAccountId_JsonNullable(JsonNullable accountId) { + this.accountId = accountId; + } + + public void setAccountId(String accountId) { + this.accountId = JsonNullable.of(accountId); + } + + + public Whatsapp accountManagementAccessToken(String accountManagementAccessToken) { + this.accountManagementAccessToken = JsonNullable.of(accountManagementAccessToken); + + return this; + } + + /** + * An access token associated with the accountId used to query the WhatsApp Account Management API. In combination with accountId, it’s used for Message Template Reconstruction. + * @return accountManagementAccessToken + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_access_token", value = "An access token associated with the accountId used to query the WhatsApp Account Management API. In combination with accountId, it’s used for Message Template Reconstruction.") + @JsonIgnore + + public String getAccountManagementAccessToken() { + return accountManagementAccessToken.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAccountManagementAccessToken_JsonNullable() { + return accountManagementAccessToken; + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN) + public void setAccountManagementAccessToken_JsonNullable(JsonNullable accountManagementAccessToken) { + this.accountManagementAccessToken = accountManagementAccessToken; + } + + public void setAccountManagementAccessToken(String accountManagementAccessToken) { + this.accountManagementAccessToken = JsonNullable.of(accountManagementAccessToken); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Whatsapp whatsapp = (Whatsapp) o; + return Objects.equals(this.type, whatsapp.type) && + Objects.equals(this.deploymentId, whatsapp.deploymentId) && + Objects.equals(this.hsmFallbackLanguage, whatsapp.hsmFallbackLanguage) && + Objects.equals(this.accountId, whatsapp.accountId) && + Objects.equals(this.accountManagementAccessToken, whatsapp.accountManagementAccessToken) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(type, deploymentId, hsmFallbackLanguage, accountId, accountManagementAccessToken, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Whatsapp {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" deploymentId: ").append(toIndentedString(deploymentId)).append("\n"); + sb.append(" hsmFallbackLanguage: ").append(toIndentedString(hsmFallbackLanguage)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" accountManagementAccessToken: ").append(toIndentedString(accountManagementAccessToken)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/zendesk/sunshine_conversations_client/model/WhatsappAllOf.java b/src/main/java/com/zendesk/sunshine_conversations_client/model/WhatsappAllOf.java new file mode 100644 index 00000000..ef732be1 --- /dev/null +++ b/src/main/java/com/zendesk/sunshine_conversations_client/model/WhatsappAllOf.java @@ -0,0 +1,259 @@ +/* + * Sunshine Conversations API + * # Introduction Welcome to the Sunshine Conversations API. The API allows you to craft entirely unique messaging experiences for your app and website as well as talk to any backend or external service. The Sunshine Conversations API is designed according to REST principles. The API accepts JSON in request bodies and requires that the content-type: application/json header be specified for all such requests. The API will always respond with an object. Depending on context, resources may be returned as single objects or as arrays of objects, nested within the response object. In some cases, the API will also facilitate cross-origin resource sharing so that it can be called from a web application. ## Regions Sunshine Conversations is available in the following regions. Each Sunshine Conversations region has its own API host. | Region | Host | | -------------- | -------------------------- | | United States | https://api.smooch.io | | European Union | https://api.eu-1.smooch.io | For more information on regions, visit [the guide](/guide/regions/). ## Errors Sunshine Conversations uses standard HTTP status codes to communicate errors. In general, a `2xx` status code indicates success while `4xx` indicates an error, in which case, the response body includes a JSON object which includes an array of errors, with a text `code` and `title` containing more details. Multiple errors can only be included in a `400 Bad Request`. A `5xx` status code indicates that something went wrong on our end. ```javascript { \"errors\": [ { \"code\": \"unauthorized\", \"title\": \"Authorization is required\" } ] } ``` ## API Version The latest version of the API is v2. Version v1.1 is still supported and you can continue using it but we encourage you to upgrade to the latest version. To learn more about API versioning at Sunshine Conversations, including instructions on how to upgrade to the latest version, [visit our docs](https://docs.smooch.io/guide/versioning). ## API Pagination and Records Limits Some APIs can be paginated by providing the `offset` query string parameter. The `offset` is the number of initial records to skip before picking records to return (default 0). The `limit` query string can also be provided to change the number of records to return (maximum 100, default 25). All paginated endpoints will eventually support cursor pagination and `offset` based pagination support will be dropped. ### Cursor Pagination Some APIs are paginated through cursor pagination. Rather than providing an `offset`, a `page[after]` or `page[before]` query string parameter may be provided. `page[after]` and `page[before]` are cursors pointing to a record id. The `page[after]` cursor indicates that only records **subsequent** to it should be returned. The `page[before]` cursor indicates that only records **preceding** it should be returned. **Only one** of `page[after]` or `page[before]` may be provided in a query, not both. In cursor pagination, the equivalent to the `limit` query string is the `page[size]` query string parameter. ## API Libraries Sunshine Conversations provides an official API library for [Java](https://github.com/zendesk/sunshine-conversations-java), with more languages to come. These helpful libraries wrap calls to the API and can make interfacing with Sunshine Conversations easier. ## Postman Collection In addition to API libraries, Sunshine Conversations also has a Postman collection that can be used for development or testing purposes. See the [guide](https://docs.smooch.io/guide/postman-collection/) for information on how to install and use the collection in your Postman client. ## Rate Limits Sunshine Conversations APIs are subject to rate limiting. If the rate limit is exceeded Sunshine Conversations may return a `429 Too Many Requests` HTTP status code. We apply rate limits to prevent abuse, spam, denial-of-service attacks, and similar issues. Our goal is to keep the limits high enough so that any application using Sunshine Conversations as intended will not encounter them. However usage spikes do occur and encountering a rate limit may be unavoidable. In order to avoid production outages, when calling the Sunshine Conversations API you should implement `429` retry logic using exponential backoff and jitter. If your use case involves making API calls in bulk, please [contact us](https://smooch.io/contact). ## Request Size Limits The Sunshine Conversations API imposes the following size limits on HTTP requests: | Request Type | Limit | | -------------- | --------------- | | JSON | 100kb | | File upload | 25mb | ## Authorization This is an overview of how authorization works with the Sunshine Conversations API. Sunshine Conversations allows basic authentication or JSON Web Tokens (JWTs) as authentication methods for server-to-server calls. [See below](#authentication) for more details. There are two different authorization scopes available - app and account. | Scope | Authorized Methods | | -------------- | ----------------------------------------- | | app | All methods besides Account Provisioning | | account | All methods | The app scope can be used to access any of the Sunshine Conversations APIs, besides account provisioning methods, on behalf of a single app, or any app user related to that app. The account scope can be used to access any of the Sunshine Conversations and Account Provisioning APIs on behalf of the account owner, any app belonging to the account, or any app user related to those apps. ## Authentication To authenticate requests to the API, you will need an API key, composed of a key id and a secret. For an overview of how authentication works in Sunshine Conversations and instructions on how to generate an API key, see the guide. API requests can be authenticated in two ways: * With Basic authentication you can make requests using an API key directly. * With JSON Web Tokens (JWTs) you sign tokens with an API key, which are then used to authenticate with the API. See [When to Use JWTs?](https://docs.smooch.io/guide/jwt/#when-to-use-jwts) to learn if JWTs are relevant for your usage. * Before using an API key in production, make sure to familiarize yourself with best practices on how to [securely handle credentials](https://docs.smooch.io/guide/authentication-secure-credential-handling/). ### Basic Authentication API requests can be authenticated with [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) using an API key. The key id is used as the username and the secret as the password. The scope of access is determined by the owner of the API key. See the [guide](https://docs.smooch.io/guide/basic-authentication/#scope-of-access) for more details. ### JWTs JSON Web Tokens (JWTs) are an industry standard authentication method. The full specification is described [here](https://tools.ietf.org/html/rfc7519), and a set of supported JWT libraries for a variety of languages and platforms can be found at http://jwt.io. To summarize, a JWT is composed of a header, a payload, and a signature. The payload contains information called claims which describe the subject to whom the token was issued. The JWT itself is transmitted via the HTTP `authorization` header. The token should be prefixed with “Bearer” followed by a space. For example: `Bearer your-jwt`. To generate a JWT, you need an API key, which is composed of a key ID and a secret. The key ID is included in a JWT’s header, as the `kid` property, while the secret is used to sign the JWT. For more in-depth coverage, see the [guide](https://docs.smooch.io/guide/jwt). #### Header The JWT header must contain the key id (kid) of the API key that is used to sign it. The algorithm (alg) used should be HS256. Unsigned JWTs are not accepted. ```javascript { \"alg\": \"HS256\", \"typ\": \"JWT\", \"kid\": \"act_5963ceb97cde542d000dbdb1\" } ``` #### Payload The JWT payload must include a scope claim which specifies the caller’s scope of access. * account-scoped JWTs must be generated with an API key associated with a Sunshine Conversations account (act_) or service account (svc_). ```javascript { \"scope\": \"account\" } ``` * app-scoped JWTs can be generated with an API key associated with an app (app_). ```javascript { \"scope\": \"app\" } ``` + * + * The version of the OpenAPI document: 9.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.zendesk.sunshine_conversations_client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * To configure a WhatsApp integration, use your WhatsApp API Client connection information. Sunshine Conversations can provide WhatsApp API Client hosting for approved brands. See our [WhatsApp guide](https://docs.smooch.io/guide/whatsapp/#whatsapp-api-client) for more details on WhatsApp API Client hosting. + */ +@ApiModel(description = "To configure a WhatsApp integration, use your WhatsApp API Client connection information. Sunshine Conversations can provide WhatsApp API Client hosting for approved brands. See our [WhatsApp guide](https://docs.smooch.io/guide/whatsapp/#whatsapp-api-client) for more details on WhatsApp API Client hosting. ") +@JsonPropertyOrder({ + WhatsappAllOf.JSON_PROPERTY_TYPE, + WhatsappAllOf.JSON_PROPERTY_DEPLOYMENT_ID, + WhatsappAllOf.JSON_PROPERTY_HSM_FALLBACK_LANGUAGE, + WhatsappAllOf.JSON_PROPERTY_ACCOUNT_ID, + WhatsappAllOf.JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN +}) + +public class WhatsappAllOf { + public static final String JSON_PROPERTY_TYPE = "type"; + private String type = "whatsapp"; + + public static final String JSON_PROPERTY_DEPLOYMENT_ID = "deploymentId"; + private String deploymentId; + + public static final String JSON_PROPERTY_HSM_FALLBACK_LANGUAGE = "hsmFallbackLanguage"; + private JsonNullable hsmFallbackLanguage = JsonNullable.of("en_US"); + + public static final String JSON_PROPERTY_ACCOUNT_ID = "accountId"; + private JsonNullable accountId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN = "accountManagementAccessToken"; + private JsonNullable accountManagementAccessToken = JsonNullable.undefined(); + + + public WhatsappAllOf type(String type) { + + this.type = type; + return this; + } + + /** + * The type of integration. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The type of integration.") + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public WhatsappAllOf deploymentId(String deploymentId) { + + this.deploymentId = deploymentId; + return this; + } + + /** + * The Id of the deployment. The integrationId and the appId will be added to the deployment. Additionally, the deployment’s status will be set to integrated. + * @return deploymentId + **/ + @ApiModelProperty(example = "55c8d9758590aa1900b9b9aa", required = true, value = "The Id of the deployment. The integrationId and the appId will be added to the deployment. Additionally, the deployment’s status will be set to integrated.") + @JsonProperty(JSON_PROPERTY_DEPLOYMENT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getDeploymentId() { + return deploymentId; + } + + + public void setDeploymentId(String deploymentId) { + this.deploymentId = deploymentId; + } + + + public WhatsappAllOf hsmFallbackLanguage(String hsmFallbackLanguage) { + this.hsmFallbackLanguage = JsonNullable.of(hsmFallbackLanguage); + + return this; + } + + /** + * Specify a fallback language to use when sending WhatsApp message template using the short hand syntax. Defaults to en_US. See WhatsApp documentation for more info. + * @return hsmFallbackLanguage + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specify a fallback language to use when sending WhatsApp message template using the short hand syntax. Defaults to en_US. See WhatsApp documentation for more info.") + @JsonIgnore + + public String getHsmFallbackLanguage() { + return hsmFallbackLanguage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_HSM_FALLBACK_LANGUAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getHsmFallbackLanguage_JsonNullable() { + return hsmFallbackLanguage; + } + + @JsonProperty(JSON_PROPERTY_HSM_FALLBACK_LANGUAGE) + public void setHsmFallbackLanguage_JsonNullable(JsonNullable hsmFallbackLanguage) { + this.hsmFallbackLanguage = hsmFallbackLanguage; + } + + public void setHsmFallbackLanguage(String hsmFallbackLanguage) { + this.hsmFallbackLanguage = JsonNullable.of(hsmFallbackLanguage); + } + + + public WhatsappAllOf accountId(String accountId) { + this.accountId = JsonNullable.of(accountId); + + return this; + } + + /** + * The business ID associated with the WhatsApp account. In combination with accountManagementAccessToken, it’s used for Message Template Reconstruction. + * @return accountId + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_whatsApp_account_id", value = "The business ID associated with the WhatsApp account. In combination with accountManagementAccessToken, it’s used for Message Template Reconstruction.") + @JsonIgnore + + public String getAccountId() { + return accountId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAccountId_JsonNullable() { + return accountId; + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_ID) + public void setAccountId_JsonNullable(JsonNullable accountId) { + this.accountId = accountId; + } + + public void setAccountId(String accountId) { + this.accountId = JsonNullable.of(accountId); + } + + + public WhatsappAllOf accountManagementAccessToken(String accountManagementAccessToken) { + this.accountManagementAccessToken = JsonNullable.of(accountManagementAccessToken); + + return this; + } + + /** + * An access token associated with the accountId used to query the WhatsApp Account Management API. In combination with accountId, it’s used for Message Template Reconstruction. + * @return accountManagementAccessToken + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "your_access_token", value = "An access token associated with the accountId used to query the WhatsApp Account Management API. In combination with accountId, it’s used for Message Template Reconstruction.") + @JsonIgnore + + public String getAccountManagementAccessToken() { + return accountManagementAccessToken.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAccountManagementAccessToken_JsonNullable() { + return accountManagementAccessToken; + } + + @JsonProperty(JSON_PROPERTY_ACCOUNT_MANAGEMENT_ACCESS_TOKEN) + public void setAccountManagementAccessToken_JsonNullable(JsonNullable accountManagementAccessToken) { + this.accountManagementAccessToken = accountManagementAccessToken; + } + + public void setAccountManagementAccessToken(String accountManagementAccessToken) { + this.accountManagementAccessToken = JsonNullable.of(accountManagementAccessToken); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WhatsappAllOf whatsappAllOf = (WhatsappAllOf) o; + return Objects.equals(this.type, whatsappAllOf.type) && + Objects.equals(this.deploymentId, whatsappAllOf.deploymentId) && + Objects.equals(this.hsmFallbackLanguage, whatsappAllOf.hsmFallbackLanguage) && + Objects.equals(this.accountId, whatsappAllOf.accountId) && + Objects.equals(this.accountManagementAccessToken, whatsappAllOf.accountManagementAccessToken); + } + + @Override + public int hashCode() { + return Objects.hash(type, deploymentId, hsmFallbackLanguage, accountId, accountManagementAccessToken); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WhatsappAllOf {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" deploymentId: ").append(toIndentedString(deploymentId)).append("\n"); + sb.append(" hsmFallbackLanguage: ").append(toIndentedString(hsmFallbackLanguage)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" accountManagementAccessToken: ").append(toIndentedString(accountManagementAccessToken)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/io/smooch/client/ApiCallback.java b/src/main/java/io/smooch/client/ApiCallback.java deleted file mode 100644 index 38701b2b..00000000 --- a/src/main/java/io/smooch/client/ApiCallback.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client; - -import java.io.IOException; - -import java.util.Map; -import java.util.List; - -/** - * Callback for asynchronous API call. - * - * @param The return type - */ -public interface ApiCallback { - /** - * This is called when the API call fails. - * - * @param e The exception causing the failure - * @param statusCode Status code of the response if available, otherwise it would be 0 - * @param responseHeaders Headers of the response if available, otherwise it would be null - */ - void onFailure(ApiException e, int statusCode, Map> responseHeaders); - - /** - * This is called when the API call succeeded. - * - * @param result The result deserialized from response - * @param statusCode Status code of the response - * @param responseHeaders Headers of the response - */ - void onSuccess(T result, int statusCode, Map> responseHeaders); - - /** - * This is called when the API upload processing. - * - * @param bytesWritten bytes Written - * @param contentLength content length of request body - * @param done write end - */ - void onUploadProgress(long bytesWritten, long contentLength, boolean done); - - /** - * This is called when the API downlond processing. - * - * @param bytesRead bytes Read - * @param contentLength content lenngth of the response - * @param done Read end - */ - void onDownloadProgress(long bytesRead, long contentLength, boolean done); -} diff --git a/src/main/java/io/smooch/client/ApiClient.java b/src/main/java/io/smooch/client/ApiClient.java deleted file mode 100644 index 70e43a8b..00000000 --- a/src/main/java/io/smooch/client/ApiClient.java +++ /dev/null @@ -1,1323 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client; - -import com.squareup.okhttp.Call; -import com.squareup.okhttp.Callback; -import com.squareup.okhttp.OkHttpClient; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.Response; -import com.squareup.okhttp.RequestBody; -import com.squareup.okhttp.FormEncodingBuilder; -import com.squareup.okhttp.MultipartBuilder; -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.Headers; -import com.squareup.okhttp.internal.http.HttpMethod; -import com.squareup.okhttp.logging.HttpLoggingInterceptor; -import com.squareup.okhttp.logging.HttpLoggingInterceptor.Level; - -import java.lang.reflect.Type; - -import java.util.Collection; -import java.util.Collections; -import java.util.Map; -import java.util.Map.Entry; -import java.util.HashMap; -import java.util.List; -import java.util.ArrayList; -import java.util.Date; -import java.util.TimeZone; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import java.net.URLEncoder; -import java.net.URLConnection; - -import java.io.File; -import java.io.InputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -import java.security.GeneralSecurityException; -import java.security.KeyStore; -import java.security.SecureRandom; -import java.security.cert.Certificate; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.text.ParseException; - -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.KeyManager; -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSession; -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; -import javax.net.ssl.X509TrustManager; - -import okio.BufferedSink; -import okio.Okio; - -import io.smooch.client.auth.Authentication; -import io.smooch.client.auth.HttpBasicAuth; -import io.smooch.client.auth.ApiKeyAuth; -import io.smooch.client.auth.OAuth; - -public class ApiClient { - public static final double JAVA_VERSION; - public static final boolean IS_ANDROID; - public static final int ANDROID_SDK_VERSION; - - static { - JAVA_VERSION = Double.parseDouble(System.getProperty("java.specification.version")); - boolean isAndroid; - try { - Class.forName("android.app.Activity"); - isAndroid = true; - } catch (ClassNotFoundException e) { - isAndroid = false; - } - IS_ANDROID = isAndroid; - int sdkVersion = 0; - if (IS_ANDROID) { - try { - sdkVersion = Class.forName("android.os.Build$VERSION").getField("SDK_INT").getInt(null); - } catch (Exception e) { - try { - sdkVersion = Integer.parseInt((String) Class.forName("android.os.Build$VERSION").getField("SDK").get(null)); - } catch (Exception e2) { } - } - } - ANDROID_SDK_VERSION = sdkVersion; - } - - /** - * The datetime format to be used when lenientDatetimeFormat is enabled. - */ - public static final String LENIENT_DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; - - private String basePath = "https://api.smooch.io"; - private boolean lenientOnJson = false; - private boolean debugging = false; - private Map defaultHeaderMap = new HashMap(); - private String tempFolderPath = null; - - private Map authentications; - - private DateFormat dateFormat; - private DateFormat datetimeFormat; - private boolean lenientDatetimeFormat; - private int dateLength; - - private InputStream sslCaCert; - private boolean verifyingSsl; - - private OkHttpClient httpClient; - private JSON json; - - private HttpLoggingInterceptor loggingInterceptor; - - /* - * Constructor for ApiClient - */ - public ApiClient() { - httpClient = new OkHttpClient(); - - - verifyingSsl = true; - - json = new JSON(this); - - /* - * Use RFC3339 format for date and datetime. - * See http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14 - */ - this.dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - // Always use UTC as the default time zone when dealing with date (without time). - this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - initDatetimeFormat(); - - // Be lenient on datetime formats when parsing datetime from string. - // See parseDatetime. - this.lenientDatetimeFormat = true; - - // Set default User-Agent. - setUserAgent("Swagger-Codegen/5.29.0/java"); - - // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap(); - authentications.put("basicAuth", new HttpBasicAuth()); - authentications.put("jwt", new ApiKeyAuth("header", "Authorization")); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - - /** - * Get base path - * - * @return Baes path - */ - public String getBasePath() { - return basePath; - } - - /** - * Set base path - * - * @param basePath Base path of the URL (e.g https://api.smooch.io - * @return An instance of OkHttpClient - */ - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - return this; - } - - /** - * Get HTTP client - * - * @return An instance of OkHttpClient - */ - public OkHttpClient getHttpClient() { - return httpClient; - } - - /** - * Set HTTP client - * - * @param httpClient An instance of OkHttpClient - * @return Api Client - */ - public ApiClient setHttpClient(OkHttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /** - * Get JSON - * - * @return JSON object - */ - public JSON getJSON() { - return json; - } - - /** - * Set JSON - * - * @param json JSON object - * @return Api client - */ - public ApiClient setJSON(JSON json) { - this.json = json; - return this; - } - - /** - * True if isVerifyingSsl flag is on - * - * @return True if isVerifySsl flag is on - */ - public boolean isVerifyingSsl() { - return verifyingSsl; - } - - /** - * Configure whether to verify certificate and hostname when making https requests. - * Default to true. - * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. - * - * @param verifyingSsl True to verify TLS/SSL connection - * @return ApiClient - */ - public ApiClient setVerifyingSsl(boolean verifyingSsl) { - this.verifyingSsl = verifyingSsl; - applySslSettings(); - return this; - } - - /** - * Get SSL CA cert. - * - * @return Input stream to the SSL CA cert - */ - public InputStream getSslCaCert() { - return sslCaCert; - } - - /** - * Configure the CA certificate to be trusted when making https requests. - * Use null to reset to default. - * - * @param sslCaCert input stream for SSL CA cert - * @return ApiClient - */ - public ApiClient setSslCaCert(InputStream sslCaCert) { - this.sslCaCert = sslCaCert; - applySslSettings(); - return this; - } - - public DateFormat getDateFormat() { - return dateFormat; - } - - public ApiClient setDateFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - this.dateLength = this.dateFormat.format(new Date()).length(); - return this; - } - - public DateFormat getDatetimeFormat() { - return datetimeFormat; - } - - public ApiClient setDatetimeFormat(DateFormat datetimeFormat) { - this.datetimeFormat = datetimeFormat; - return this; - } - - /** - * Whether to allow various ISO 8601 datetime formats when parsing a datetime string. - * @see #parseDatetime(String) - * @return True if lenientDatetimeFormat flag is set to true - */ - public boolean isLenientDatetimeFormat() { - return lenientDatetimeFormat; - } - - public ApiClient setLenientDatetimeFormat(boolean lenientDatetimeFormat) { - this.lenientDatetimeFormat = lenientDatetimeFormat; - return this; - } - - /** - * Parse the given date string into Date object. - * The default dateFormat supports these ISO 8601 date formats: - * 2015-08-16 - * 2015-8-16 - * @param str String to be parsed - * @return Date - */ - public Date parseDate(String str) { - if (str == null) - return null; - try { - return dateFormat.parse(str); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - /** - * Parse the given datetime string into Date object. - * When lenientDatetimeFormat is enabled, the following ISO 8601 datetime formats are supported: - * 2015-08-16T08:20:05Z - * 2015-8-16T8:20:05Z - * 2015-08-16T08:20:05+00:00 - * 2015-08-16T08:20:05+0000 - * 2015-08-16T08:20:05.376Z - * 2015-08-16T08:20:05.376+00:00 - * 2015-08-16T08:20:05.376+00 - * Note: The 3-digit milli-seconds is optional. Time zone is required and can be in one of - * these formats: - * Z (same with +0000) - * +08:00 (same with +0800) - * -02 (same with -0200) - * -0200 - * @see ISO 8601 - * @param str Date time string to be parsed - * @return Date representation of the string - */ - public Date parseDatetime(String str) { - if (str == null) - return null; - - DateFormat format; - if (lenientDatetimeFormat) { - /* - * When lenientDatetimeFormat is enabled, normalize the date string - * into LENIENT_DATETIME_FORMAT to support various formats - * defined by ISO 8601. - */ - // normalize time zone - // trailing "Z": 2015-08-16T08:20:05Z => 2015-08-16T08:20:05+0000 - str = str.replaceAll("[zZ]\\z", "+0000"); - // remove colon in time zone: 2015-08-16T08:20:05+00:00 => 2015-08-16T08:20:05+0000 - str = str.replaceAll("([+-]\\d{2}):(\\d{2})\\z", "$1$2"); - // expand time zone: 2015-08-16T08:20:05+00 => 2015-08-16T08:20:05+0000 - str = str.replaceAll("([+-]\\d{2})\\z", "$100"); - // add milliseconds when missing - // 2015-08-16T08:20:05+0000 => 2015-08-16T08:20:05.000+0000 - str = str.replaceAll("(:\\d{1,2})([+-]\\d{4})\\z", "$1.000$2"); - format = new SimpleDateFormat(LENIENT_DATETIME_FORMAT); - } else { - format = this.datetimeFormat; - } - - try { - return format.parse(str); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - /* - * Parse date or date time in string format into Date object. - * - * @param str Date time string to be parsed - * @return Date representation of the string - */ - public Date parseDateOrDatetime(String str) { - if (str == null) - return null; - else if (str.length() <= dateLength) - return parseDate(str); - else - return parseDatetime(str); - } - - /** - * Format the given Date object into string (Date format). - * - * @param date Date object - * @return Formatted date in string representation - */ - public String formatDate(Date date) { - return dateFormat.format(date); - } - - /** - * Format the given Date object into string (Datetime format). - * - * @param date Date object - * @return Formatted datetime in string representation - */ - public String formatDatetime(Date date) { - return datetimeFormat.format(date); - } - - /** - * Get authentications (key: authentication name, value: authentication). - * - * @return Map of authentication objects - */ - public Map getAuthentications() { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication(String authName) { - return authentications.get(authName); - } - - /** - * Helper method to set username for the first HTTP basic authentication. - * - * @param username Username - */ - public void setUsername(String username) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setUsername(username); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set password for the first HTTP basic authentication. - * - * @param password Password - */ - public void setPassword(String password) { - for (Authentication auth : authentications.values()) { - if (auth instanceof HttpBasicAuth) { - ((HttpBasicAuth) auth).setPassword(password); - return; - } - } - throw new RuntimeException("No HTTP basic authentication configured!"); - } - - /** - * Helper method to set API key value for the first API key authentication. - * - * @param apiKey API key - */ - public void setApiKey(String apiKey) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKey(apiKey); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set API key prefix for the first API key authentication. - * - * @param apiKeyPrefix API key prefix - */ - public void setApiKeyPrefix(String apiKeyPrefix) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set access token for the first OAuth2 authentication. - * - * @param accessToken Access token - */ - public void setAccessToken(String accessToken) { - for (Authentication auth : authentications.values()) { - if (auth instanceof OAuth) { - ((OAuth) auth).setAccessToken(accessToken); - return; - } - } - throw new RuntimeException("No OAuth2 authentication configured!"); - } - - /** - * Set the User-Agent header's value (by adding to the default header map). - * - * @param userAgent HTTP request's user agent - * @return ApiClient - */ - public ApiClient setUserAgent(String userAgent) { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - * @return ApiClient - */ - public ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * @see setLenient - * - * @return True if lenientOnJson is enabled, false otherwise. - */ - public boolean isLenientOnJson() { - return lenientOnJson; - } - - /** - * Set LenientOnJson - * - * @param lenient True to enable lenientOnJson - * @return ApiClient - */ - public ApiClient setLenientOnJson(boolean lenient) { - this.lenientOnJson = lenient; - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - * - * @return True if debugging is enabled, false otherwise. - */ - public boolean isDebugging() { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - * @return ApiClient - */ - public ApiClient setDebugging(boolean debugging) { - if (debugging != this.debugging) { - if (debugging) { - loggingInterceptor = new HttpLoggingInterceptor(); - loggingInterceptor.setLevel(Level.BODY); - httpClient.interceptors().add(loggingInterceptor); - } else { - httpClient.interceptors().remove(loggingInterceptor); - loggingInterceptor = null; - } - } - this.debugging = debugging; - return this; - } - - /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is null, i.e. using - * the system's default tempopary folder. - * - * @see createTempFile - * @return Temporary folder path - */ - public String getTempFolderPath() { - return tempFolderPath; - } - - /** - * Set the tempoaray folder path (for downloading files) - * - * @param tempFolderPath Temporary folder path - * @return ApiClient - */ - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; - } - - /** - * Get connection timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getConnectTimeout() { - return httpClient.getConnectTimeout(); - } - - /** - * Sets the connect timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * - * @param connectionTimeout connection timeout in milliseconds - * @return Api client - */ - public ApiClient setConnectTimeout(int connectionTimeout) { - httpClient.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS); - return this; - } - - /** - * Format the given parameter object into string. - * - * @param param Parameter - * @return String representation of the parameter - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date) { - return formatDatetime((Date) param); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for (Object o : (Collection)param) { - if (b.length() > 0) { - b.append(","); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /** - * Format to {@code Pair} objects. - * - * @param collectionFormat collection format (e.g. csv, tsv) - * @param name Name - * @param value Value - * @return A list of Pair objects - */ - public List parameterToPairs(String collectionFormat, String name, Object value){ - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null) return params; - - Collection valueCollection = null; - if (value instanceof Collection) { - valueCollection = (Collection) value; - } else { - params.add(new Pair(name, parameterToString(value))); - return params; - } - - if (valueCollection.isEmpty()){ - return params; - } - - // get the collection format - collectionFormat = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // default: csv - - // create the params based on the collection format - if (collectionFormat.equals("multi")) { - for (Object item : valueCollection) { - params.add(new Pair(name, parameterToString(item))); - } - - return params; - } - - String delimiter = ","; - - if (collectionFormat.equals("csv")) { - delimiter = ","; - } else if (collectionFormat.equals("ssv")) { - delimiter = " "; - } else if (collectionFormat.equals("tsv")) { - delimiter = "\t"; - } else if (collectionFormat.equals("pipes")) { - delimiter = "|"; - } - - StringBuilder sb = new StringBuilder() ; - for (Object item : valueCollection) { - sb.append(delimiter); - sb.append(parameterToString(item)); - } - - params.add(new Pair(name, sb.substring(1))); - - return params; - } - - /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif - * - * @param filename The filename to be sanitized - * @return The sanitized filename - */ - public String sanitizeFilename(String filename) { - return filename.replaceAll(".*[/\\\\]", ""); - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public boolean isJsonMime(String mime) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && mime.matches(jsonMime); - } - - /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) - * - * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). - */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) { - return null; - } - for (String accept : accepts) { - if (isJsonMime(accept)) { - return accept; - } - } - return StringUtil.join(accepts, ","); - } - - /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. - * - * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * JSON will be used. - */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0) { - return "application/json"; - } - for (String contentType : contentTypes) { - if (isJsonMime(contentType)) { - return contentType; - } - } - return contentTypes[0]; - } - - /** - * Escape the given string to be used as URL query value. - * - * @param str String to be escaped - * @return Escaped string - */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } - } - - /** - * Deserialize response body to Java object, according to the return type and - * the Content-Type response header. - * - * @param Type - * @param response HTTP response - * @param returnType The type of the Java object - * @return The deserialized Java object - * @throws ApiException If fail to deserialize response body, i.e. cannot read response body - * or the Content-Type of the response is not supported. - */ - @SuppressWarnings("unchecked") - public T deserialize(Response response, Type returnType) throws ApiException { - if (response == null || returnType == null) { - return null; - } - - if ("byte[]".equals(returnType.toString())) { - // Handle binary response (byte array). - try { - return (T) response.body().bytes(); - } catch (IOException e) { - throw new ApiException(e); - } - } else if (returnType.equals(File.class)) { - // Handle file downloading. - return (T) downloadFileFromResponse(response); - } - - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { - return null; - } - - String contentType = response.headers().get("Content-Type"); - if (contentType == null) { - // ensuring a default content type - contentType = "application/json"; - } - if (isJsonMime(contentType)) { - return json.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( - "Content type \"" + contentType + "\" is not supported for type: " + returnType, - response.code(), - response.headers().toMultimap(), - respBody); - } - } - - /** - * Serialize the given Java object into request body according to the object's - * class and the request Content-Type. - * - * @param obj The Java object - * @param contentType The request Content-Type - * @return The serialized request body - * @throws ApiException If fail to serialize the given object - */ - public RequestBody serialize(Object obj, String contentType) throws ApiException { - if (obj instanceof byte[]) { - // Binary (byte array) body parameter support. - return RequestBody.create(MediaType.parse(contentType), (byte[]) obj); - } else if (obj instanceof File) { - // File body parameter support. - return RequestBody.create(MediaType.parse(contentType), (File) obj); - } else if (isJsonMime(contentType)) { - String content; - if (obj != null) { - content = json.serialize(obj); - } else { - content = null; - } - return RequestBody.create(MediaType.parse(contentType), content); - } else { - throw new ApiException("Content type \"" + contentType + "\" is not supported"); - } - } - - /** - * Download file from the given response. - * - * @param response An instance of the Response object - * @throws ApiException If fail to read file content from response and write to disk - * @return Downloaded file - */ - public File downloadFileFromResponse(Response response) throws ApiException { - try { - File file = prepareDownloadFile(response); - BufferedSink sink = Okio.buffer(Okio.sink(file)); - sink.writeAll(response.body().source()); - sink.close(); - return file; - } catch (IOException e) { - throw new ApiException(e); - } - } - - /** - * Prepare file for download - * - * @param response An instance of the Response object - * @throws IOException If fail to prepare file for download - * @return Prepared file for the download - */ - public File prepareDownloadFile(Response response) throws IOException { - String filename = null; - String contentDisposition = response.header("Content-Disposition"); - if (contentDisposition != null && !"".equals(contentDisposition)) { - // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) { - filename = sanitizeFilename(matcher.group(1)); - } - } - - String prefix = null; - String suffix = null; - if (filename == null) { - prefix = "download-"; - suffix = ""; - } else { - int pos = filename.lastIndexOf("."); - if (pos == -1) { - prefix = filename + "-"; - } else { - prefix = filename.substring(0, pos) + "-"; - suffix = filename.substring(pos); - } - // File.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) - prefix = "download-"; - } - - if (tempFolderPath == null) - return File.createTempFile(prefix, suffix); - else - return File.createTempFile(prefix, suffix, new File(tempFolderPath)); - } - - /** - * {@link #execute(Call, Type)} - * - * @param Type - * @param call An instance of the Call object - * @throws ApiException If fail to execute the call - * @return ApiResponse<T> - */ - public ApiResponse execute(Call call) throws ApiException { - return execute(call, null); - } - - /** - * Execute HTTP call and deserialize the HTTP response body into the given return type. - * - * @param returnType The return type used to deserialize HTTP response body - * @param The return type corresponding to (same with) returnType - * @param call Call - * @return ApiResponse object containing response status, headers and - * data, which is a Java object deserialized from response body and would be null - * when returnType is null. - * @throws ApiException If fail to execute the call - */ - public ApiResponse execute(Call call, Type returnType) throws ApiException { - try { - Response response = call.execute(); - T data = handleResponse(response, returnType); - return new ApiResponse(response.code(), response.headers().toMultimap(), data); - } catch (IOException e) { - throw new ApiException(e); - } - } - - /** - * {@link #executeAsync(Call, Type, ApiCallback)} - * - * @param Type - * @param call An instance of the Call object - * @param callback ApiCallback<T> - */ - public void executeAsync(Call call, ApiCallback callback) { - executeAsync(call, null, callback); - } - - /** - * Execute HTTP call asynchronously. - * - * @see #execute(Call, Type) - * @param Type - * @param call The callback to be executed when the API call finishes - * @param returnType Return type - * @param callback ApiCallback - */ - @SuppressWarnings("unchecked") - public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { - call.enqueue(new Callback() { - @Override - public void onFailure(Request request, IOException e) { - callback.onFailure(new ApiException(e), 0, null); - } - - @Override - public void onResponse(Response response) throws IOException { - T result; - try { - result = (T) handleResponse(response, returnType); - } catch (ApiException e) { - callback.onFailure(e, response.code(), response.headers().toMultimap()); - return; - } - callback.onSuccess(result, response.code(), response.headers().toMultimap()); - } - }); - } - - /** - * Handle the given response, return the deserialized object when the response is successful. - * - * @param Type - * @param response Response - * @param returnType Return type - * @throws ApiException If the response has a unsuccessful status code or - * fail to deserialize the response body - * @return Type - */ - public T handleResponse(Response response, Type returnType) throws ApiException { - if (response.isSuccessful()) { - if (returnType == null || response.code() == 204) { - // returning null if the returnType is not defined, - // or the status code is 204 (No Content) - if (response.body() != null) { - try { - response.body().close(); - } catch (IOException e) { - throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); - } - } - return null; - } else { - return deserialize(response, returnType); - } - } else { - String respBody = null; - if (response.body() != null) { - try { - respBody = response.body().string(); - } catch (IOException e) { - throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); - } - } - throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); - } - } - - /** - * Build HTTP call with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" - * @param queryParams The query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @param progressRequestListener Progress request listener - * @return The HTTP call - * @throws ApiException If fail to serialize the request body object - */ - public Call buildCall(String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - updateParamsForAuth(authNames, queryParams, headerParams); - - final String url = buildUrl(path, queryParams); - final Request.Builder reqBuilder = new Request.Builder().url(url); - processHeaderParams(headerParams, reqBuilder); - - String contentType = (String) headerParams.get("Content-Type"); - // ensuring a default content type - if (contentType == null) { - contentType = "application/json"; - } - - RequestBody reqBody; - if (!HttpMethod.permitsRequestBody(method)) { - reqBody = null; - } else if ("application/x-www-form-urlencoded".equals(contentType)) { - reqBody = buildRequestBodyFormEncoding(formParams); - } else if ("multipart/form-data".equals(contentType)) { - reqBody = buildRequestBodyMultipart(formParams); - } else if (body == null) { - if ("DELETE".equals(method)) { - // allow calling DELETE without sending a request body - reqBody = null; - } else { - // use an empty request body (for POST, PUT and PATCH) - reqBody = RequestBody.create(MediaType.parse(contentType), ""); - } - } else { - reqBody = serialize(body, contentType); - } - - Request request = null; - - if(progressRequestListener != null && reqBody != null) { - ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener); - request = reqBuilder.method(method, progressRequestBody).build(); - } else { - request = reqBuilder.method(method, reqBody).build(); - } - - return httpClient.newCall(request); - } - - /** - * Build full URL by concatenating base path, the given sub path and query parameters. - * - * @param path The sub path - * @param queryParams The query parameters - * @return The full URL - */ - public String buildUrl(String path, List queryParams) { - final StringBuilder url = new StringBuilder(); - url.append(basePath).append(path); - - if (queryParams != null && !queryParams.isEmpty()) { - // support (constant) query string in `path`, e.g. "/posts?draft=1" - String prefix = path.contains("?") ? "&" : "?"; - for (Pair param : queryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - url.append(escapeString(param.getName())).append("=").append(escapeString(value)); - } - } - } - - return url.toString(); - } - - /** - * Set header parameters to the request builder, including default headers. - * - * @param headerParams Header parameters in the ofrm of Map - * @param reqBuilder Reqeust.Builder - */ - public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { - for (Entry param : headerParams.entrySet()) { - reqBuilder.header(param.getKey(), parameterToString(param.getValue())); - } - for (Entry header : defaultHeaderMap.entrySet()) { - if (!headerParams.containsKey(header.getKey())) { - reqBuilder.header(header.getKey(), parameterToString(header.getValue())); - } - } - } - - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames The authentications to apply - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - */ - public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); - auth.applyToParams(queryParams, headerParams); - } - } - - /** - * Build a form-encoding request body with the given form parameters. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyFormEncoding(Map formParams) { - FormEncodingBuilder formBuilder = new FormEncodingBuilder(); - for (Entry param : formParams.entrySet()) { - formBuilder.add(param.getKey(), parameterToString(param.getValue())); - } - return formBuilder.build(); - } - - /** - * Build a multipart (file uploading) request body with the given form parameters, - * which could contain text fields and file fields. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyMultipart(Map formParams) { - MultipartBuilder mpBuilder = new MultipartBuilder().type(MultipartBuilder.FORM); - for (Entry param : formParams.entrySet()) { - if (param.getValue() instanceof File) { - File file = (File) param.getValue(); - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); - MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); - mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file)); - } else { - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); - mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue()))); - } - } - return mpBuilder.build(); - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - public String guessContentTypeFromFile(File file) { - String contentType = URLConnection.guessContentTypeFromName(file.getName()); - if (contentType == null) { - return "application/octet-stream"; - } else { - return contentType; - } - } - - /** - * Initialize datetime format according to the current environment, e.g. Java 1.7 and Android. - */ - private void initDatetimeFormat() { - String formatWithTimeZone = null; - if (IS_ANDROID) { - if (ANDROID_SDK_VERSION >= 18) { - // The time zone format "ZZZZZ" is available since Android 4.3 (SDK version 18) - formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"; - } - } else if (JAVA_VERSION >= 1.7) { - // The time zone format "XXX" is available since Java 1.7 - formatWithTimeZone = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"; - } - if (formatWithTimeZone != null) { - this.datetimeFormat = new SimpleDateFormat(formatWithTimeZone); - // NOTE: Use the system's default time zone (mainly for datetime formatting). - } else { - // Use a common format that works across all systems. - this.datetimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); - // Always use the UTC time zone as we are using a constant trailing "Z" here. - this.datetimeFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - } - } - - /** - * Apply SSL related settings to httpClient according to the current values of - * verifyingSsl and sslCaCert. - */ - private void applySslSettings() { - try { - KeyManager[] keyManagers = null; - TrustManager[] trustManagers = null; - HostnameVerifier hostnameVerifier = null; - if (!verifyingSsl) { - TrustManager trustAll = new X509TrustManager() { - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {} - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {} - @Override - public X509Certificate[] getAcceptedIssuers() { return null; } - }; - SSLContext sslContext = SSLContext.getInstance("TLS"); - trustManagers = new TrustManager[]{ trustAll }; - hostnameVerifier = new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { return true; } - }; - } else if (sslCaCert != null) { - char[] password = null; // Any password will work. - CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); - Collection certificates = certificateFactory.generateCertificates(sslCaCert); - if (certificates.isEmpty()) { - throw new IllegalArgumentException("expected non-empty set of trusted certificates"); - } - KeyStore caKeyStore = newEmptyKeyStore(password); - int index = 0; - for (Certificate certificate : certificates) { - String certificateAlias = "ca" + Integer.toString(index++); - caKeyStore.setCertificateEntry(certificateAlias, certificate); - } - TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - trustManagerFactory.init(caKeyStore); - trustManagers = trustManagerFactory.getTrustManagers(); - } - - if (keyManagers != null || trustManagers != null) { - SSLContext sslContext = SSLContext.getInstance("TLS"); - sslContext.init(keyManagers, trustManagers, new SecureRandom()); - httpClient.setSslSocketFactory(sslContext.getSocketFactory()); - } else { - httpClient.setSslSocketFactory(null); - } - httpClient.setHostnameVerifier(hostnameVerifier); - } catch (GeneralSecurityException e) { - throw new RuntimeException(e); - } - } - - private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { - try { - KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); - keyStore.load(null, password); - return keyStore; - } catch (IOException e) { - throw new AssertionError(e); - } - } -} diff --git a/src/main/java/io/smooch/client/ApiException.java b/src/main/java/io/smooch/client/ApiException.java deleted file mode 100644 index 7bdd283b..00000000 --- a/src/main/java/io/smooch/client/ApiException.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client; - -import java.util.Map; -import java.util.List; - - -public class ApiException extends Exception { - private int code = 0; - private Map> responseHeaders = null; - private String responseBody = null; - - public ApiException() {} - - public ApiException(Throwable throwable) { - super(throwable); - } - - public ApiException(String message) { - super(message); - } - - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { - super(message, throwable); - this.code = code; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - public ApiException(String message, int code, Map> responseHeaders, String responseBody) { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { - this(message, throwable, code, responseHeaders, null); - } - - public ApiException(int code, Map> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(int code, String message) { - super(message); - this.code = code; - } - - public ApiException(int code, String message, Map> responseHeaders, String responseBody) { - this(code, message); - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - /** - * Get the HTTP status code. - * - * @return HTTP status code - */ - public int getCode() { - return code; - } - - /** - * Get the HTTP response headers. - * - * @return A map of list of string - */ - public Map> getResponseHeaders() { - return responseHeaders; - } - - /** - * Get the HTTP response body. - * - * @return Response body in the form of string - */ - public String getResponseBody() { - return responseBody; - } -} diff --git a/src/main/java/io/smooch/client/ApiResponse.java b/src/main/java/io/smooch/client/ApiResponse.java deleted file mode 100644 index 1e3db623..00000000 --- a/src/main/java/io/smooch/client/ApiResponse.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client; - -import java.util.List; -import java.util.Map; - -/** - * API response returned by API call. - * - * @param The type of data that is deserialized from response body - */ -public class ApiResponse { - final private int statusCode; - final private Map> headers; - final private T data; - - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - */ - public ApiResponse(int statusCode, Map> headers) { - this(statusCode, headers, null); - } - - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - * @param data The object deserialized from response bod - */ - public ApiResponse(int statusCode, Map> headers, T data) { - this.statusCode = statusCode; - this.headers = headers; - this.data = data; - } - - public int getStatusCode() { - return statusCode; - } - - public Map> getHeaders() { - return headers; - } - - public T getData() { - return data; - } -} diff --git a/src/main/java/io/smooch/client/Configuration.java b/src/main/java/io/smooch/client/Configuration.java deleted file mode 100644 index 38fafa5d..00000000 --- a/src/main/java/io/smooch/client/Configuration.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client; - - -public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); - - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } - - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - * - * @param apiClient API client - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } -} diff --git a/src/main/java/io/smooch/client/GzipRequestInterceptor.java b/src/main/java/io/smooch/client/GzipRequestInterceptor.java deleted file mode 100644 index e502d5bf..00000000 --- a/src/main/java/io/smooch/client/GzipRequestInterceptor.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client; - -import com.squareup.okhttp.*; -import okio.Buffer; -import okio.BufferedSink; -import okio.GzipSink; -import okio.Okio; - -import java.io.IOException; - -/** - * Encodes request bodies using gzip. - * - * Taken from https://github.com/square/okhttp/issues/350 - */ -class GzipRequestInterceptor implements Interceptor { - @Override public Response intercept(Chain chain) throws IOException { - Request originalRequest = chain.request(); - if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { - return chain.proceed(originalRequest); - } - - Request compressedRequest = originalRequest.newBuilder() - .header("Content-Encoding", "gzip") - .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) - .build(); - return chain.proceed(compressedRequest); - } - - private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { - final Buffer buffer = new Buffer(); - requestBody.writeTo(buffer); - return new RequestBody() { - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() { - return buffer.size(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - sink.write(buffer.snapshot()); - } - }; - } - - private RequestBody gzip(final RequestBody body) { - return new RequestBody() { - @Override public MediaType contentType() { - return body.contentType(); - } - - @Override public long contentLength() { - return -1; // We don't know the compressed length in advance! - } - - @Override public void writeTo(BufferedSink sink) throws IOException { - BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); - body.writeTo(gzipSink); - gzipSink.close(); - } - }; - } -} \ No newline at end of file diff --git a/src/main/java/io/smooch/client/JSON.java b/src/main/java/io/smooch/client/JSON.java deleted file mode 100644 index a9a9a7f0..00000000 --- a/src/main/java/io/smooch/client/JSON.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonNull; -import com.google.gson.JsonParseException; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; - -import java.io.IOException; -import java.io.StringReader; -import java.lang.reflect.Type; -import java.util.Date; - -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.joda.time.format.DateTimeFormatter; -import org.joda.time.format.ISODateTimeFormat; - -public class JSON { - private ApiClient apiClient; - private Gson gson; - - /** - * JSON constructor. - * - * @param apiClient An instance of ApiClient - */ - public JSON(ApiClient apiClient) { - this.apiClient = apiClient; - gson = new GsonBuilder() - .registerTypeAdapter(Date.class, new DateAdapter(apiClient)) - .registerTypeAdapter(DateTime.class, new DateTimeTypeAdapter()) - .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) - .create(); - } - - /** - * Get Gson. - * - * @return Gson - */ - public Gson getGson() { - return gson; - } - - /** - * Set Gson. - * - * @param gson Gson - */ - public void setGson(Gson gson) { - this.gson = gson; - } - - /** - * Serialize the given Java object into JSON string. - * - * @param obj Object - * @return String representation of the JSON - */ - public String serialize(Object obj) { - return gson.toJson(obj); - } - - /** - * Deserialize the given JSON string to Java object. - * - * @param Type - * @param body The JSON string - * @param returnType The type to deserialize into - * @return The deserialized Java object - */ - @SuppressWarnings("unchecked") - public T deserialize(String body, Type returnType) { - try { - if (apiClient.isLenientOnJson()) { - JsonReader jsonReader = new JsonReader(new StringReader(body)); - // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) - jsonReader.setLenient(true); - return gson.fromJson(jsonReader, returnType); - } else { - return gson.fromJson(body, returnType); - } - } catch (JsonParseException e) { - // Fallback processing when failed to parse JSON form response body: - // return the response body string directly for the String return type; - // parse response body into date or datetime for the Date return type. - if (returnType.equals(String.class)) - return (T) body; - else if (returnType.equals(Date.class)) - return (T) apiClient.parseDateOrDatetime(body); - else throw(e); - } - } -} - -class DateAdapter implements JsonSerializer, JsonDeserializer { - private final ApiClient apiClient; - - /** - * Constructor for DateAdapter - * - * @param apiClient Api client - */ - public DateAdapter(ApiClient apiClient) { - super(); - this.apiClient = apiClient; - } - - /** - * Serialize - * - * @param src Date - * @param typeOfSrc Type - * @param context Json Serialization Context - * @return Json Element - */ - @Override - public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) { - if (src == null) { - return JsonNull.INSTANCE; - } else { - return new JsonPrimitive(apiClient.formatDatetime(src)); - } - } - - /** - * Deserialize - * - * @param json Json element - * @param date Type - * @param context Json Serialization Context - * @return Date - * @throws JsonParseException if fail to parse - */ - @Override - public Date deserialize(JsonElement json, Type date, JsonDeserializationContext context) throws JsonParseException { - String str = json.getAsJsonPrimitive().getAsString(); - try { - return apiClient.parseDateOrDatetime(str); - } catch (RuntimeException e) { - throw new JsonParseException(e); - } - } -} - -/** - * Gson TypeAdapter for Joda DateTime type - */ -class DateTimeTypeAdapter extends TypeAdapter { - - private final DateTimeFormatter parseFormatter = ISODateTimeFormat.dateOptionalTimeParser(); - private final DateTimeFormatter printFormatter = ISODateTimeFormat.dateTime(); - - @Override - public void write(JsonWriter out, DateTime date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(printFormatter.print(date)); - } - } - - @Override - public DateTime read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return parseFormatter.parseDateTime(date); - } - } -} - -/** - * Gson TypeAdapter for Joda LocalDate type - */ -class LocalDateTypeAdapter extends TypeAdapter { - - private final DateTimeFormatter formatter = ISODateTimeFormat.date(); - - @Override - public void write(JsonWriter out, LocalDate date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.print(date)); - } - } - - @Override - public LocalDate read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return formatter.parseLocalDate(date); - } - } -} diff --git a/src/main/java/io/smooch/client/Pair.java b/src/main/java/io/smooch/client/Pair.java deleted file mode 100644 index 5767e1f1..00000000 --- a/src/main/java/io/smooch/client/Pair.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client; - - -public class Pair { - private String name = ""; - private String value = ""; - - public Pair (String name, String value) { - setName(name); - setValue(value); - } - - private void setName(String name) { - if (!isValidString(name)) return; - - this.name = name; - } - - private void setValue(String value) { - if (!isValidString(value)) return; - - this.value = value; - } - - public String getName() { - return this.name; - } - - public String getValue() { - return this.value; - } - - private boolean isValidString(String arg) { - if (arg == null) return false; - if (arg.trim().isEmpty()) return false; - - return true; - } -} diff --git a/src/main/java/io/smooch/client/ProgressRequestBody.java b/src/main/java/io/smooch/client/ProgressRequestBody.java deleted file mode 100644 index d23b5c13..00000000 --- a/src/main/java/io/smooch/client/ProgressRequestBody.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client; - -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.RequestBody; - -import java.io.IOException; - -import okio.Buffer; -import okio.BufferedSink; -import okio.ForwardingSink; -import okio.Okio; -import okio.Sink; - -public class ProgressRequestBody extends RequestBody { - - public interface ProgressRequestListener { - void onRequestProgress(long bytesWritten, long contentLength, boolean done); - } - - private final RequestBody requestBody; - - private final ProgressRequestListener progressListener; - - private BufferedSink bufferedSink; - - public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) { - this.requestBody = requestBody; - this.progressListener = progressListener; - } - - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() throws IOException { - return requestBody.contentLength(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - if (bufferedSink == null) { - bufferedSink = Okio.buffer(sink(sink)); - } - - requestBody.writeTo(bufferedSink); - bufferedSink.flush(); - - } - - private Sink sink(Sink sink) { - return new ForwardingSink(sink) { - - long bytesWritten = 0L; - long contentLength = 0L; - - @Override - public void write(Buffer source, long byteCount) throws IOException { - super.write(source, byteCount); - if (contentLength == 0) { - contentLength = contentLength(); - } - - bytesWritten += byteCount; - progressListener.onRequestProgress(bytesWritten, contentLength, bytesWritten == contentLength); - } - }; - } -} diff --git a/src/main/java/io/smooch/client/ProgressResponseBody.java b/src/main/java/io/smooch/client/ProgressResponseBody.java deleted file mode 100644 index ef75fe24..00000000 --- a/src/main/java/io/smooch/client/ProgressResponseBody.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client; - -import com.squareup.okhttp.MediaType; -import com.squareup.okhttp.ResponseBody; - -import java.io.IOException; - -import okio.Buffer; -import okio.BufferedSource; -import okio.ForwardingSource; -import okio.Okio; -import okio.Source; - -public class ProgressResponseBody extends ResponseBody { - - public interface ProgressListener { - void update(long bytesRead, long contentLength, boolean done); - } - - private final ResponseBody responseBody; - private final ProgressListener progressListener; - private BufferedSource bufferedSource; - - public ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) { - this.responseBody = responseBody; - this.progressListener = progressListener; - } - - @Override - public MediaType contentType() { - return responseBody.contentType(); - } - - @Override - public long contentLength() throws IOException { - return responseBody.contentLength(); - } - - @Override - public BufferedSource source() throws IOException { - if (bufferedSource == null) { - bufferedSource = Okio.buffer(source(responseBody.source())); - } - return bufferedSource; - } - - private Source source(Source source) { - return new ForwardingSource(source) { - long totalBytesRead = 0L; - - @Override - public long read(Buffer sink, long byteCount) throws IOException { - long bytesRead = super.read(sink, byteCount); - // read() returns the number of bytes read, or -1 if this source is exhausted. - totalBytesRead += bytesRead != -1 ? bytesRead : 0; - progressListener.update(totalBytesRead, responseBody.contentLength(), bytesRead == -1); - return bytesRead; - } - }; - } -} - - diff --git a/src/main/java/io/smooch/client/StringUtil.java b/src/main/java/io/smooch/client/StringUtil.java deleted file mode 100644 index f24ed33a..00000000 --- a/src/main/java/io/smooch/client/StringUtil.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client; - - -public class StringUtil { - /** - * Check if the given array contains the given value (with case-insensitive comparison). - * - * @param array The array - * @param value The value to search - * @return true if the array contains the value - */ - public static boolean containsIgnoreCase(String[] array, String value) { - for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; - } - return false; - } - - /** - * Join an array of strings with the given separator. - *

- * Note: This might be replaced by utility method from commons-lang or guava someday - * if one of those libraries is added as dependency. - *

- * - * @param array The array of strings - * @param separator The separator - * @return the resulting string - */ - public static String join(String[] array, String separator) { - int len = array.length; - if (len == 0) return ""; - - StringBuilder out = new StringBuilder(); - out.append(array[0]); - for (int i = 1; i < len; i++) { - out.append(separator).append(array[i]); - } - return out.toString(); - } -} diff --git a/src/main/java/io/smooch/client/api/AppApi.java b/src/main/java/io/smooch/client/api/AppApi.java deleted file mode 100644 index 4a543dee..00000000 --- a/src/main/java/io/smooch/client/api/AppApi.java +++ /dev/null @@ -1,1498 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.api; - -import io.smooch.client.ApiCallback; -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.ApiResponse; -import io.smooch.client.Configuration; -import io.smooch.client.Pair; -import io.smooch.client.ProgressRequestBody; -import io.smooch.client.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import io.smooch.client.model.AppCreate; -import io.smooch.client.model.AppResponse; -import io.smooch.client.model.AppUpdate; -import io.smooch.client.model.GetSdkIdsResponse; -import io.smooch.client.model.JwtResponse; -import io.smooch.client.model.ListAppsResponse; -import io.smooch.client.model.ListSecretKeysResponse; -import io.smooch.client.model.SecretKeyCreate; -import io.smooch.client.model.SecretKeyResponse; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class AppApi { - private ApiClient apiClient; - - public AppApi() { - this(Configuration.getDefaultApiClient()); - } - - public AppApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Build call for createApp - * @param appCreateBody Body for a createApp request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call createAppCall(AppCreate appCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = appCreateBody; - - // create path and map variables - String localVarPath = "/v1.1/apps"; - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call createAppValidateBeforeCall(AppCreate appCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appCreateBody' is set - if (appCreateBody == null) { - throw new ApiException("Missing the required parameter 'appCreateBody' when calling createApp(Async)"); - } - - - com.squareup.okhttp.Call call = createAppCall(appCreateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Create a new app. - * @param appCreateBody Body for a createApp request. (required) - * @return AppResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public AppResponse createApp(AppCreate appCreateBody) throws ApiException { - ApiResponse resp = createAppWithHttpInfo(appCreateBody); - return resp.getData(); - } - - /** - * - * Create a new app. - * @param appCreateBody Body for a createApp request. (required) - * @return ApiResponse<AppResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse createAppWithHttpInfo(AppCreate appCreateBody) throws ApiException { - com.squareup.okhttp.Call call = createAppValidateBeforeCall(appCreateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Create a new app. - * @param appCreateBody Body for a createApp request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call createAppAsync(AppCreate appCreateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = createAppValidateBeforeCall(appCreateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for createSecretKey - * @param appId Identifies the app. (required) - * @param secretKeyCreateBody Body for a createSecretKey request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call createSecretKeyCall(String appId, SecretKeyCreate secretKeyCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = secretKeyCreateBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/keys" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call createSecretKeyValidateBeforeCall(String appId, SecretKeyCreate secretKeyCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling createSecretKey(Async)"); - } - - // verify the required parameter 'secretKeyCreateBody' is set - if (secretKeyCreateBody == null) { - throw new ApiException("Missing the required parameter 'secretKeyCreateBody' when calling createSecretKey(Async)"); - } - - - com.squareup.okhttp.Call call = createSecretKeyCall(appId, secretKeyCreateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Create a secret key for the specified app. - * @param appId Identifies the app. (required) - * @param secretKeyCreateBody Body for a createSecretKey request. (required) - * @return SecretKeyResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public SecretKeyResponse createSecretKey(String appId, SecretKeyCreate secretKeyCreateBody) throws ApiException { - ApiResponse resp = createSecretKeyWithHttpInfo(appId, secretKeyCreateBody); - return resp.getData(); - } - - /** - * - * Create a secret key for the specified app. - * @param appId Identifies the app. (required) - * @param secretKeyCreateBody Body for a createSecretKey request. (required) - * @return ApiResponse<SecretKeyResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse createSecretKeyWithHttpInfo(String appId, SecretKeyCreate secretKeyCreateBody) throws ApiException { - com.squareup.okhttp.Call call = createSecretKeyValidateBeforeCall(appId, secretKeyCreateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Create a secret key for the specified app. - * @param appId Identifies the app. (required) - * @param secretKeyCreateBody Body for a createSecretKey request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call createSecretKeyAsync(String appId, SecretKeyCreate secretKeyCreateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = createSecretKeyValidateBeforeCall(appId, secretKeyCreateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for deleteApp - * @param appId Identifies the app. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteAppCall(String appId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteAppValidateBeforeCall(String appId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling deleteApp(Async)"); - } - - - com.squareup.okhttp.Call call = deleteAppCall(appId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Delete the specified app. - * @param appId Identifies the app. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteApp(String appId) throws ApiException { - deleteAppWithHttpInfo(appId); - } - - /** - * - * Delete the specified app. - * @param appId Identifies the app. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteAppWithHttpInfo(String appId) throws ApiException { - com.squareup.okhttp.Call call = deleteAppValidateBeforeCall(appId, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Delete the specified app. - * @param appId Identifies the app. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteAppAsync(String appId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteAppValidateBeforeCall(appId, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for deleteSecretKey - * @param appId Identifies the app. (required) - * @param keyId Identifies the secret key. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteSecretKeyCall(String appId, String keyId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/keys/{keyId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "keyId" + "\\}", apiClient.escapeString(keyId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteSecretKeyValidateBeforeCall(String appId, String keyId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling deleteSecretKey(Async)"); - } - - // verify the required parameter 'keyId' is set - if (keyId == null) { - throw new ApiException("Missing the required parameter 'keyId' when calling deleteSecretKey(Async)"); - } - - - com.squareup.okhttp.Call call = deleteSecretKeyCall(appId, keyId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Delete the specified secret key. - * @param appId Identifies the app. (required) - * @param keyId Identifies the secret key. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteSecretKey(String appId, String keyId) throws ApiException { - deleteSecretKeyWithHttpInfo(appId, keyId); - } - - /** - * - * Delete the specified secret key. - * @param appId Identifies the app. (required) - * @param keyId Identifies the secret key. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteSecretKeyWithHttpInfo(String appId, String keyId) throws ApiException { - com.squareup.okhttp.Call call = deleteSecretKeyValidateBeforeCall(appId, keyId, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Delete the specified secret key. - * @param appId Identifies the app. (required) - * @param keyId Identifies the secret key. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteSecretKeyAsync(String appId, String keyId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteSecretKeyValidateBeforeCall(appId, keyId, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for getApp - * @param appId Identifies the app. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getAppCall(String appId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getAppValidateBeforeCall(String appId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getApp(Async)"); - } - - - com.squareup.okhttp.Call call = getAppCall(appId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get the specified app. - * @param appId Identifies the app. (required) - * @return AppResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public AppResponse getApp(String appId) throws ApiException { - ApiResponse resp = getAppWithHttpInfo(appId); - return resp.getData(); - } - - /** - * - * Get the specified app. - * @param appId Identifies the app. (required) - * @return ApiResponse<AppResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getAppWithHttpInfo(String appId) throws ApiException { - com.squareup.okhttp.Call call = getAppValidateBeforeCall(appId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get the specified app. - * @param appId Identifies the app. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getAppAsync(String appId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getAppValidateBeforeCall(appId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getAppJwt - * @param appId Identifies the app. (required) - * @param keyId Identifies the secret key. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getAppJwtCall(String appId, String keyId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/keys/{keyId}/jwt" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "keyId" + "\\}", apiClient.escapeString(keyId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getAppJwtValidateBeforeCall(String appId, String keyId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getAppJwt(Async)"); - } - - // verify the required parameter 'keyId' is set - if (keyId == null) { - throw new ApiException("Missing the required parameter 'keyId' when calling getAppJwt(Async)"); - } - - - com.squareup.okhttp.Call call = getAppJwtCall(appId, keyId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get an app-scoped JWT for the specified secret key. - * @param appId Identifies the app. (required) - * @param keyId Identifies the secret key. (required) - * @return JwtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public JwtResponse getAppJwt(String appId, String keyId) throws ApiException { - ApiResponse resp = getAppJwtWithHttpInfo(appId, keyId); - return resp.getData(); - } - - /** - * - * Get an app-scoped JWT for the specified secret key. - * @param appId Identifies the app. (required) - * @param keyId Identifies the secret key. (required) - * @return ApiResponse<JwtResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getAppJwtWithHttpInfo(String appId, String keyId) throws ApiException { - com.squareup.okhttp.Call call = getAppJwtValidateBeforeCall(appId, keyId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get an app-scoped JWT for the specified secret key. - * @param appId Identifies the app. (required) - * @param keyId Identifies the secret key. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getAppJwtAsync(String appId, String keyId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getAppJwtValidateBeforeCall(appId, keyId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getSdkIds - * @param appId Identifies the app. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getSdkIdsCall(String appId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/sdks" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getSdkIdsValidateBeforeCall(String appId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getSdkIds(Async)"); - } - - - com.squareup.okhttp.Call call = getSdkIdsCall(appId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Retrieve the IDs of the three SDK integrations (`android`, `ios`, and `web`) for the specified app, to be used when initializing the SDKs. - * @param appId Identifies the app. (required) - * @return GetSdkIdsResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public GetSdkIdsResponse getSdkIds(String appId) throws ApiException { - ApiResponse resp = getSdkIdsWithHttpInfo(appId); - return resp.getData(); - } - - /** - * - * Retrieve the IDs of the three SDK integrations (`android`, `ios`, and `web`) for the specified app, to be used when initializing the SDKs. - * @param appId Identifies the app. (required) - * @return ApiResponse<GetSdkIdsResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getSdkIdsWithHttpInfo(String appId) throws ApiException { - com.squareup.okhttp.Call call = getSdkIdsValidateBeforeCall(appId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Retrieve the IDs of the three SDK integrations (`android`, `ios`, and `web`) for the specified app, to be used when initializing the SDKs. - * @param appId Identifies the app. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getSdkIdsAsync(String appId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getSdkIdsValidateBeforeCall(appId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getSecretKey - * @param appId Identifies the app. (required) - * @param keyId Identifies the secret key. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getSecretKeyCall(String appId, String keyId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/keys/{keyId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "keyId" + "\\}", apiClient.escapeString(keyId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getSecretKeyValidateBeforeCall(String appId, String keyId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getSecretKey(Async)"); - } - - // verify the required parameter 'keyId' is set - if (keyId == null) { - throw new ApiException("Missing the required parameter 'keyId' when calling getSecretKey(Async)"); - } - - - com.squareup.okhttp.Call call = getSecretKeyCall(appId, keyId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get the specified secret key. - * @param appId Identifies the app. (required) - * @param keyId Identifies the secret key. (required) - * @return SecretKeyResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public SecretKeyResponse getSecretKey(String appId, String keyId) throws ApiException { - ApiResponse resp = getSecretKeyWithHttpInfo(appId, keyId); - return resp.getData(); - } - - /** - * - * Get the specified secret key. - * @param appId Identifies the app. (required) - * @param keyId Identifies the secret key. (required) - * @return ApiResponse<SecretKeyResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getSecretKeyWithHttpInfo(String appId, String keyId) throws ApiException { - com.squareup.okhttp.Call call = getSecretKeyValidateBeforeCall(appId, keyId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get the specified secret key. - * @param appId Identifies the app. (required) - * @param keyId Identifies the secret key. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getSecretKeyAsync(String appId, String keyId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getSecretKeyValidateBeforeCall(appId, keyId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for listApps - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @param serviceAccountId The service account ID for which to list apps. (optional, default to ) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call listAppsCall(Integer limit, Integer offset, String serviceAccountId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps"; - - List localVarQueryParams = new ArrayList(); - if (limit != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit)); - if (offset != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset)); - if (serviceAccountId != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "serviceAccountId", serviceAccountId)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call listAppsValidateBeforeCall(Integer limit, Integer offset, String serviceAccountId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - - com.squareup.okhttp.Call call = listAppsCall(limit, offset, serviceAccountId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * List all apps configured. - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @param serviceAccountId The service account ID for which to list apps. (optional, default to ) - * @return ListAppsResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ListAppsResponse listApps(Integer limit, Integer offset, String serviceAccountId) throws ApiException { - ApiResponse resp = listAppsWithHttpInfo(limit, offset, serviceAccountId); - return resp.getData(); - } - - /** - * - * List all apps configured. - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @param serviceAccountId The service account ID for which to list apps. (optional, default to ) - * @return ApiResponse<ListAppsResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse listAppsWithHttpInfo(Integer limit, Integer offset, String serviceAccountId) throws ApiException { - com.squareup.okhttp.Call call = listAppsValidateBeforeCall(limit, offset, serviceAccountId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * List all apps configured. - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @param serviceAccountId The service account ID for which to list apps. (optional, default to ) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call listAppsAsync(Integer limit, Integer offset, String serviceAccountId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = listAppsValidateBeforeCall(limit, offset, serviceAccountId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for listSecretKeys - * @param appId Identifies the app. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call listSecretKeysCall(String appId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/keys" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call listSecretKeysValidateBeforeCall(String appId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling listSecretKeys(Async)"); - } - - - com.squareup.okhttp.Call call = listSecretKeysCall(appId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * List the secret keys for the specified app. - * @param appId Identifies the app. (required) - * @return ListSecretKeysResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ListSecretKeysResponse listSecretKeys(String appId) throws ApiException { - ApiResponse resp = listSecretKeysWithHttpInfo(appId); - return resp.getData(); - } - - /** - * - * List the secret keys for the specified app. - * @param appId Identifies the app. (required) - * @return ApiResponse<ListSecretKeysResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse listSecretKeysWithHttpInfo(String appId) throws ApiException { - com.squareup.okhttp.Call call = listSecretKeysValidateBeforeCall(appId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * List the secret keys for the specified app. - * @param appId Identifies the app. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call listSecretKeysAsync(String appId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = listSecretKeysValidateBeforeCall(appId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for updateApp - * @param appId Identifies the app. (required) - * @param appUpdateBody Body for an updateApp request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call updateAppCall(String appId, AppUpdate appUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = appUpdateBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call updateAppValidateBeforeCall(String appId, AppUpdate appUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling updateApp(Async)"); - } - - // verify the required parameter 'appUpdateBody' is set - if (appUpdateBody == null) { - throw new ApiException("Missing the required parameter 'appUpdateBody' when calling updateApp(Async)"); - } - - - com.squareup.okhttp.Call call = updateAppCall(appId, appUpdateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Update the specified app. - * @param appId Identifies the app. (required) - * @param appUpdateBody Body for an updateApp request. (required) - * @return AppResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public AppResponse updateApp(String appId, AppUpdate appUpdateBody) throws ApiException { - ApiResponse resp = updateAppWithHttpInfo(appId, appUpdateBody); - return resp.getData(); - } - - /** - * - * Update the specified app. - * @param appId Identifies the app. (required) - * @param appUpdateBody Body for an updateApp request. (required) - * @return ApiResponse<AppResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse updateAppWithHttpInfo(String appId, AppUpdate appUpdateBody) throws ApiException { - com.squareup.okhttp.Call call = updateAppValidateBeforeCall(appId, appUpdateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Update the specified app. - * @param appId Identifies the app. (required) - * @param appUpdateBody Body for an updateApp request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call updateAppAsync(String appId, AppUpdate appUpdateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = updateAppValidateBeforeCall(appId, appUpdateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } -} diff --git a/src/main/java/io/smooch/client/api/AppUserApi.java b/src/main/java/io/smooch/client/api/AppUserApi.java deleted file mode 100644 index d6d2debc..00000000 --- a/src/main/java/io/smooch/client/api/AppUserApi.java +++ /dev/null @@ -1,1882 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.api; - -import io.smooch.client.ApiCallback; -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.ApiResponse; -import io.smooch.client.Configuration; -import io.smooch.client.Pair; -import io.smooch.client.ProgressRequestBody; -import io.smooch.client.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import io.smooch.client.model.AppUserBusinessSystemsResponse; -import io.smooch.client.model.AppUserChannelsResponse; -import io.smooch.client.model.AppUserLink; -import io.smooch.client.model.AppUserMerge; -import io.smooch.client.model.AppUserPreCreate; -import io.smooch.client.model.AppUserResponse; -import io.smooch.client.model.AppUserUpdate; -import io.smooch.client.model.AuthCodeResponse; -import java.io.File; -import io.smooch.client.model.LinkRequestResponse; -import io.smooch.client.model.MessageResponse; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class AppUserApi { - private ApiClient apiClient; - - public AppUserApi() { - this(Configuration.getDefaultApiClient()); - } - - public AppUserApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Build call for deleteAppUser - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteAppUserCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteAppUserValidateBeforeCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling deleteAppUser(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling deleteAppUser(Async)"); - } - - - com.squareup.okhttp.Call call = deleteAppUserCall(appId, userId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Delete specified app user. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteAppUser(String appId, String userId) throws ApiException { - deleteAppUserWithHttpInfo(appId, userId); - } - - /** - * - * Delete specified app user. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteAppUserWithHttpInfo(String appId, String userId) throws ApiException { - com.squareup.okhttp.Call call = deleteAppUserValidateBeforeCall(appId, userId, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Delete specified app user. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteAppUserAsync(String appId, String userId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteAppUserValidateBeforeCall(appId, userId, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for deleteAppUserProfile - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteAppUserProfileCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}/profile" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteAppUserProfileValidateBeforeCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling deleteAppUserProfile(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling deleteAppUserProfile(Async)"); - } - - - com.squareup.okhttp.Call call = deleteAppUserProfileCall(appId, userId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Delete specified app user's profile. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @return AppUserResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public AppUserResponse deleteAppUserProfile(String appId, String userId) throws ApiException { - ApiResponse resp = deleteAppUserProfileWithHttpInfo(appId, userId); - return resp.getData(); - } - - /** - * - * Delete specified app user's profile. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @return ApiResponse<AppUserResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteAppUserProfileWithHttpInfo(String appId, String userId) throws ApiException { - com.squareup.okhttp.Call call = deleteAppUserProfileValidateBeforeCall(appId, userId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Delete specified app user's profile. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteAppUserProfileAsync(String appId, String userId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteAppUserProfileValidateBeforeCall(appId, userId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getAppUser - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getAppUserCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getAppUserValidateBeforeCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getAppUser(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling getAppUser(Async)"); - } - - - com.squareup.okhttp.Call call = getAppUserCall(appId, userId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get the specified app user. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @return AppUserResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public AppUserResponse getAppUser(String appId, String userId) throws ApiException { - ApiResponse resp = getAppUserWithHttpInfo(appId, userId); - return resp.getData(); - } - - /** - * - * Get the specified app user. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @return ApiResponse<AppUserResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getAppUserWithHttpInfo(String appId, String userId) throws ApiException { - com.squareup.okhttp.Call call = getAppUserValidateBeforeCall(appId, userId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get the specified app user. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getAppUserAsync(String appId, String userId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getAppUserValidateBeforeCall(appId, userId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getAppUserAuthCode - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getAppUserAuthCodeCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}/authcode" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getAppUserAuthCodeValidateBeforeCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getAppUserAuthCode(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling getAppUserAuthCode(Async)"); - } - - - com.squareup.okhttp.Call call = getAppUserAuthCodeCall(appId, userId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get an auth code for facilitating a channel transfer - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @return AuthCodeResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public AuthCodeResponse getAppUserAuthCode(String appId, String userId) throws ApiException { - ApiResponse resp = getAppUserAuthCodeWithHttpInfo(appId, userId); - return resp.getData(); - } - - /** - * - * Get an auth code for facilitating a channel transfer - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @return ApiResponse<AuthCodeResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getAppUserAuthCodeWithHttpInfo(String appId, String userId) throws ApiException { - com.squareup.okhttp.Call call = getAppUserAuthCodeValidateBeforeCall(appId, userId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get an auth code for facilitating a channel transfer - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getAppUserAuthCodeAsync(String appId, String userId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getAppUserAuthCodeValidateBeforeCall(appId, userId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getAppUserBusinessSystemIds - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getAppUserBusinessSystemIdsCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}/businesssystems" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getAppUserBusinessSystemIdsValidateBeforeCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getAppUserBusinessSystemIds(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling getAppUserBusinessSystemIds(Async)"); - } - - - com.squareup.okhttp.Call call = getAppUserBusinessSystemIdsCall(appId, userId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get specified app user's business system IDs. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @return AppUserBusinessSystemsResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public AppUserBusinessSystemsResponse getAppUserBusinessSystemIds(String appId, String userId) throws ApiException { - ApiResponse resp = getAppUserBusinessSystemIdsWithHttpInfo(appId, userId); - return resp.getData(); - } - - /** - * - * Get specified app user's business system IDs. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @return ApiResponse<AppUserBusinessSystemsResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getAppUserBusinessSystemIdsWithHttpInfo(String appId, String userId) throws ApiException { - com.squareup.okhttp.Call call = getAppUserBusinessSystemIdsValidateBeforeCall(appId, userId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get specified app user's business system IDs. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getAppUserBusinessSystemIdsAsync(String appId, String userId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getAppUserBusinessSystemIdsValidateBeforeCall(appId, userId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getAppUserEntityIds - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getAppUserEntityIdsCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}/channels" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getAppUserEntityIdsValidateBeforeCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getAppUserEntityIds(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling getAppUserEntityIds(Async)"); - } - - - com.squareup.okhttp.Call call = getAppUserEntityIdsCall(appId, userId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get specified app user's channel entity IDs. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @return AppUserChannelsResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public AppUserChannelsResponse getAppUserEntityIds(String appId, String userId) throws ApiException { - ApiResponse resp = getAppUserEntityIdsWithHttpInfo(appId, userId); - return resp.getData(); - } - - /** - * - * Get specified app user's channel entity IDs. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @return ApiResponse<AppUserChannelsResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getAppUserEntityIdsWithHttpInfo(String appId, String userId) throws ApiException { - com.squareup.okhttp.Call call = getAppUserEntityIdsValidateBeforeCall(appId, userId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get specified app user's channel entity IDs. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getAppUserEntityIdsAsync(String appId, String userId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getAppUserEntityIdsValidateBeforeCall(appId, userId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getLinkRequests - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param integrationIds List of integration IDs (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getLinkRequestsCall(String appId, String userId, List integrationIds, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}/linkrequest" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())); - - List localVarQueryParams = new ArrayList(); - if (integrationIds != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "integrationIds", integrationIds)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getLinkRequestsValidateBeforeCall(String appId, String userId, List integrationIds, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getLinkRequests(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling getLinkRequests(Async)"); - } - - // verify the required parameter 'integrationIds' is set - if (integrationIds == null) { - throw new ApiException("Missing the required parameter 'integrationIds' when calling getLinkRequests(Async)"); - } - - - com.squareup.okhttp.Call call = getLinkRequestsCall(appId, userId, integrationIds, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Fetch link requests for the specified app user. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param integrationIds List of integration IDs (required) - * @return LinkRequestResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public LinkRequestResponse getLinkRequests(String appId, String userId, List integrationIds) throws ApiException { - ApiResponse resp = getLinkRequestsWithHttpInfo(appId, userId, integrationIds); - return resp.getData(); - } - - /** - * - * Fetch link requests for the specified app user. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param integrationIds List of integration IDs (required) - * @return ApiResponse<LinkRequestResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getLinkRequestsWithHttpInfo(String appId, String userId, List integrationIds) throws ApiException { - com.squareup.okhttp.Call call = getLinkRequestsValidateBeforeCall(appId, userId, integrationIds, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Fetch link requests for the specified app user. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param integrationIds List of integration IDs (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getLinkRequestsAsync(String appId, String userId, List integrationIds, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getLinkRequestsValidateBeforeCall(appId, userId, integrationIds, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for linkAppUser - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param appUserLinkBody Body for a linkAppUser request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call linkAppUserCall(String appId, String userId, AppUserLink appUserLinkBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = appUserLinkBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}/channels" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call linkAppUserValidateBeforeCall(String appId, String userId, AppUserLink appUserLinkBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling linkAppUser(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling linkAppUser(Async)"); - } - - // verify the required parameter 'appUserLinkBody' is set - if (appUserLinkBody == null) { - throw new ApiException("Missing the required parameter 'appUserLinkBody' when calling linkAppUser(Async)"); - } - - - com.squareup.okhttp.Call call = linkAppUserCall(appId, userId, appUserLinkBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Link specified app user to given channel. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param appUserLinkBody Body for a linkAppUser request. (required) - * @return AppUserResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public AppUserResponse linkAppUser(String appId, String userId, AppUserLink appUserLinkBody) throws ApiException { - ApiResponse resp = linkAppUserWithHttpInfo(appId, userId, appUserLinkBody); - return resp.getData(); - } - - /** - * - * Link specified app user to given channel. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param appUserLinkBody Body for a linkAppUser request. (required) - * @return ApiResponse<AppUserResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse linkAppUserWithHttpInfo(String appId, String userId, AppUserLink appUserLinkBody) throws ApiException { - com.squareup.okhttp.Call call = linkAppUserValidateBeforeCall(appId, userId, appUserLinkBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Link specified app user to given channel. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param appUserLinkBody Body for a linkAppUser request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call linkAppUserAsync(String appId, String userId, AppUserLink appUserLinkBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = linkAppUserValidateBeforeCall(appId, userId, appUserLinkBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for mergeUsers - * @param appId Identifies the app. (required) - * @param appUserMergeBody Body for a mergeUsers request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call mergeUsersCall(String appId, AppUserMerge appUserMergeBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = appUserMergeBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/merge" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call mergeUsersValidateBeforeCall(String appId, AppUserMerge appUserMergeBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling mergeUsers(Async)"); - } - - // verify the required parameter 'appUserMergeBody' is set - if (appUserMergeBody == null) { - throw new ApiException("Missing the required parameter 'appUserMergeBody' when calling mergeUsers(Async)"); - } - - - com.squareup.okhttp.Call call = mergeUsersCall(appId, appUserMergeBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Force the merge of two specific users, when the business has determined that they represent the same person. - * @param appId Identifies the app. (required) - * @param appUserMergeBody Body for a mergeUsers request. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void mergeUsers(String appId, AppUserMerge appUserMergeBody) throws ApiException { - mergeUsersWithHttpInfo(appId, appUserMergeBody); - } - - /** - * - * Force the merge of two specific users, when the business has determined that they represent the same person. - * @param appId Identifies the app. (required) - * @param appUserMergeBody Body for a mergeUsers request. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse mergeUsersWithHttpInfo(String appId, AppUserMerge appUserMergeBody) throws ApiException { - com.squareup.okhttp.Call call = mergeUsersValidateBeforeCall(appId, appUserMergeBody, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Force the merge of two specific users, when the business has determined that they represent the same person. - * @param appId Identifies the app. (required) - * @param appUserMergeBody Body for a mergeUsers request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call mergeUsersAsync(String appId, AppUserMerge appUserMergeBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = mergeUsersValidateBeforeCall(appId, appUserMergeBody, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for postImageMessage - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param source Image to be uploaded (required) - * @param role Role of the sender (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postImageMessageCall(String appId, String userId, File source, String role, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}/images" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - if (source != null) - localVarFormParams.put("source", source); - if (role != null) - localVarFormParams.put("role", role); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "multipart/form-data" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postImageMessageValidateBeforeCall(String appId, String userId, File source, String role, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling postImageMessage(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling postImageMessage(Async)"); - } - - // verify the required parameter 'source' is set - if (source == null) { - throw new ApiException("Missing the required parameter 'source' when calling postImageMessage(Async)"); - } - - // verify the required parameter 'role' is set - if (role == null) { - throw new ApiException("Missing the required parameter 'role' when calling postImageMessage(Async)"); - } - - - com.squareup.okhttp.Call call = postImageMessageCall(appId, userId, source, role, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Send an image message to the conversation. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param source Image to be uploaded (required) - * @param role Role of the sender (required) - * @return MessageResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public MessageResponse postImageMessage(String appId, String userId, File source, String role) throws ApiException { - ApiResponse resp = postImageMessageWithHttpInfo(appId, userId, source, role); - return resp.getData(); - } - - /** - * - * Send an image message to the conversation. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param source Image to be uploaded (required) - * @param role Role of the sender (required) - * @return ApiResponse<MessageResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postImageMessageWithHttpInfo(String appId, String userId, File source, String role) throws ApiException { - com.squareup.okhttp.Call call = postImageMessageValidateBeforeCall(appId, userId, source, role, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Send an image message to the conversation. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param source Image to be uploaded (required) - * @param role Role of the sender (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postImageMessageAsync(String appId, String userId, File source, String role, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postImageMessageValidateBeforeCall(appId, userId, source, role, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for preCreateAppUser - * @param appId Identifies the app. (required) - * @param appUserPreCreateBody Body for a preCreateAppUser request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call preCreateAppUserCall(String appId, AppUserPreCreate appUserPreCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = appUserPreCreateBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call preCreateAppUserValidateBeforeCall(String appId, AppUserPreCreate appUserPreCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling preCreateAppUser(Async)"); - } - - // verify the required parameter 'appUserPreCreateBody' is set - if (appUserPreCreateBody == null) { - throw new ApiException("Missing the required parameter 'appUserPreCreateBody' when calling preCreateAppUser(Async)"); - } - - - com.squareup.okhttp.Call call = preCreateAppUserCall(appId, appUserPreCreateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Pre-create an app user. - * @param appId Identifies the app. (required) - * @param appUserPreCreateBody Body for a preCreateAppUser request. (required) - * @return AppUserResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public AppUserResponse preCreateAppUser(String appId, AppUserPreCreate appUserPreCreateBody) throws ApiException { - ApiResponse resp = preCreateAppUserWithHttpInfo(appId, appUserPreCreateBody); - return resp.getData(); - } - - /** - * - * Pre-create an app user. - * @param appId Identifies the app. (required) - * @param appUserPreCreateBody Body for a preCreateAppUser request. (required) - * @return ApiResponse<AppUserResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse preCreateAppUserWithHttpInfo(String appId, AppUserPreCreate appUserPreCreateBody) throws ApiException { - com.squareup.okhttp.Call call = preCreateAppUserValidateBeforeCall(appId, appUserPreCreateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Pre-create an app user. - * @param appId Identifies the app. (required) - * @param appUserPreCreateBody Body for a preCreateAppUser request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call preCreateAppUserAsync(String appId, AppUserPreCreate appUserPreCreateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = preCreateAppUserValidateBeforeCall(appId, appUserPreCreateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for unlinkAppUser - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param channel Name of the channel. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call unlinkAppUserCall(String appId, String userId, String channel, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}/channels/{channel}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())) - .replaceAll("\\{" + "channel" + "\\}", apiClient.escapeString(channel.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call unlinkAppUserValidateBeforeCall(String appId, String userId, String channel, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling unlinkAppUser(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling unlinkAppUser(Async)"); - } - - // verify the required parameter 'channel' is set - if (channel == null) { - throw new ApiException("Missing the required parameter 'channel' when calling unlinkAppUser(Async)"); - } - - - com.squareup.okhttp.Call call = unlinkAppUserCall(appId, userId, channel, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Unlink specified app user from given channel. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param channel Name of the channel. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void unlinkAppUser(String appId, String userId, String channel) throws ApiException { - unlinkAppUserWithHttpInfo(appId, userId, channel); - } - - /** - * - * Unlink specified app user from given channel. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param channel Name of the channel. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse unlinkAppUserWithHttpInfo(String appId, String userId, String channel) throws ApiException { - com.squareup.okhttp.Call call = unlinkAppUserValidateBeforeCall(appId, userId, channel, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Unlink specified app user from given channel. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param channel Name of the channel. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call unlinkAppUserAsync(String appId, String userId, String channel, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = unlinkAppUserValidateBeforeCall(appId, userId, channel, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for updateAppUser - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param appUserUpdateBody Body for an updateAppUser request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call updateAppUserCall(String appId, String userId, AppUserUpdate appUserUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = appUserUpdateBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call updateAppUserValidateBeforeCall(String appId, String userId, AppUserUpdate appUserUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling updateAppUser(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling updateAppUser(Async)"); - } - - // verify the required parameter 'appUserUpdateBody' is set - if (appUserUpdateBody == null) { - throw new ApiException("Missing the required parameter 'appUserUpdateBody' when calling updateAppUser(Async)"); - } - - - com.squareup.okhttp.Call call = updateAppUserCall(appId, userId, appUserUpdateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Update the specified app user. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param appUserUpdateBody Body for an updateAppUser request. (required) - * @return AppUserResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public AppUserResponse updateAppUser(String appId, String userId, AppUserUpdate appUserUpdateBody) throws ApiException { - ApiResponse resp = updateAppUserWithHttpInfo(appId, userId, appUserUpdateBody); - return resp.getData(); - } - - /** - * - * Update the specified app user. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param appUserUpdateBody Body for an updateAppUser request. (required) - * @return ApiResponse<AppUserResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse updateAppUserWithHttpInfo(String appId, String userId, AppUserUpdate appUserUpdateBody) throws ApiException { - com.squareup.okhttp.Call call = updateAppUserValidateBeforeCall(appId, userId, appUserUpdateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Update the specified app user. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param appUserUpdateBody Body for an updateAppUser request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call updateAppUserAsync(String appId, String userId, AppUserUpdate appUserUpdateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = updateAppUserValidateBeforeCall(appId, userId, appUserUpdateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } -} diff --git a/src/main/java/io/smooch/client/api/AttachmentsApi.java b/src/main/java/io/smooch/client/api/AttachmentsApi.java deleted file mode 100644 index 0fe1e546..00000000 --- a/src/main/java/io/smooch/client/api/AttachmentsApi.java +++ /dev/null @@ -1,356 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.api; - -import io.smooch.client.ApiCallback; -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.ApiResponse; -import io.smooch.client.Configuration; -import io.smooch.client.Pair; -import io.smooch.client.ProgressRequestBody; -import io.smooch.client.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import io.smooch.client.model.AttachmentRemove; -import io.smooch.client.model.AttachmentResponse; -import java.io.File; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class AttachmentsApi { - private ApiClient apiClient; - - public AttachmentsApi() { - this(Configuration.getDefaultApiClient()); - } - - public AttachmentsApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Build call for removeAttachment - * @param appId Identifies the app. (required) - * @param attachmentRemoveBody Body for a removeAttachment request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call removeAttachmentCall(String appId, AttachmentRemove attachmentRemoveBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = attachmentRemoveBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/attachments/remove" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call removeAttachmentValidateBeforeCall(String appId, AttachmentRemove attachmentRemoveBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling removeAttachment(Async)"); - } - - // verify the required parameter 'attachmentRemoveBody' is set - if (attachmentRemoveBody == null) { - throw new ApiException("Missing the required parameter 'attachmentRemoveBody' when calling removeAttachment(Async)"); - } - - - com.squareup.okhttp.Call call = removeAttachmentCall(appId, attachmentRemoveBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Remove an attachment uploaded to Smooch. - * @param appId Identifies the app. (required) - * @param attachmentRemoveBody Body for a removeAttachment request. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void removeAttachment(String appId, AttachmentRemove attachmentRemoveBody) throws ApiException { - removeAttachmentWithHttpInfo(appId, attachmentRemoveBody); - } - - /** - * - * Remove an attachment uploaded to Smooch. - * @param appId Identifies the app. (required) - * @param attachmentRemoveBody Body for a removeAttachment request. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse removeAttachmentWithHttpInfo(String appId, AttachmentRemove attachmentRemoveBody) throws ApiException { - com.squareup.okhttp.Call call = removeAttachmentValidateBeforeCall(appId, attachmentRemoveBody, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Remove an attachment uploaded to Smooch. - * @param appId Identifies the app. (required) - * @param attachmentRemoveBody Body for a removeAttachment request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call removeAttachmentAsync(String appId, AttachmentRemove attachmentRemoveBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = removeAttachmentValidateBeforeCall(appId, attachmentRemoveBody, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for uploadAttachment - * @param appId Identifies the app. (required) - * @param source File to be uploaded (required) - * @param access Access level for the resulting file (required) - * @param _for The intended container for the attachment (optional) - * @param appUserId The appUserId of the user that will receive the attachment Used in attachments for messages (optional) - * @param userId The userId of the user that will receive the attachment Used in attachments for messages (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call uploadAttachmentCall(String appId, File source, String access, String _for, String appUserId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/attachments" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - if (access != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "access", access)); - if (_for != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "for", _for)); - if (appUserId != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "appUserId", appUserId)); - if (userId != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "userId", userId)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - if (source != null) - localVarFormParams.put("source", source); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "multipart/form-data" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call uploadAttachmentValidateBeforeCall(String appId, File source, String access, String _for, String appUserId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling uploadAttachment(Async)"); - } - - // verify the required parameter 'source' is set - if (source == null) { - throw new ApiException("Missing the required parameter 'source' when calling uploadAttachment(Async)"); - } - - // verify the required parameter 'access' is set - if (access == null) { - throw new ApiException("Missing the required parameter 'access' when calling uploadAttachment(Async)"); - } - - - com.squareup.okhttp.Call call = uploadAttachmentCall(appId, source, access, _for, appUserId, userId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Upload an attachment to Smooch to use in future messages. - * @param appId Identifies the app. (required) - * @param source File to be uploaded (required) - * @param access Access level for the resulting file (required) - * @param _for The intended container for the attachment (optional) - * @param appUserId The appUserId of the user that will receive the attachment Used in attachments for messages (optional) - * @param userId The userId of the user that will receive the attachment Used in attachments for messages (optional) - * @return AttachmentResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public AttachmentResponse uploadAttachment(String appId, File source, String access, String _for, String appUserId, String userId) throws ApiException { - ApiResponse resp = uploadAttachmentWithHttpInfo(appId, source, access, _for, appUserId, userId); - return resp.getData(); - } - - /** - * - * Upload an attachment to Smooch to use in future messages. - * @param appId Identifies the app. (required) - * @param source File to be uploaded (required) - * @param access Access level for the resulting file (required) - * @param _for The intended container for the attachment (optional) - * @param appUserId The appUserId of the user that will receive the attachment Used in attachments for messages (optional) - * @param userId The userId of the user that will receive the attachment Used in attachments for messages (optional) - * @return ApiResponse<AttachmentResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse uploadAttachmentWithHttpInfo(String appId, File source, String access, String _for, String appUserId, String userId) throws ApiException { - com.squareup.okhttp.Call call = uploadAttachmentValidateBeforeCall(appId, source, access, _for, appUserId, userId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Upload an attachment to Smooch to use in future messages. - * @param appId Identifies the app. (required) - * @param source File to be uploaded (required) - * @param access Access level for the resulting file (required) - * @param _for The intended container for the attachment (optional) - * @param appUserId The appUserId of the user that will receive the attachment Used in attachments for messages (optional) - * @param userId The userId of the user that will receive the attachment Used in attachments for messages (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call uploadAttachmentAsync(String appId, File source, String access, String _for, String appUserId, String userId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = uploadAttachmentValidateBeforeCall(appId, source, access, _for, appUserId, userId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } -} diff --git a/src/main/java/io/smooch/client/api/ConversationApi.java b/src/main/java/io/smooch/client/api/ConversationApi.java deleted file mode 100644 index ba7bdf91..00000000 --- a/src/main/java/io/smooch/client/api/ConversationApi.java +++ /dev/null @@ -1,905 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.api; - -import io.smooch.client.ApiCallback; -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.ApiResponse; -import io.smooch.client.Configuration; -import io.smooch.client.Pair; -import io.smooch.client.ProgressRequestBody; -import io.smooch.client.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import io.smooch.client.model.ActivityResponse; -import io.smooch.client.model.ConversationActivity; -import io.smooch.client.model.GetMessagesResponse; -import io.smooch.client.model.MessagePost; -import io.smooch.client.model.MessageResponse; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class ConversationApi { - private ApiClient apiClient; - - public ConversationApi() { - this(Configuration.getDefaultApiClient()); - } - - public ConversationApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Build call for conversationActivity - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param conversationActivityBody Body for a triggerConversationActivity request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call conversationActivityCall(String appId, String userId, ConversationActivity conversationActivityBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = conversationActivityBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}/conversation/activity" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call conversationActivityValidateBeforeCall(String appId, String userId, ConversationActivity conversationActivityBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling conversationActivity(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling conversationActivity(Async)"); - } - - // verify the required parameter 'conversationActivityBody' is set - if (conversationActivityBody == null) { - throw new ApiException("Missing the required parameter 'conversationActivityBody' when calling conversationActivity(Async)"); - } - - - com.squareup.okhttp.Call call = conversationActivityCall(appId, userId, conversationActivityBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Notify Smooch when an app maker starts or stops typing a response. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param conversationActivityBody Body for a triggerConversationActivity request. (required) - * @return ActivityResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ActivityResponse conversationActivity(String appId, String userId, ConversationActivity conversationActivityBody) throws ApiException { - ApiResponse resp = conversationActivityWithHttpInfo(appId, userId, conversationActivityBody); - return resp.getData(); - } - - /** - * - * Notify Smooch when an app maker starts or stops typing a response. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param conversationActivityBody Body for a triggerConversationActivity request. (required) - * @return ApiResponse<ActivityResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse conversationActivityWithHttpInfo(String appId, String userId, ConversationActivity conversationActivityBody) throws ApiException { - com.squareup.okhttp.Call call = conversationActivityValidateBeforeCall(appId, userId, conversationActivityBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Notify Smooch when an app maker starts or stops typing a response. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param conversationActivityBody Body for a triggerConversationActivity request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call conversationActivityAsync(String appId, String userId, ConversationActivity conversationActivityBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = conversationActivityValidateBeforeCall(appId, userId, conversationActivityBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for deleteMessage - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param messageId Identifies the message. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteMessageCall(String appId, String userId, String messageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}/messages/{messageId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())) - .replaceAll("\\{" + "messageId" + "\\}", apiClient.escapeString(messageId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteMessageValidateBeforeCall(String appId, String userId, String messageId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling deleteMessage(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling deleteMessage(Async)"); - } - - // verify the required parameter 'messageId' is set - if (messageId == null) { - throw new ApiException("Missing the required parameter 'messageId' when calling deleteMessage(Async)"); - } - - - com.squareup.okhttp.Call call = deleteMessageCall(appId, userId, messageId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Deletes a single message. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param messageId Identifies the message. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteMessage(String appId, String userId, String messageId) throws ApiException { - deleteMessageWithHttpInfo(appId, userId, messageId); - } - - /** - * - * Deletes a single message. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param messageId Identifies the message. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteMessageWithHttpInfo(String appId, String userId, String messageId) throws ApiException { - com.squareup.okhttp.Call call = deleteMessageValidateBeforeCall(appId, userId, messageId, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Deletes a single message. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param messageId Identifies the message. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteMessageAsync(String appId, String userId, String messageId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteMessageValidateBeforeCall(appId, userId, messageId, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for deleteMessages - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteMessagesCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}/messages" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteMessagesValidateBeforeCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling deleteMessages(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling deleteMessages(Async)"); - } - - - com.squareup.okhttp.Call call = deleteMessagesCall(appId, userId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Clears the message history for a user, permanently deleting all messages, but leaving any connections to Messaging Channels and Business Systems intact. These connections allow for the conversation to continue in the future, while still being associated to the same appUser. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteMessages(String appId, String userId) throws ApiException { - deleteMessagesWithHttpInfo(appId, userId); - } - - /** - * - * Clears the message history for a user, permanently deleting all messages, but leaving any connections to Messaging Channels and Business Systems intact. These connections allow for the conversation to continue in the future, while still being associated to the same appUser. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteMessagesWithHttpInfo(String appId, String userId) throws ApiException { - com.squareup.okhttp.Call call = deleteMessagesValidateBeforeCall(appId, userId, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Clears the message history for a user, permanently deleting all messages, but leaving any connections to Messaging Channels and Business Systems intact. These connections allow for the conversation to continue in the future, while still being associated to the same appUser. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteMessagesAsync(String appId, String userId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteMessagesValidateBeforeCall(appId, userId, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for getMessages - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param before Timestamp of message. The API will return 100 messages before the specified timestamp (excluding any messages with the provided timestamp). (optional) - * @param after Timestamp of message. The API will return 100 messages after the specified timestamp (excluding any messages with the provided timestamp). (optional) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getMessagesCall(String appId, String userId, String before, String after, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}/messages" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())); - - List localVarQueryParams = new ArrayList(); - if (before != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "before", before)); - if (after != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "after", after)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getMessagesValidateBeforeCall(String appId, String userId, String before, String after, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getMessages(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling getMessages(Async)"); - } - - - com.squareup.okhttp.Call call = getMessagesCall(appId, userId, before, after, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get the specified app user's messages. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param before Timestamp of message. The API will return 100 messages before the specified timestamp (excluding any messages with the provided timestamp). (optional) - * @param after Timestamp of message. The API will return 100 messages after the specified timestamp (excluding any messages with the provided timestamp). (optional) - * @return GetMessagesResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public GetMessagesResponse getMessages(String appId, String userId, String before, String after) throws ApiException { - ApiResponse resp = getMessagesWithHttpInfo(appId, userId, before, after); - return resp.getData(); - } - - /** - * - * Get the specified app user's messages. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param before Timestamp of message. The API will return 100 messages before the specified timestamp (excluding any messages with the provided timestamp). (optional) - * @param after Timestamp of message. The API will return 100 messages after the specified timestamp (excluding any messages with the provided timestamp). (optional) - * @return ApiResponse<GetMessagesResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getMessagesWithHttpInfo(String appId, String userId, String before, String after) throws ApiException { - com.squareup.okhttp.Call call = getMessagesValidateBeforeCall(appId, userId, before, after, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get the specified app user's messages. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param before Timestamp of message. The API will return 100 messages before the specified timestamp (excluding any messages with the provided timestamp). (optional) - * @param after Timestamp of message. The API will return 100 messages after the specified timestamp (excluding any messages with the provided timestamp). (optional) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getMessagesAsync(String appId, String userId, String before, String after, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getMessagesValidateBeforeCall(appId, userId, before, after, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for postMessage - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param messagePostBody Body for a postMessage request. Additional arguments are necessary based on message type ([text](https://docs.smooch.io/rest/#text), [image](https://docs.smooch.io/rest/#image), [carousel](https://docs.smooch.io/rest/#carousel), [list](https://docs.smooch.io/rest/#list), [form](https://docs.smooch.io/rest/#form)) (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postMessageCall(String appId, String userId, MessagePost messagePostBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = messagePostBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}/messages" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postMessageValidateBeforeCall(String appId, String userId, MessagePost messagePostBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling postMessage(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling postMessage(Async)"); - } - - // verify the required parameter 'messagePostBody' is set - if (messagePostBody == null) { - throw new ApiException("Missing the required parameter 'messagePostBody' when calling postMessage(Async)"); - } - - - com.squareup.okhttp.Call call = postMessageCall(appId, userId, messagePostBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Post a message to or from the app user. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param messagePostBody Body for a postMessage request. Additional arguments are necessary based on message type ([text](https://docs.smooch.io/rest/#text), [image](https://docs.smooch.io/rest/#image), [carousel](https://docs.smooch.io/rest/#carousel), [list](https://docs.smooch.io/rest/#list), [form](https://docs.smooch.io/rest/#form)) (required) - * @return MessageResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public MessageResponse postMessage(String appId, String userId, MessagePost messagePostBody) throws ApiException { - ApiResponse resp = postMessageWithHttpInfo(appId, userId, messagePostBody); - return resp.getData(); - } - - /** - * - * Post a message to or from the app user. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param messagePostBody Body for a postMessage request. Additional arguments are necessary based on message type ([text](https://docs.smooch.io/rest/#text), [image](https://docs.smooch.io/rest/#image), [carousel](https://docs.smooch.io/rest/#carousel), [list](https://docs.smooch.io/rest/#list), [form](https://docs.smooch.io/rest/#form)) (required) - * @return ApiResponse<MessageResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postMessageWithHttpInfo(String appId, String userId, MessagePost messagePostBody) throws ApiException { - com.squareup.okhttp.Call call = postMessageValidateBeforeCall(appId, userId, messagePostBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Post a message to or from the app user. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param messagePostBody Body for a postMessage request. Additional arguments are necessary based on message type ([text](https://docs.smooch.io/rest/#text), [image](https://docs.smooch.io/rest/#image), [carousel](https://docs.smooch.io/rest/#carousel), [list](https://docs.smooch.io/rest/#list), [form](https://docs.smooch.io/rest/#form)) (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postMessageAsync(String appId, String userId, MessagePost messagePostBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postMessageValidateBeforeCall(appId, userId, messagePostBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for resetUnreadCount - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call resetUnreadCountCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/appusers/{userId}/conversation/read" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call resetUnreadCountValidateBeforeCall(String appId, String userId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling resetUnreadCount(Async)"); - } - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException("Missing the required parameter 'userId' when calling resetUnreadCount(Async)"); - } - - - com.squareup.okhttp.Call call = resetUnreadCountCall(appId, userId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Reset the unread count of the conversation to 0. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void resetUnreadCount(String appId, String userId) throws ApiException { - resetUnreadCountWithHttpInfo(appId, userId); - } - - /** - * - * Reset the unread count of the conversation to 0. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse resetUnreadCountWithHttpInfo(String appId, String userId) throws ApiException { - com.squareup.okhttp.Call call = resetUnreadCountValidateBeforeCall(appId, userId, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Reset the unread count of the conversation to 0. - * @param appId Identifies the app. (required) - * @param userId Identifies the user. Can be either the smoochId or the userId. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call resetUnreadCountAsync(String appId, String userId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = resetUnreadCountValidateBeforeCall(appId, userId, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } -} diff --git a/src/main/java/io/smooch/client/api/DeploymentApi.java b/src/main/java/io/smooch/client/api/DeploymentApi.java deleted file mode 100644 index 24cac315..00000000 --- a/src/main/java/io/smooch/client/api/DeploymentApi.java +++ /dev/null @@ -1,820 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.api; - -import io.smooch.client.ApiCallback; -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.ApiResponse; -import io.smooch.client.Configuration; -import io.smooch.client.Pair; -import io.smooch.client.ProgressRequestBody; -import io.smooch.client.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import io.smooch.client.model.DeploymentActivatePhoneNumber; -import io.smooch.client.model.DeploymentConfirmCode; -import io.smooch.client.model.DeploymentCreate; -import io.smooch.client.model.DeploymentResponse; -import io.smooch.client.model.ListDeploymentsResponse; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class DeploymentApi { - private ApiClient apiClient; - - public DeploymentApi() { - this(Configuration.getDefaultApiClient()); - } - - public DeploymentApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Build call for activatePhoneNumber - * @param deploymentId Identifies the deployment. (required) - * @param deploymentActivatePhoneNumberBody Body for an activatePhoneNumber request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call activatePhoneNumberCall(String deploymentId, DeploymentActivatePhoneNumber deploymentActivatePhoneNumberBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = deploymentActivatePhoneNumberBody; - - // create path and map variables - String localVarPath = "/v1.1/whatsapp/deployments/{deploymentId}/activate" - .replaceAll("\\{" + "deploymentId" + "\\}", apiClient.escapeString(deploymentId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call activatePhoneNumberValidateBeforeCall(String deploymentId, DeploymentActivatePhoneNumber deploymentActivatePhoneNumberBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'deploymentId' is set - if (deploymentId == null) { - throw new ApiException("Missing the required parameter 'deploymentId' when calling activatePhoneNumber(Async)"); - } - - // verify the required parameter 'deploymentActivatePhoneNumberBody' is set - if (deploymentActivatePhoneNumberBody == null) { - throw new ApiException("Missing the required parameter 'deploymentActivatePhoneNumberBody' when calling activatePhoneNumber(Async)"); - } - - - com.squareup.okhttp.Call call = activatePhoneNumberCall(deploymentId, deploymentActivatePhoneNumberBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Activate a phone number on the specified deployment. - * @param deploymentId Identifies the deployment. (required) - * @param deploymentActivatePhoneNumberBody Body for an activatePhoneNumber request. (required) - * @return DeploymentResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public DeploymentResponse activatePhoneNumber(String deploymentId, DeploymentActivatePhoneNumber deploymentActivatePhoneNumberBody) throws ApiException { - ApiResponse resp = activatePhoneNumberWithHttpInfo(deploymentId, deploymentActivatePhoneNumberBody); - return resp.getData(); - } - - /** - * - * Activate a phone number on the specified deployment. - * @param deploymentId Identifies the deployment. (required) - * @param deploymentActivatePhoneNumberBody Body for an activatePhoneNumber request. (required) - * @return ApiResponse<DeploymentResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse activatePhoneNumberWithHttpInfo(String deploymentId, DeploymentActivatePhoneNumber deploymentActivatePhoneNumberBody) throws ApiException { - com.squareup.okhttp.Call call = activatePhoneNumberValidateBeforeCall(deploymentId, deploymentActivatePhoneNumberBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Activate a phone number on the specified deployment. - * @param deploymentId Identifies the deployment. (required) - * @param deploymentActivatePhoneNumberBody Body for an activatePhoneNumber request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call activatePhoneNumberAsync(String deploymentId, DeploymentActivatePhoneNumber deploymentActivatePhoneNumberBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = activatePhoneNumberValidateBeforeCall(deploymentId, deploymentActivatePhoneNumberBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for confirmCode - * @param deploymentId Identifies the deployment. (required) - * @param deploymentConfirmCode Body for a confirmCode request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call confirmCodeCall(String deploymentId, DeploymentConfirmCode deploymentConfirmCode, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = deploymentConfirmCode; - - // create path and map variables - String localVarPath = "/v1.1/whatsapp/deployments/{deploymentId}/code/confirm" - .replaceAll("\\{" + "deploymentId" + "\\}", apiClient.escapeString(deploymentId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call confirmCodeValidateBeforeCall(String deploymentId, DeploymentConfirmCode deploymentConfirmCode, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'deploymentId' is set - if (deploymentId == null) { - throw new ApiException("Missing the required parameter 'deploymentId' when calling confirmCode(Async)"); - } - - // verify the required parameter 'deploymentConfirmCode' is set - if (deploymentConfirmCode == null) { - throw new ApiException("Missing the required parameter 'deploymentConfirmCode' when calling confirmCode(Async)"); - } - - - com.squareup.okhttp.Call call = confirmCodeCall(deploymentId, deploymentConfirmCode, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Confirm code to complete phone number activation. - * @param deploymentId Identifies the deployment. (required) - * @param deploymentConfirmCode Body for a confirmCode request. (required) - * @return DeploymentResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public DeploymentResponse confirmCode(String deploymentId, DeploymentConfirmCode deploymentConfirmCode) throws ApiException { - ApiResponse resp = confirmCodeWithHttpInfo(deploymentId, deploymentConfirmCode); - return resp.getData(); - } - - /** - * - * Confirm code to complete phone number activation. - * @param deploymentId Identifies the deployment. (required) - * @param deploymentConfirmCode Body for a confirmCode request. (required) - * @return ApiResponse<DeploymentResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse confirmCodeWithHttpInfo(String deploymentId, DeploymentConfirmCode deploymentConfirmCode) throws ApiException { - com.squareup.okhttp.Call call = confirmCodeValidateBeforeCall(deploymentId, deploymentConfirmCode, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Confirm code to complete phone number activation. - * @param deploymentId Identifies the deployment. (required) - * @param deploymentConfirmCode Body for a confirmCode request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call confirmCodeAsync(String deploymentId, DeploymentConfirmCode deploymentConfirmCode, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = confirmCodeValidateBeforeCall(deploymentId, deploymentConfirmCode, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for createDeployment - * @param deploymentCreateBody Body for a createDeployment request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call createDeploymentCall(DeploymentCreate deploymentCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = deploymentCreateBody; - - // create path and map variables - String localVarPath = "/v1.1/whatsapp/deployments"; - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call createDeploymentValidateBeforeCall(DeploymentCreate deploymentCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'deploymentCreateBody' is set - if (deploymentCreateBody == null) { - throw new ApiException("Missing the required parameter 'deploymentCreateBody' when calling createDeployment(Async)"); - } - - - com.squareup.okhttp.Call call = createDeploymentCall(deploymentCreateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Create a WhatsApp deployment. - * @param deploymentCreateBody Body for a createDeployment request. (required) - * @return DeploymentResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public DeploymentResponse createDeployment(DeploymentCreate deploymentCreateBody) throws ApiException { - ApiResponse resp = createDeploymentWithHttpInfo(deploymentCreateBody); - return resp.getData(); - } - - /** - * - * Create a WhatsApp deployment. - * @param deploymentCreateBody Body for a createDeployment request. (required) - * @return ApiResponse<DeploymentResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse createDeploymentWithHttpInfo(DeploymentCreate deploymentCreateBody) throws ApiException { - com.squareup.okhttp.Call call = createDeploymentValidateBeforeCall(deploymentCreateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Create a WhatsApp deployment. - * @param deploymentCreateBody Body for a createDeployment request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call createDeploymentAsync(DeploymentCreate deploymentCreateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = createDeploymentValidateBeforeCall(deploymentCreateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for deleteDeployment - * @param deploymentId Identifies the deployment. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteDeploymentCall(String deploymentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/whatsapp/deployments/{deploymentId}" - .replaceAll("\\{" + "deploymentId" + "\\}", apiClient.escapeString(deploymentId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteDeploymentValidateBeforeCall(String deploymentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'deploymentId' is set - if (deploymentId == null) { - throw new ApiException("Missing the required parameter 'deploymentId' when calling deleteDeployment(Async)"); - } - - - com.squareup.okhttp.Call call = deleteDeploymentCall(deploymentId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Delete the specified deployment. - * @param deploymentId Identifies the deployment. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteDeployment(String deploymentId) throws ApiException { - deleteDeploymentWithHttpInfo(deploymentId); - } - - /** - * - * Delete the specified deployment. - * @param deploymentId Identifies the deployment. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteDeploymentWithHttpInfo(String deploymentId) throws ApiException { - com.squareup.okhttp.Call call = deleteDeploymentValidateBeforeCall(deploymentId, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Delete the specified deployment. - * @param deploymentId Identifies the deployment. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteDeploymentAsync(String deploymentId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteDeploymentValidateBeforeCall(deploymentId, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for getDeployment - * @param deploymentId Identifies the deployment. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getDeploymentCall(String deploymentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/whatsapp/deployments/{deploymentId}" - .replaceAll("\\{" + "deploymentId" + "\\}", apiClient.escapeString(deploymentId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getDeploymentValidateBeforeCall(String deploymentId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'deploymentId' is set - if (deploymentId == null) { - throw new ApiException("Missing the required parameter 'deploymentId' when calling getDeployment(Async)"); - } - - - com.squareup.okhttp.Call call = getDeploymentCall(deploymentId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get the specified deployment. - * @param deploymentId Identifies the deployment. (required) - * @return DeploymentResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public DeploymentResponse getDeployment(String deploymentId) throws ApiException { - ApiResponse resp = getDeploymentWithHttpInfo(deploymentId); - return resp.getData(); - } - - /** - * - * Get the specified deployment. - * @param deploymentId Identifies the deployment. (required) - * @return ApiResponse<DeploymentResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getDeploymentWithHttpInfo(String deploymentId) throws ApiException { - com.squareup.okhttp.Call call = getDeploymentValidateBeforeCall(deploymentId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get the specified deployment. - * @param deploymentId Identifies the deployment. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getDeploymentAsync(String deploymentId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getDeploymentValidateBeforeCall(deploymentId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for listDeployments - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call listDeploymentsCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/whatsapp/deployments"; - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call listDeploymentsValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - - com.squareup.okhttp.Call call = listDeploymentsCall(progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * List owned WhatsApp deployments. - * @return ListDeploymentsResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ListDeploymentsResponse listDeployments() throws ApiException { - ApiResponse resp = listDeploymentsWithHttpInfo(); - return resp.getData(); - } - - /** - * - * List owned WhatsApp deployments. - * @return ApiResponse<ListDeploymentsResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse listDeploymentsWithHttpInfo() throws ApiException { - com.squareup.okhttp.Call call = listDeploymentsValidateBeforeCall(null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * List owned WhatsApp deployments. - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call listDeploymentsAsync(final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = listDeploymentsValidateBeforeCall(progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } -} diff --git a/src/main/java/io/smooch/client/api/IntegrationApi.java b/src/main/java/io/smooch/client/api/IntegrationApi.java deleted file mode 100644 index c9d8fb83..00000000 --- a/src/main/java/io/smooch/client/api/IntegrationApi.java +++ /dev/null @@ -1,1740 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.api; - -import io.smooch.client.ApiCallback; -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.ApiResponse; -import io.smooch.client.Configuration; -import io.smooch.client.Pair; -import io.smooch.client.ProgressRequestBody; -import io.smooch.client.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import java.io.File; -import io.smooch.client.model.GetIntegrationProfileResponse; -import io.smooch.client.model.IntegrationCreate; -import io.smooch.client.model.IntegrationProfileUpdate; -import io.smooch.client.model.IntegrationResponse; -import io.smooch.client.model.IntegrationUpdate; -import io.smooch.client.model.ListIntegrationsResponse; -import io.smooch.client.model.Menu; -import io.smooch.client.model.MenuResponse; -import io.smooch.client.model.UploadIntegrationProfilePhotoResponse; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class IntegrationApi { - private ApiClient apiClient; - - public IntegrationApi() { - this(Configuration.getDefaultApiClient()); - } - - public IntegrationApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Build call for createIntegration - * @param appId Identifies the app. (required) - * @param integrationCreateBody Body for a createIntegration request. Additional arguments are necessary based on integration type. For detailed instructions, visit our [official docs](https://docs.smooch.io/rest/#create-integration) (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call createIntegrationCall(String appId, IntegrationCreate integrationCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = integrationCreateBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/integrations" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call createIntegrationValidateBeforeCall(String appId, IntegrationCreate integrationCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling createIntegration(Async)"); - } - - // verify the required parameter 'integrationCreateBody' is set - if (integrationCreateBody == null) { - throw new ApiException("Missing the required parameter 'integrationCreateBody' when calling createIntegration(Async)"); - } - - - com.squareup.okhttp.Call call = createIntegrationCall(appId, integrationCreateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Create an integration for the specified app. - * @param appId Identifies the app. (required) - * @param integrationCreateBody Body for a createIntegration request. Additional arguments are necessary based on integration type. For detailed instructions, visit our [official docs](https://docs.smooch.io/rest/#create-integration) (required) - * @return IntegrationResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public IntegrationResponse createIntegration(String appId, IntegrationCreate integrationCreateBody) throws ApiException { - ApiResponse resp = createIntegrationWithHttpInfo(appId, integrationCreateBody); - return resp.getData(); - } - - /** - * - * Create an integration for the specified app. - * @param appId Identifies the app. (required) - * @param integrationCreateBody Body for a createIntegration request. Additional arguments are necessary based on integration type. For detailed instructions, visit our [official docs](https://docs.smooch.io/rest/#create-integration) (required) - * @return ApiResponse<IntegrationResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse createIntegrationWithHttpInfo(String appId, IntegrationCreate integrationCreateBody) throws ApiException { - com.squareup.okhttp.Call call = createIntegrationValidateBeforeCall(appId, integrationCreateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Create an integration for the specified app. - * @param appId Identifies the app. (required) - * @param integrationCreateBody Body for a createIntegration request. Additional arguments are necessary based on integration type. For detailed instructions, visit our [official docs](https://docs.smooch.io/rest/#create-integration) (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call createIntegrationAsync(String appId, IntegrationCreate integrationCreateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = createIntegrationValidateBeforeCall(appId, integrationCreateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for createIntegrationMenu - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param menuCreateBody Body for a createMenu request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call createIntegrationMenuCall(String appId, String integrationId, Menu menuCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = menuCreateBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/integrations/{integrationId}/menu" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call createIntegrationMenuValidateBeforeCall(String appId, String integrationId, Menu menuCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling createIntegrationMenu(Async)"); - } - - // verify the required parameter 'integrationId' is set - if (integrationId == null) { - throw new ApiException("Missing the required parameter 'integrationId' when calling createIntegrationMenu(Async)"); - } - - // verify the required parameter 'menuCreateBody' is set - if (menuCreateBody == null) { - throw new ApiException("Missing the required parameter 'menuCreateBody' when calling createIntegrationMenu(Async)"); - } - - - com.squareup.okhttp.Call call = createIntegrationMenuCall(appId, integrationId, menuCreateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Create the specified integration’s menu, overriding the app menu if configured. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param menuCreateBody Body for a createMenu request. (required) - * @return MenuResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public MenuResponse createIntegrationMenu(String appId, String integrationId, Menu menuCreateBody) throws ApiException { - ApiResponse resp = createIntegrationMenuWithHttpInfo(appId, integrationId, menuCreateBody); - return resp.getData(); - } - - /** - * - * Create the specified integration’s menu, overriding the app menu if configured. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param menuCreateBody Body for a createMenu request. (required) - * @return ApiResponse<MenuResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse createIntegrationMenuWithHttpInfo(String appId, String integrationId, Menu menuCreateBody) throws ApiException { - com.squareup.okhttp.Call call = createIntegrationMenuValidateBeforeCall(appId, integrationId, menuCreateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Create the specified integration’s menu, overriding the app menu if configured. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param menuCreateBody Body for a createMenu request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call createIntegrationMenuAsync(String appId, String integrationId, Menu menuCreateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = createIntegrationMenuValidateBeforeCall(appId, integrationId, menuCreateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for deleteIntegration - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteIntegrationCall(String appId, String integrationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/integrations/{integrationId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteIntegrationValidateBeforeCall(String appId, String integrationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling deleteIntegration(Async)"); - } - - // verify the required parameter 'integrationId' is set - if (integrationId == null) { - throw new ApiException("Missing the required parameter 'integrationId' when calling deleteIntegration(Async)"); - } - - - com.squareup.okhttp.Call call = deleteIntegrationCall(appId, integrationId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Delete the specified integration. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteIntegration(String appId, String integrationId) throws ApiException { - deleteIntegrationWithHttpInfo(appId, integrationId); - } - - /** - * - * Delete the specified integration. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteIntegrationWithHttpInfo(String appId, String integrationId) throws ApiException { - com.squareup.okhttp.Call call = deleteIntegrationValidateBeforeCall(appId, integrationId, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Delete the specified integration. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteIntegrationAsync(String appId, String integrationId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteIntegrationValidateBeforeCall(appId, integrationId, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for deleteIntegrationMenu - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteIntegrationMenuCall(String appId, String integrationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/integrations/{integrationId}/menu" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteIntegrationMenuValidateBeforeCall(String appId, String integrationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling deleteIntegrationMenu(Async)"); - } - - // verify the required parameter 'integrationId' is set - if (integrationId == null) { - throw new ApiException("Missing the required parameter 'integrationId' when calling deleteIntegrationMenu(Async)"); - } - - - com.squareup.okhttp.Call call = deleteIntegrationMenuCall(appId, integrationId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Delete the specified integration’s menu. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteIntegrationMenu(String appId, String integrationId) throws ApiException { - deleteIntegrationMenuWithHttpInfo(appId, integrationId); - } - - /** - * - * Delete the specified integration’s menu. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteIntegrationMenuWithHttpInfo(String appId, String integrationId) throws ApiException { - com.squareup.okhttp.Call call = deleteIntegrationMenuValidateBeforeCall(appId, integrationId, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Delete the specified integration’s menu. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteIntegrationMenuAsync(String appId, String integrationId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteIntegrationMenuValidateBeforeCall(appId, integrationId, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for getIntegration - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getIntegrationCall(String appId, String integrationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/integrations/{integrationId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getIntegrationValidateBeforeCall(String appId, String integrationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getIntegration(Async)"); - } - - // verify the required parameter 'integrationId' is set - if (integrationId == null) { - throw new ApiException("Missing the required parameter 'integrationId' when calling getIntegration(Async)"); - } - - - com.squareup.okhttp.Call call = getIntegrationCall(appId, integrationId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get the specified integration. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @return IntegrationResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public IntegrationResponse getIntegration(String appId, String integrationId) throws ApiException { - ApiResponse resp = getIntegrationWithHttpInfo(appId, integrationId); - return resp.getData(); - } - - /** - * - * Get the specified integration. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @return ApiResponse<IntegrationResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getIntegrationWithHttpInfo(String appId, String integrationId) throws ApiException { - com.squareup.okhttp.Call call = getIntegrationValidateBeforeCall(appId, integrationId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get the specified integration. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getIntegrationAsync(String appId, String integrationId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getIntegrationValidateBeforeCall(appId, integrationId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getIntegrationMenu - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getIntegrationMenuCall(String appId, String integrationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/integrations/{integrationId}/menu" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getIntegrationMenuValidateBeforeCall(String appId, String integrationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getIntegrationMenu(Async)"); - } - - // verify the required parameter 'integrationId' is set - if (integrationId == null) { - throw new ApiException("Missing the required parameter 'integrationId' when calling getIntegrationMenu(Async)"); - } - - - com.squareup.okhttp.Call call = getIntegrationMenuCall(appId, integrationId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get the specified integration's menu. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @return MenuResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public MenuResponse getIntegrationMenu(String appId, String integrationId) throws ApiException { - ApiResponse resp = getIntegrationMenuWithHttpInfo(appId, integrationId); - return resp.getData(); - } - - /** - * - * Get the specified integration's menu. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @return ApiResponse<MenuResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getIntegrationMenuWithHttpInfo(String appId, String integrationId) throws ApiException { - com.squareup.okhttp.Call call = getIntegrationMenuValidateBeforeCall(appId, integrationId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get the specified integration's menu. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getIntegrationMenuAsync(String appId, String integrationId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getIntegrationMenuValidateBeforeCall(appId, integrationId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getIntegrationProfile - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getIntegrationProfileCall(String appId, String integrationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/integrations/{integrationId}/profile" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getIntegrationProfileValidateBeforeCall(String appId, String integrationId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getIntegrationProfile(Async)"); - } - - // verify the required parameter 'integrationId' is set - if (integrationId == null) { - throw new ApiException("Missing the required parameter 'integrationId' when calling getIntegrationProfile(Async)"); - } - - - com.squareup.okhttp.Call call = getIntegrationProfileCall(appId, integrationId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get the specified integration’s profile. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @return GetIntegrationProfileResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public GetIntegrationProfileResponse getIntegrationProfile(String appId, String integrationId) throws ApiException { - ApiResponse resp = getIntegrationProfileWithHttpInfo(appId, integrationId); - return resp.getData(); - } - - /** - * - * Get the specified integration’s profile. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @return ApiResponse<GetIntegrationProfileResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getIntegrationProfileWithHttpInfo(String appId, String integrationId) throws ApiException { - com.squareup.okhttp.Call call = getIntegrationProfileValidateBeforeCall(appId, integrationId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get the specified integration’s profile. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getIntegrationProfileAsync(String appId, String integrationId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getIntegrationProfileValidateBeforeCall(appId, integrationId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for listIntegrations - * @param appId Identifies the app. (required) - * @param types List of types to filter the query by. More than one value can be specified through comma separation e.g. ?types=*twilio*,*line*. (optional) - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call listIntegrationsCall(String appId, String types, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/integrations" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - if (types != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "types", types)); - if (limit != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit)); - if (offset != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call listIntegrationsValidateBeforeCall(String appId, String types, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling listIntegrations(Async)"); - } - - - com.squareup.okhttp.Call call = listIntegrationsCall(appId, types, limit, offset, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * List integrations for the specified app. - * @param appId Identifies the app. (required) - * @param types List of types to filter the query by. More than one value can be specified through comma separation e.g. ?types=*twilio*,*line*. (optional) - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @return ListIntegrationsResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ListIntegrationsResponse listIntegrations(String appId, String types, Integer limit, Integer offset) throws ApiException { - ApiResponse resp = listIntegrationsWithHttpInfo(appId, types, limit, offset); - return resp.getData(); - } - - /** - * - * List integrations for the specified app. - * @param appId Identifies the app. (required) - * @param types List of types to filter the query by. More than one value can be specified through comma separation e.g. ?types=*twilio*,*line*. (optional) - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @return ApiResponse<ListIntegrationsResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse listIntegrationsWithHttpInfo(String appId, String types, Integer limit, Integer offset) throws ApiException { - com.squareup.okhttp.Call call = listIntegrationsValidateBeforeCall(appId, types, limit, offset, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * List integrations for the specified app. - * @param appId Identifies the app. (required) - * @param types List of types to filter the query by. More than one value can be specified through comma separation e.g. ?types=*twilio*,*line*. (optional) - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call listIntegrationsAsync(String appId, String types, Integer limit, Integer offset, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = listIntegrationsValidateBeforeCall(appId, types, limit, offset, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for updateIntegration - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param integrationUpdateBody Body for a updateIntegration request. Additional arguments are necessary based on integration type. For detailed instructions, visit our [official docs](https://docs.smooch.io/rest/#update-integration) (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call updateIntegrationCall(String appId, String integrationId, IntegrationUpdate integrationUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = integrationUpdateBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/integrations/{integrationId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call updateIntegrationValidateBeforeCall(String appId, String integrationId, IntegrationUpdate integrationUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling updateIntegration(Async)"); - } - - // verify the required parameter 'integrationId' is set - if (integrationId == null) { - throw new ApiException("Missing the required parameter 'integrationId' when calling updateIntegration(Async)"); - } - - // verify the required parameter 'integrationUpdateBody' is set - if (integrationUpdateBody == null) { - throw new ApiException("Missing the required parameter 'integrationUpdateBody' when calling updateIntegration(Async)"); - } - - - com.squareup.okhttp.Call call = updateIntegrationCall(appId, integrationId, integrationUpdateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Update the specified integration. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param integrationUpdateBody Body for a updateIntegration request. Additional arguments are necessary based on integration type. For detailed instructions, visit our [official docs](https://docs.smooch.io/rest/#update-integration) (required) - * @return IntegrationResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public IntegrationResponse updateIntegration(String appId, String integrationId, IntegrationUpdate integrationUpdateBody) throws ApiException { - ApiResponse resp = updateIntegrationWithHttpInfo(appId, integrationId, integrationUpdateBody); - return resp.getData(); - } - - /** - * - * Update the specified integration. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param integrationUpdateBody Body for a updateIntegration request. Additional arguments are necessary based on integration type. For detailed instructions, visit our [official docs](https://docs.smooch.io/rest/#update-integration) (required) - * @return ApiResponse<IntegrationResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse updateIntegrationWithHttpInfo(String appId, String integrationId, IntegrationUpdate integrationUpdateBody) throws ApiException { - com.squareup.okhttp.Call call = updateIntegrationValidateBeforeCall(appId, integrationId, integrationUpdateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Update the specified integration. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param integrationUpdateBody Body for a updateIntegration request. Additional arguments are necessary based on integration type. For detailed instructions, visit our [official docs](https://docs.smooch.io/rest/#update-integration) (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call updateIntegrationAsync(String appId, String integrationId, IntegrationUpdate integrationUpdateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = updateIntegrationValidateBeforeCall(appId, integrationId, integrationUpdateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for updateIntegrationMenu - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param menuUpdateBody Body for a updateMenu request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call updateIntegrationMenuCall(String appId, String integrationId, Menu menuUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = menuUpdateBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/integrations/{integrationId}/menu" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call updateIntegrationMenuValidateBeforeCall(String appId, String integrationId, Menu menuUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling updateIntegrationMenu(Async)"); - } - - // verify the required parameter 'integrationId' is set - if (integrationId == null) { - throw new ApiException("Missing the required parameter 'integrationId' when calling updateIntegrationMenu(Async)"); - } - - // verify the required parameter 'menuUpdateBody' is set - if (menuUpdateBody == null) { - throw new ApiException("Missing the required parameter 'menuUpdateBody' when calling updateIntegrationMenu(Async)"); - } - - - com.squareup.okhttp.Call call = updateIntegrationMenuCall(appId, integrationId, menuUpdateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Update the specified integration’s menu. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param menuUpdateBody Body for a updateMenu request. (required) - * @return MenuResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public MenuResponse updateIntegrationMenu(String appId, String integrationId, Menu menuUpdateBody) throws ApiException { - ApiResponse resp = updateIntegrationMenuWithHttpInfo(appId, integrationId, menuUpdateBody); - return resp.getData(); - } - - /** - * - * Update the specified integration’s menu. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param menuUpdateBody Body for a updateMenu request. (required) - * @return ApiResponse<MenuResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse updateIntegrationMenuWithHttpInfo(String appId, String integrationId, Menu menuUpdateBody) throws ApiException { - com.squareup.okhttp.Call call = updateIntegrationMenuValidateBeforeCall(appId, integrationId, menuUpdateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Update the specified integration’s menu. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param menuUpdateBody Body for a updateMenu request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call updateIntegrationMenuAsync(String appId, String integrationId, Menu menuUpdateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = updateIntegrationMenuValidateBeforeCall(appId, integrationId, menuUpdateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for updateIntegrationProfile - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param integrationProfileBody Body for a profileUpdate request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call updateIntegrationProfileCall(String appId, String integrationId, IntegrationProfileUpdate integrationProfileBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = integrationProfileBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/integrations/{integrationId}/profile" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call updateIntegrationProfileValidateBeforeCall(String appId, String integrationId, IntegrationProfileUpdate integrationProfileBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling updateIntegrationProfile(Async)"); - } - - // verify the required parameter 'integrationId' is set - if (integrationId == null) { - throw new ApiException("Missing the required parameter 'integrationId' when calling updateIntegrationProfile(Async)"); - } - - // verify the required parameter 'integrationProfileBody' is set - if (integrationProfileBody == null) { - throw new ApiException("Missing the required parameter 'integrationProfileBody' when calling updateIntegrationProfile(Async)"); - } - - - com.squareup.okhttp.Call call = updateIntegrationProfileCall(appId, integrationId, integrationProfileBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Update the specified integration’s profile. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param integrationProfileBody Body for a profileUpdate request. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void updateIntegrationProfile(String appId, String integrationId, IntegrationProfileUpdate integrationProfileBody) throws ApiException { - updateIntegrationProfileWithHttpInfo(appId, integrationId, integrationProfileBody); - } - - /** - * - * Update the specified integration’s profile. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param integrationProfileBody Body for a profileUpdate request. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse updateIntegrationProfileWithHttpInfo(String appId, String integrationId, IntegrationProfileUpdate integrationProfileBody) throws ApiException { - com.squareup.okhttp.Call call = updateIntegrationProfileValidateBeforeCall(appId, integrationId, integrationProfileBody, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Update the specified integration’s profile. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param integrationProfileBody Body for a profileUpdate request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call updateIntegrationProfileAsync(String appId, String integrationId, IntegrationProfileUpdate integrationProfileBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = updateIntegrationProfileValidateBeforeCall(appId, integrationId, integrationProfileBody, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for uploadIntegrationProfilePhoto - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param source Photo to be uploaded (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call uploadIntegrationProfilePhotoCall(String appId, String integrationId, File source, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/integrations/{integrationId}/profile/photo" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "integrationId" + "\\}", apiClient.escapeString(integrationId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - if (source != null) - localVarFormParams.put("source", source); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "multipart/form-data" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call uploadIntegrationProfilePhotoValidateBeforeCall(String appId, String integrationId, File source, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling uploadIntegrationProfilePhoto(Async)"); - } - - // verify the required parameter 'integrationId' is set - if (integrationId == null) { - throw new ApiException("Missing the required parameter 'integrationId' when calling uploadIntegrationProfilePhoto(Async)"); - } - - // verify the required parameter 'source' is set - if (source == null) { - throw new ApiException("Missing the required parameter 'source' when calling uploadIntegrationProfilePhoto(Async)"); - } - - - com.squareup.okhttp.Call call = uploadIntegrationProfilePhotoCall(appId, integrationId, source, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Upload a photo to be used for the the specified integration’s profile. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param source Photo to be uploaded (required) - * @return UploadIntegrationProfilePhotoResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public UploadIntegrationProfilePhotoResponse uploadIntegrationProfilePhoto(String appId, String integrationId, File source) throws ApiException { - ApiResponse resp = uploadIntegrationProfilePhotoWithHttpInfo(appId, integrationId, source); - return resp.getData(); - } - - /** - * - * Upload a photo to be used for the the specified integration’s profile. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param source Photo to be uploaded (required) - * @return ApiResponse<UploadIntegrationProfilePhotoResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse uploadIntegrationProfilePhotoWithHttpInfo(String appId, String integrationId, File source) throws ApiException { - com.squareup.okhttp.Call call = uploadIntegrationProfilePhotoValidateBeforeCall(appId, integrationId, source, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Upload a photo to be used for the the specified integration’s profile. - * @param appId Identifies the app. (required) - * @param integrationId Identifies the integration. (required) - * @param source Photo to be uploaded (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call uploadIntegrationProfilePhotoAsync(String appId, String integrationId, File source, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = uploadIntegrationProfilePhotoValidateBeforeCall(appId, integrationId, source, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } -} diff --git a/src/main/java/io/smooch/client/api/MenuApi.java b/src/main/java/io/smooch/client/api/MenuApi.java deleted file mode 100644 index 25621a65..00000000 --- a/src/main/java/io/smooch/client/api/MenuApi.java +++ /dev/null @@ -1,445 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.api; - -import io.smooch.client.ApiCallback; -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.ApiResponse; -import io.smooch.client.Configuration; -import io.smooch.client.Pair; -import io.smooch.client.ProgressRequestBody; -import io.smooch.client.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import io.smooch.client.model.Menu; -import io.smooch.client.model.MenuResponse; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class MenuApi { - private ApiClient apiClient; - - public MenuApi() { - this(Configuration.getDefaultApiClient()); - } - - public MenuApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Build call for deleteMenu - * @param appId Identifies the app. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteMenuCall(String appId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/menu" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteMenuValidateBeforeCall(String appId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling deleteMenu(Async)"); - } - - - com.squareup.okhttp.Call call = deleteMenuCall(appId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Remove the specified app’s menu. - * @param appId Identifies the app. (required) - * @return MenuResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public MenuResponse deleteMenu(String appId) throws ApiException { - ApiResponse resp = deleteMenuWithHttpInfo(appId); - return resp.getData(); - } - - /** - * - * Remove the specified app’s menu. - * @param appId Identifies the app. (required) - * @return ApiResponse<MenuResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteMenuWithHttpInfo(String appId) throws ApiException { - com.squareup.okhttp.Call call = deleteMenuValidateBeforeCall(appId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Remove the specified app’s menu. - * @param appId Identifies the app. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteMenuAsync(String appId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteMenuValidateBeforeCall(appId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getMenu - * @param appId Identifies the app. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getMenuCall(String appId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/menu" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getMenuValidateBeforeCall(String appId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getMenu(Async)"); - } - - - com.squareup.okhttp.Call call = getMenuCall(appId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get the specified app’s menu. - * @param appId Identifies the app. (required) - * @return MenuResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public MenuResponse getMenu(String appId) throws ApiException { - ApiResponse resp = getMenuWithHttpInfo(appId); - return resp.getData(); - } - - /** - * - * Get the specified app’s menu. - * @param appId Identifies the app. (required) - * @return ApiResponse<MenuResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getMenuWithHttpInfo(String appId) throws ApiException { - com.squareup.okhttp.Call call = getMenuValidateBeforeCall(appId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get the specified app’s menu. - * @param appId Identifies the app. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getMenuAsync(String appId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getMenuValidateBeforeCall(appId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for updateMenu - * @param appId Identifies the app. (required) - * @param menuUpdateBody Body for a updateMenu request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call updateMenuCall(String appId, Menu menuUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = menuUpdateBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/menu" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call updateMenuValidateBeforeCall(String appId, Menu menuUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling updateMenu(Async)"); - } - - // verify the required parameter 'menuUpdateBody' is set - if (menuUpdateBody == null) { - throw new ApiException("Missing the required parameter 'menuUpdateBody' when calling updateMenu(Async)"); - } - - - com.squareup.okhttp.Call call = updateMenuCall(appId, menuUpdateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Configure the specified app’s menu. - * @param appId Identifies the app. (required) - * @param menuUpdateBody Body for a updateMenu request. (required) - * @return MenuResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public MenuResponse updateMenu(String appId, Menu menuUpdateBody) throws ApiException { - ApiResponse resp = updateMenuWithHttpInfo(appId, menuUpdateBody); - return resp.getData(); - } - - /** - * - * Configure the specified app’s menu. - * @param appId Identifies the app. (required) - * @param menuUpdateBody Body for a updateMenu request. (required) - * @return ApiResponse<MenuResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse updateMenuWithHttpInfo(String appId, Menu menuUpdateBody) throws ApiException { - com.squareup.okhttp.Call call = updateMenuValidateBeforeCall(appId, menuUpdateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Configure the specified app’s menu. - * @param appId Identifies the app. (required) - * @param menuUpdateBody Body for a updateMenu request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call updateMenuAsync(String appId, Menu menuUpdateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = updateMenuValidateBeforeCall(appId, menuUpdateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } -} diff --git a/src/main/java/io/smooch/client/api/NotificationApi.java b/src/main/java/io/smooch/client/api/NotificationApi.java deleted file mode 100644 index 23a5a322..00000000 --- a/src/main/java/io/smooch/client/api/NotificationApi.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.api; - -import io.smooch.client.ApiCallback; -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.ApiResponse; -import io.smooch.client.Configuration; -import io.smooch.client.Pair; -import io.smooch.client.ProgressRequestBody; -import io.smooch.client.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import io.smooch.client.model.NotificationPost; -import io.smooch.client.model.NotificationResponse; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class NotificationApi { - private ApiClient apiClient; - - public NotificationApi() { - this(Configuration.getDefaultApiClient()); - } - - public NotificationApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Build call for postNotification - * @param appId Identifies the app. (required) - * @param notificationPostBody Body for a postNotification request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call postNotificationCall(String appId, NotificationPost notificationPostBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = notificationPostBody; - - // create path and map variables - String localVarPath = "/v1/apps/{appId}/notifications" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call postNotificationValidateBeforeCall(String appId, NotificationPost notificationPostBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling postNotification(Async)"); - } - - // verify the required parameter 'notificationPostBody' is set - if (notificationPostBody == null) { - throw new ApiException("Missing the required parameter 'notificationPostBody' when calling postNotification(Async)"); - } - - - com.squareup.okhttp.Call call = postNotificationCall(appId, notificationPostBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Post a notification to an externalId. - * @param appId Identifies the app. (required) - * @param notificationPostBody Body for a postNotification request. (required) - * @return NotificationResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public NotificationResponse postNotification(String appId, NotificationPost notificationPostBody) throws ApiException { - ApiResponse resp = postNotificationWithHttpInfo(appId, notificationPostBody); - return resp.getData(); - } - - /** - * - * Post a notification to an externalId. - * @param appId Identifies the app. (required) - * @param notificationPostBody Body for a postNotification request. (required) - * @return ApiResponse<NotificationResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse postNotificationWithHttpInfo(String appId, NotificationPost notificationPostBody) throws ApiException { - com.squareup.okhttp.Call call = postNotificationValidateBeforeCall(appId, notificationPostBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Post a notification to an externalId. - * @param appId Identifies the app. (required) - * @param notificationPostBody Body for a postNotification request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call postNotificationAsync(String appId, NotificationPost notificationPostBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = postNotificationValidateBeforeCall(appId, notificationPostBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } -} diff --git a/src/main/java/io/smooch/client/api/ServiceAccountApi.java b/src/main/java/io/smooch/client/api/ServiceAccountApi.java deleted file mode 100644 index f04f50d3..00000000 --- a/src/main/java/io/smooch/client/api/ServiceAccountApi.java +++ /dev/null @@ -1,1365 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.api; - -import io.smooch.client.ApiCallback; -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.ApiResponse; -import io.smooch.client.Configuration; -import io.smooch.client.Pair; -import io.smooch.client.ProgressRequestBody; -import io.smooch.client.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import io.smooch.client.model.JwtResponse; -import io.smooch.client.model.ListSecretKeysResponse; -import io.smooch.client.model.ListServiceAccountsResponse; -import io.smooch.client.model.SecretKeyCreate; -import io.smooch.client.model.SecretKeyResponse; -import io.smooch.client.model.ServiceAccountCreate; -import io.smooch.client.model.ServiceAccountResponse; -import io.smooch.client.model.ServiceAccountUpdate; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class ServiceAccountApi { - private ApiClient apiClient; - - public ServiceAccountApi() { - this(Configuration.getDefaultApiClient()); - } - - public ServiceAccountApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Build call for createSecretKey - * @param serviceAccountId Identifies the service account. (required) - * @param secretKeyCreateBody Body for a createSecretKey request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call createSecretKeyCall(String serviceAccountId, SecretKeyCreate secretKeyCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = secretKeyCreateBody; - - // create path and map variables - String localVarPath = "/v1.1/serviceaccounts/{serviceAccountId}/keys" - .replaceAll("\\{" + "serviceAccountId" + "\\}", apiClient.escapeString(serviceAccountId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call createSecretKeyValidateBeforeCall(String serviceAccountId, SecretKeyCreate secretKeyCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'serviceAccountId' is set - if (serviceAccountId == null) { - throw new ApiException("Missing the required parameter 'serviceAccountId' when calling createSecretKey(Async)"); - } - - // verify the required parameter 'secretKeyCreateBody' is set - if (secretKeyCreateBody == null) { - throw new ApiException("Missing the required parameter 'secretKeyCreateBody' when calling createSecretKey(Async)"); - } - - - com.squareup.okhttp.Call call = createSecretKeyCall(serviceAccountId, secretKeyCreateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Create a secret key for the specified service account. - * @param serviceAccountId Identifies the service account. (required) - * @param secretKeyCreateBody Body for a createSecretKey request. (required) - * @return SecretKeyResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public SecretKeyResponse createSecretKey(String serviceAccountId, SecretKeyCreate secretKeyCreateBody) throws ApiException { - ApiResponse resp = createSecretKeyWithHttpInfo(serviceAccountId, secretKeyCreateBody); - return resp.getData(); - } - - /** - * - * Create a secret key for the specified service account. - * @param serviceAccountId Identifies the service account. (required) - * @param secretKeyCreateBody Body for a createSecretKey request. (required) - * @return ApiResponse<SecretKeyResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse createSecretKeyWithHttpInfo(String serviceAccountId, SecretKeyCreate secretKeyCreateBody) throws ApiException { - com.squareup.okhttp.Call call = createSecretKeyValidateBeforeCall(serviceAccountId, secretKeyCreateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Create a secret key for the specified service account. - * @param serviceAccountId Identifies the service account. (required) - * @param secretKeyCreateBody Body for a createSecretKey request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call createSecretKeyAsync(String serviceAccountId, SecretKeyCreate secretKeyCreateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = createSecretKeyValidateBeforeCall(serviceAccountId, secretKeyCreateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for createServiceAccount - * @param serviceAccountCreateBody Body for a createServiceAccount request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call createServiceAccountCall(ServiceAccountCreate serviceAccountCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = serviceAccountCreateBody; - - // create path and map variables - String localVarPath = "/v1.1/serviceaccounts"; - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call createServiceAccountValidateBeforeCall(ServiceAccountCreate serviceAccountCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'serviceAccountCreateBody' is set - if (serviceAccountCreateBody == null) { - throw new ApiException("Missing the required parameter 'serviceAccountCreateBody' when calling createServiceAccount(Async)"); - } - - - com.squareup.okhttp.Call call = createServiceAccountCall(serviceAccountCreateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Create a new service account. - * @param serviceAccountCreateBody Body for a createServiceAccount request. (required) - * @return ServiceAccountResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ServiceAccountResponse createServiceAccount(ServiceAccountCreate serviceAccountCreateBody) throws ApiException { - ApiResponse resp = createServiceAccountWithHttpInfo(serviceAccountCreateBody); - return resp.getData(); - } - - /** - * - * Create a new service account. - * @param serviceAccountCreateBody Body for a createServiceAccount request. (required) - * @return ApiResponse<ServiceAccountResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse createServiceAccountWithHttpInfo(ServiceAccountCreate serviceAccountCreateBody) throws ApiException { - com.squareup.okhttp.Call call = createServiceAccountValidateBeforeCall(serviceAccountCreateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Create a new service account. - * @param serviceAccountCreateBody Body for a createServiceAccount request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call createServiceAccountAsync(ServiceAccountCreate serviceAccountCreateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = createServiceAccountValidateBeforeCall(serviceAccountCreateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for deleteSecretKey - * @param serviceAccountId Identifies the service account. (required) - * @param keyId Identifies the secret key. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteSecretKeyCall(String serviceAccountId, String keyId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/serviceaccounts/{serviceAccountId}/keys/{keyId}" - .replaceAll("\\{" + "serviceAccountId" + "\\}", apiClient.escapeString(serviceAccountId.toString())) - .replaceAll("\\{" + "keyId" + "\\}", apiClient.escapeString(keyId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteSecretKeyValidateBeforeCall(String serviceAccountId, String keyId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'serviceAccountId' is set - if (serviceAccountId == null) { - throw new ApiException("Missing the required parameter 'serviceAccountId' when calling deleteSecretKey(Async)"); - } - - // verify the required parameter 'keyId' is set - if (keyId == null) { - throw new ApiException("Missing the required parameter 'keyId' when calling deleteSecretKey(Async)"); - } - - - com.squareup.okhttp.Call call = deleteSecretKeyCall(serviceAccountId, keyId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Delete the specified service account secret key. - * @param serviceAccountId Identifies the service account. (required) - * @param keyId Identifies the secret key. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteSecretKey(String serviceAccountId, String keyId) throws ApiException { - deleteSecretKeyWithHttpInfo(serviceAccountId, keyId); - } - - /** - * - * Delete the specified service account secret key. - * @param serviceAccountId Identifies the service account. (required) - * @param keyId Identifies the secret key. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteSecretKeyWithHttpInfo(String serviceAccountId, String keyId) throws ApiException { - com.squareup.okhttp.Call call = deleteSecretKeyValidateBeforeCall(serviceAccountId, keyId, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Delete the specified service account secret key. - * @param serviceAccountId Identifies the service account. (required) - * @param keyId Identifies the secret key. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteSecretKeyAsync(String serviceAccountId, String keyId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteSecretKeyValidateBeforeCall(serviceAccountId, keyId, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for deleteServiceAccount - * @param serviceAccountId Identifies the service account. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteServiceAccountCall(String serviceAccountId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/serviceaccounts/{serviceAccountId}" - .replaceAll("\\{" + "serviceAccountId" + "\\}", apiClient.escapeString(serviceAccountId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteServiceAccountValidateBeforeCall(String serviceAccountId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'serviceAccountId' is set - if (serviceAccountId == null) { - throw new ApiException("Missing the required parameter 'serviceAccountId' when calling deleteServiceAccount(Async)"); - } - - - com.squareup.okhttp.Call call = deleteServiceAccountCall(serviceAccountId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Delete the specified service account. - * @param serviceAccountId Identifies the service account. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteServiceAccount(String serviceAccountId) throws ApiException { - deleteServiceAccountWithHttpInfo(serviceAccountId); - } - - /** - * - * Delete the specified service account. - * @param serviceAccountId Identifies the service account. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteServiceAccountWithHttpInfo(String serviceAccountId) throws ApiException { - com.squareup.okhttp.Call call = deleteServiceAccountValidateBeforeCall(serviceAccountId, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Delete the specified service account. - * @param serviceAccountId Identifies the service account. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteServiceAccountAsync(String serviceAccountId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteServiceAccountValidateBeforeCall(serviceAccountId, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for getJwt - * @param serviceAccountId Identifies the service account. (required) - * @param keyId Identifies the secret key. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getJwtCall(String serviceAccountId, String keyId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/serviceaccounts/{serviceAccountId}/keys/{keyId}/jwt" - .replaceAll("\\{" + "serviceAccountId" + "\\}", apiClient.escapeString(serviceAccountId.toString())) - .replaceAll("\\{" + "keyId" + "\\}", apiClient.escapeString(keyId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getJwtValidateBeforeCall(String serviceAccountId, String keyId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'serviceAccountId' is set - if (serviceAccountId == null) { - throw new ApiException("Missing the required parameter 'serviceAccountId' when calling getJwt(Async)"); - } - - // verify the required parameter 'keyId' is set - if (keyId == null) { - throw new ApiException("Missing the required parameter 'keyId' when calling getJwt(Async)"); - } - - - com.squareup.okhttp.Call call = getJwtCall(serviceAccountId, keyId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get an account-scoped JWT for the specified service account secret key. - * @param serviceAccountId Identifies the service account. (required) - * @param keyId Identifies the secret key. (required) - * @return JwtResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public JwtResponse getJwt(String serviceAccountId, String keyId) throws ApiException { - ApiResponse resp = getJwtWithHttpInfo(serviceAccountId, keyId); - return resp.getData(); - } - - /** - * - * Get an account-scoped JWT for the specified service account secret key. - * @param serviceAccountId Identifies the service account. (required) - * @param keyId Identifies the secret key. (required) - * @return ApiResponse<JwtResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getJwtWithHttpInfo(String serviceAccountId, String keyId) throws ApiException { - com.squareup.okhttp.Call call = getJwtValidateBeforeCall(serviceAccountId, keyId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get an account-scoped JWT for the specified service account secret key. - * @param serviceAccountId Identifies the service account. (required) - * @param keyId Identifies the secret key. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getJwtAsync(String serviceAccountId, String keyId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getJwtValidateBeforeCall(serviceAccountId, keyId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getSecretKey - * @param serviceAccountId Identifies the service account. (required) - * @param keyId Identifies the secret key. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getSecretKeyCall(String serviceAccountId, String keyId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/serviceaccounts/{serviceAccountId}/keys/{keyId}" - .replaceAll("\\{" + "serviceAccountId" + "\\}", apiClient.escapeString(serviceAccountId.toString())) - .replaceAll("\\{" + "keyId" + "\\}", apiClient.escapeString(keyId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getSecretKeyValidateBeforeCall(String serviceAccountId, String keyId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'serviceAccountId' is set - if (serviceAccountId == null) { - throw new ApiException("Missing the required parameter 'serviceAccountId' when calling getSecretKey(Async)"); - } - - // verify the required parameter 'keyId' is set - if (keyId == null) { - throw new ApiException("Missing the required parameter 'keyId' when calling getSecretKey(Async)"); - } - - - com.squareup.okhttp.Call call = getSecretKeyCall(serviceAccountId, keyId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get the specified service account secret key. - * @param serviceAccountId Identifies the service account. (required) - * @param keyId Identifies the secret key. (required) - * @return SecretKeyResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public SecretKeyResponse getSecretKey(String serviceAccountId, String keyId) throws ApiException { - ApiResponse resp = getSecretKeyWithHttpInfo(serviceAccountId, keyId); - return resp.getData(); - } - - /** - * - * Get the specified service account secret key. - * @param serviceAccountId Identifies the service account. (required) - * @param keyId Identifies the secret key. (required) - * @return ApiResponse<SecretKeyResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getSecretKeyWithHttpInfo(String serviceAccountId, String keyId) throws ApiException { - com.squareup.okhttp.Call call = getSecretKeyValidateBeforeCall(serviceAccountId, keyId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get the specified service account secret key. - * @param serviceAccountId Identifies the service account. (required) - * @param keyId Identifies the secret key. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getSecretKeyAsync(String serviceAccountId, String keyId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getSecretKeyValidateBeforeCall(serviceAccountId, keyId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for getServiceAccount - * @param serviceAccountId Identifies the service account. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getServiceAccountCall(String serviceAccountId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/serviceaccounts/{serviceAccountId}" - .replaceAll("\\{" + "serviceAccountId" + "\\}", apiClient.escapeString(serviceAccountId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getServiceAccountValidateBeforeCall(String serviceAccountId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'serviceAccountId' is set - if (serviceAccountId == null) { - throw new ApiException("Missing the required parameter 'serviceAccountId' when calling getServiceAccount(Async)"); - } - - - com.squareup.okhttp.Call call = getServiceAccountCall(serviceAccountId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get the specified service account. - * @param serviceAccountId Identifies the service account. (required) - * @return ServiceAccountResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ServiceAccountResponse getServiceAccount(String serviceAccountId) throws ApiException { - ApiResponse resp = getServiceAccountWithHttpInfo(serviceAccountId); - return resp.getData(); - } - - /** - * - * Get the specified service account. - * @param serviceAccountId Identifies the service account. (required) - * @return ApiResponse<ServiceAccountResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getServiceAccountWithHttpInfo(String serviceAccountId) throws ApiException { - com.squareup.okhttp.Call call = getServiceAccountValidateBeforeCall(serviceAccountId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get the specified service account. - * @param serviceAccountId Identifies the service account. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getServiceAccountAsync(String serviceAccountId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getServiceAccountValidateBeforeCall(serviceAccountId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for listSecretKeys - * @param serviceAccountId Identifies the service account. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call listSecretKeysCall(String serviceAccountId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/serviceaccounts/{serviceAccountId}/keys" - .replaceAll("\\{" + "serviceAccountId" + "\\}", apiClient.escapeString(serviceAccountId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call listSecretKeysValidateBeforeCall(String serviceAccountId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'serviceAccountId' is set - if (serviceAccountId == null) { - throw new ApiException("Missing the required parameter 'serviceAccountId' when calling listSecretKeys(Async)"); - } - - - com.squareup.okhttp.Call call = listSecretKeysCall(serviceAccountId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * List the secret keys for the specified service account. - * @param serviceAccountId Identifies the service account. (required) - * @return ListSecretKeysResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ListSecretKeysResponse listSecretKeys(String serviceAccountId) throws ApiException { - ApiResponse resp = listSecretKeysWithHttpInfo(serviceAccountId); - return resp.getData(); - } - - /** - * - * List the secret keys for the specified service account. - * @param serviceAccountId Identifies the service account. (required) - * @return ApiResponse<ListSecretKeysResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse listSecretKeysWithHttpInfo(String serviceAccountId) throws ApiException { - com.squareup.okhttp.Call call = listSecretKeysValidateBeforeCall(serviceAccountId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * List the secret keys for the specified service account. - * @param serviceAccountId Identifies the service account. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call listSecretKeysAsync(String serviceAccountId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = listSecretKeysValidateBeforeCall(serviceAccountId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for listServiceAccounts - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call listServiceAccountsCall(Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/serviceaccounts"; - - List localVarQueryParams = new ArrayList(); - if (limit != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit)); - if (offset != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call listServiceAccountsValidateBeforeCall(Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - - com.squareup.okhttp.Call call = listServiceAccountsCall(limit, offset, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * List all service accounts configured. - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @return ListServiceAccountsResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ListServiceAccountsResponse listServiceAccounts(Integer limit, Integer offset) throws ApiException { - ApiResponse resp = listServiceAccountsWithHttpInfo(limit, offset); - return resp.getData(); - } - - /** - * - * List all service accounts configured. - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @return ApiResponse<ListServiceAccountsResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse listServiceAccountsWithHttpInfo(Integer limit, Integer offset) throws ApiException { - com.squareup.okhttp.Call call = listServiceAccountsValidateBeforeCall(limit, offset, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * List all service accounts configured. - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call listServiceAccountsAsync(Integer limit, Integer offset, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = listServiceAccountsValidateBeforeCall(limit, offset, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for updateServiceAccount - * @param serviceAccountId Identifies the service account. (required) - * @param serviceAccountUpdateBody Body for an updateServiceAccount request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call updateServiceAccountCall(String serviceAccountId, ServiceAccountUpdate serviceAccountUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = serviceAccountUpdateBody; - - // create path and map variables - String localVarPath = "/v1.1/serviceaccounts/{serviceAccountId}" - .replaceAll("\\{" + "serviceAccountId" + "\\}", apiClient.escapeString(serviceAccountId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call updateServiceAccountValidateBeforeCall(String serviceAccountId, ServiceAccountUpdate serviceAccountUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'serviceAccountId' is set - if (serviceAccountId == null) { - throw new ApiException("Missing the required parameter 'serviceAccountId' when calling updateServiceAccount(Async)"); - } - - // verify the required parameter 'serviceAccountUpdateBody' is set - if (serviceAccountUpdateBody == null) { - throw new ApiException("Missing the required parameter 'serviceAccountUpdateBody' when calling updateServiceAccount(Async)"); - } - - - com.squareup.okhttp.Call call = updateServiceAccountCall(serviceAccountId, serviceAccountUpdateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Update the specified service account. - * @param serviceAccountId Identifies the service account. (required) - * @param serviceAccountUpdateBody Body for an updateServiceAccount request. (required) - * @return ServiceAccountResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ServiceAccountResponse updateServiceAccount(String serviceAccountId, ServiceAccountUpdate serviceAccountUpdateBody) throws ApiException { - ApiResponse resp = updateServiceAccountWithHttpInfo(serviceAccountId, serviceAccountUpdateBody); - return resp.getData(); - } - - /** - * - * Update the specified service account. - * @param serviceAccountId Identifies the service account. (required) - * @param serviceAccountUpdateBody Body for an updateServiceAccount request. (required) - * @return ApiResponse<ServiceAccountResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse updateServiceAccountWithHttpInfo(String serviceAccountId, ServiceAccountUpdate serviceAccountUpdateBody) throws ApiException { - com.squareup.okhttp.Call call = updateServiceAccountValidateBeforeCall(serviceAccountId, serviceAccountUpdateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Update the specified service account. - * @param serviceAccountId Identifies the service account. (required) - * @param serviceAccountUpdateBody Body for an updateServiceAccount request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call updateServiceAccountAsync(String serviceAccountId, ServiceAccountUpdate serviceAccountUpdateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = updateServiceAccountValidateBeforeCall(serviceAccountId, serviceAccountUpdateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } -} diff --git a/src/main/java/io/smooch/client/api/TemplateApi.java b/src/main/java/io/smooch/client/api/TemplateApi.java deleted file mode 100644 index 269e3d7d..00000000 --- a/src/main/java/io/smooch/client/api/TemplateApi.java +++ /dev/null @@ -1,746 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.api; - -import io.smooch.client.ApiCallback; -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.ApiResponse; -import io.smooch.client.Configuration; -import io.smooch.client.Pair; -import io.smooch.client.ProgressRequestBody; -import io.smooch.client.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import io.smooch.client.model.ListTemplatesResponse; -import io.smooch.client.model.TemplateCreate; -import io.smooch.client.model.TemplateResponse; -import io.smooch.client.model.TemplateUpdate; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class TemplateApi { - private ApiClient apiClient; - - public TemplateApi() { - this(Configuration.getDefaultApiClient()); - } - - public TemplateApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Build call for createTemplate - * @param appId Identifies the app. (required) - * @param templateCreateBody Body for a createTemplate request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call createTemplateCall(String appId, TemplateCreate templateCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = templateCreateBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/templates" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call createTemplateValidateBeforeCall(String appId, TemplateCreate templateCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling createTemplate(Async)"); - } - - // verify the required parameter 'templateCreateBody' is set - if (templateCreateBody == null) { - throw new ApiException("Missing the required parameter 'templateCreateBody' when calling createTemplate(Async)"); - } - - - com.squareup.okhttp.Call call = createTemplateCall(appId, templateCreateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Create a template for the specified app. - * @param appId Identifies the app. (required) - * @param templateCreateBody Body for a createTemplate request. (required) - * @return TemplateResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public TemplateResponse createTemplate(String appId, TemplateCreate templateCreateBody) throws ApiException { - ApiResponse resp = createTemplateWithHttpInfo(appId, templateCreateBody); - return resp.getData(); - } - - /** - * - * Create a template for the specified app. - * @param appId Identifies the app. (required) - * @param templateCreateBody Body for a createTemplate request. (required) - * @return ApiResponse<TemplateResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse createTemplateWithHttpInfo(String appId, TemplateCreate templateCreateBody) throws ApiException { - com.squareup.okhttp.Call call = createTemplateValidateBeforeCall(appId, templateCreateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Create a template for the specified app. - * @param appId Identifies the app. (required) - * @param templateCreateBody Body for a createTemplate request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call createTemplateAsync(String appId, TemplateCreate templateCreateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = createTemplateValidateBeforeCall(appId, templateCreateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for deleteTemplate - * @param appId Identifies the app. (required) - * @param templateId Identifies the template. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteTemplateCall(String appId, String templateId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/templates/{templateId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "templateId" + "\\}", apiClient.escapeString(templateId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteTemplateValidateBeforeCall(String appId, String templateId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling deleteTemplate(Async)"); - } - - // verify the required parameter 'templateId' is set - if (templateId == null) { - throw new ApiException("Missing the required parameter 'templateId' when calling deleteTemplate(Async)"); - } - - - com.squareup.okhttp.Call call = deleteTemplateCall(appId, templateId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Delete the specified template. - * @param appId Identifies the app. (required) - * @param templateId Identifies the template. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteTemplate(String appId, String templateId) throws ApiException { - deleteTemplateWithHttpInfo(appId, templateId); - } - - /** - * - * Delete the specified template. - * @param appId Identifies the app. (required) - * @param templateId Identifies the template. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteTemplateWithHttpInfo(String appId, String templateId) throws ApiException { - com.squareup.okhttp.Call call = deleteTemplateValidateBeforeCall(appId, templateId, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Delete the specified template. - * @param appId Identifies the app. (required) - * @param templateId Identifies the template. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteTemplateAsync(String appId, String templateId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteTemplateValidateBeforeCall(appId, templateId, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for getTemplate - * @param appId Identifies the app. (required) - * @param templateId Identifies the template. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getTemplateCall(String appId, String templateId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/templates/{templateId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "templateId" + "\\}", apiClient.escapeString(templateId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getTemplateValidateBeforeCall(String appId, String templateId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getTemplate(Async)"); - } - - // verify the required parameter 'templateId' is set - if (templateId == null) { - throw new ApiException("Missing the required parameter 'templateId' when calling getTemplate(Async)"); - } - - - com.squareup.okhttp.Call call = getTemplateCall(appId, templateId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get the specified template. - * @param appId Identifies the app. (required) - * @param templateId Identifies the template. (required) - * @return TemplateResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public TemplateResponse getTemplate(String appId, String templateId) throws ApiException { - ApiResponse resp = getTemplateWithHttpInfo(appId, templateId); - return resp.getData(); - } - - /** - * - * Get the specified template. - * @param appId Identifies the app. (required) - * @param templateId Identifies the template. (required) - * @return ApiResponse<TemplateResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getTemplateWithHttpInfo(String appId, String templateId) throws ApiException { - com.squareup.okhttp.Call call = getTemplateValidateBeforeCall(appId, templateId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get the specified template. - * @param appId Identifies the app. (required) - * @param templateId Identifies the template. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getTemplateAsync(String appId, String templateId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getTemplateValidateBeforeCall(appId, templateId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for listTemplates - * @param appId Identifies the app. (required) - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call listTemplatesCall(String appId, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/templates" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - if (limit != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit)); - if (offset != null) - localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset)); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call listTemplatesValidateBeforeCall(String appId, Integer limit, Integer offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling listTemplates(Async)"); - } - - - com.squareup.okhttp.Call call = listTemplatesCall(appId, limit, offset, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * List templates for the specified app. - * @param appId Identifies the app. (required) - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @return ListTemplatesResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ListTemplatesResponse listTemplates(String appId, Integer limit, Integer offset) throws ApiException { - ApiResponse resp = listTemplatesWithHttpInfo(appId, limit, offset); - return resp.getData(); - } - - /** - * - * List templates for the specified app. - * @param appId Identifies the app. (required) - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @return ApiResponse<ListTemplatesResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse listTemplatesWithHttpInfo(String appId, Integer limit, Integer offset) throws ApiException { - com.squareup.okhttp.Call call = listTemplatesValidateBeforeCall(appId, limit, offset, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * List templates for the specified app. - * @param appId Identifies the app. (required) - * @param limit The number of records to return. (optional, default to 25) - * @param offset The number of initial records to skip before picking records to return. (optional, default to 0) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call listTemplatesAsync(String appId, Integer limit, Integer offset, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = listTemplatesValidateBeforeCall(appId, limit, offset, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for updateTemplate - * @param appId Identifies the app. (required) - * @param templateId Identifies the template. (required) - * @param templateUpdateBody Body for an updateTemplate request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call updateTemplateCall(String appId, String templateId, TemplateUpdate templateUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = templateUpdateBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/templates/{templateId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "templateId" + "\\}", apiClient.escapeString(templateId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call updateTemplateValidateBeforeCall(String appId, String templateId, TemplateUpdate templateUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling updateTemplate(Async)"); - } - - // verify the required parameter 'templateId' is set - if (templateId == null) { - throw new ApiException("Missing the required parameter 'templateId' when calling updateTemplate(Async)"); - } - - // verify the required parameter 'templateUpdateBody' is set - if (templateUpdateBody == null) { - throw new ApiException("Missing the required parameter 'templateUpdateBody' when calling updateTemplate(Async)"); - } - - - com.squareup.okhttp.Call call = updateTemplateCall(appId, templateId, templateUpdateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Update the specified template. - * @param appId Identifies the app. (required) - * @param templateId Identifies the template. (required) - * @param templateUpdateBody Body for an updateTemplate request. (required) - * @return TemplateResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public TemplateResponse updateTemplate(String appId, String templateId, TemplateUpdate templateUpdateBody) throws ApiException { - ApiResponse resp = updateTemplateWithHttpInfo(appId, templateId, templateUpdateBody); - return resp.getData(); - } - - /** - * - * Update the specified template. - * @param appId Identifies the app. (required) - * @param templateId Identifies the template. (required) - * @param templateUpdateBody Body for an updateTemplate request. (required) - * @return ApiResponse<TemplateResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse updateTemplateWithHttpInfo(String appId, String templateId, TemplateUpdate templateUpdateBody) throws ApiException { - com.squareup.okhttp.Call call = updateTemplateValidateBeforeCall(appId, templateId, templateUpdateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Update the specified template. - * @param appId Identifies the app. (required) - * @param templateId Identifies the template. (required) - * @param templateUpdateBody Body for an updateTemplate request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call updateTemplateAsync(String appId, String templateId, TemplateUpdate templateUpdateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = updateTemplateValidateBeforeCall(appId, templateId, templateUpdateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } -} diff --git a/src/main/java/io/smooch/client/api/WebhookApi.java b/src/main/java/io/smooch/client/api/WebhookApi.java deleted file mode 100644 index edd58a0c..00000000 --- a/src/main/java/io/smooch/client/api/WebhookApi.java +++ /dev/null @@ -1,734 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.api; - -import io.smooch.client.ApiCallback; -import io.smooch.client.ApiClient; -import io.smooch.client.ApiException; -import io.smooch.client.ApiResponse; -import io.smooch.client.Configuration; -import io.smooch.client.Pair; -import io.smooch.client.ProgressRequestBody; -import io.smooch.client.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import io.smooch.client.model.ListWebhooksResponse; -import io.smooch.client.model.WebhookCreate; -import io.smooch.client.model.WebhookResponse; -import io.smooch.client.model.WebhookUpdate; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class WebhookApi { - private ApiClient apiClient; - - public WebhookApi() { - this(Configuration.getDefaultApiClient()); - } - - public WebhookApi(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - /** - * Build call for createWebhook - * @param appId Identifies the app. (required) - * @param webhookCreateBody Body for a createWebhook request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call createWebhookCall(String appId, WebhookCreate webhookCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = webhookCreateBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/webhooks" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call createWebhookValidateBeforeCall(String appId, WebhookCreate webhookCreateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling createWebhook(Async)"); - } - - // verify the required parameter 'webhookCreateBody' is set - if (webhookCreateBody == null) { - throw new ApiException("Missing the required parameter 'webhookCreateBody' when calling createWebhook(Async)"); - } - - - com.squareup.okhttp.Call call = createWebhookCall(appId, webhookCreateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Create a webhook for the specified app. - * @param appId Identifies the app. (required) - * @param webhookCreateBody Body for a createWebhook request. (required) - * @return WebhookResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public WebhookResponse createWebhook(String appId, WebhookCreate webhookCreateBody) throws ApiException { - ApiResponse resp = createWebhookWithHttpInfo(appId, webhookCreateBody); - return resp.getData(); - } - - /** - * - * Create a webhook for the specified app. - * @param appId Identifies the app. (required) - * @param webhookCreateBody Body for a createWebhook request. (required) - * @return ApiResponse<WebhookResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse createWebhookWithHttpInfo(String appId, WebhookCreate webhookCreateBody) throws ApiException { - com.squareup.okhttp.Call call = createWebhookValidateBeforeCall(appId, webhookCreateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Create a webhook for the specified app. - * @param appId Identifies the app. (required) - * @param webhookCreateBody Body for a createWebhook request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call createWebhookAsync(String appId, WebhookCreate webhookCreateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = createWebhookValidateBeforeCall(appId, webhookCreateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for deleteWebhook - * @param appId Identifies the app. (required) - * @param webhookId Identifies the webhook. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call deleteWebhookCall(String appId, String webhookId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/webhooks/{webhookId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "webhookId" + "\\}", apiClient.escapeString(webhookId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call deleteWebhookValidateBeforeCall(String appId, String webhookId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling deleteWebhook(Async)"); - } - - // verify the required parameter 'webhookId' is set - if (webhookId == null) { - throw new ApiException("Missing the required parameter 'webhookId' when calling deleteWebhook(Async)"); - } - - - com.squareup.okhttp.Call call = deleteWebhookCall(appId, webhookId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Delete the specified webhook. - * @param appId Identifies the app. (required) - * @param webhookId Identifies the webhook. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public void deleteWebhook(String appId, String webhookId) throws ApiException { - deleteWebhookWithHttpInfo(appId, webhookId); - } - - /** - * - * Delete the specified webhook. - * @param appId Identifies the app. (required) - * @param webhookId Identifies the webhook. (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse deleteWebhookWithHttpInfo(String appId, String webhookId) throws ApiException { - com.squareup.okhttp.Call call = deleteWebhookValidateBeforeCall(appId, webhookId, null, null); - return apiClient.execute(call); - } - - /** - * (asynchronously) - * Delete the specified webhook. - * @param appId Identifies the app. (required) - * @param webhookId Identifies the webhook. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call deleteWebhookAsync(String appId, String webhookId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = deleteWebhookValidateBeforeCall(appId, webhookId, progressListener, progressRequestListener); - apiClient.executeAsync(call, callback); - return call; - } - /** - * Build call for getWebhook - * @param appId Identifies the app. (required) - * @param webhookId Identifies the webhook. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call getWebhookCall(String appId, String webhookId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/webhooks/{webhookId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "webhookId" + "\\}", apiClient.escapeString(webhookId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call getWebhookValidateBeforeCall(String appId, String webhookId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling getWebhook(Async)"); - } - - // verify the required parameter 'webhookId' is set - if (webhookId == null) { - throw new ApiException("Missing the required parameter 'webhookId' when calling getWebhook(Async)"); - } - - - com.squareup.okhttp.Call call = getWebhookCall(appId, webhookId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Get the specified webhook. - * @param appId Identifies the app. (required) - * @param webhookId Identifies the webhook. (required) - * @return WebhookResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public WebhookResponse getWebhook(String appId, String webhookId) throws ApiException { - ApiResponse resp = getWebhookWithHttpInfo(appId, webhookId); - return resp.getData(); - } - - /** - * - * Get the specified webhook. - * @param appId Identifies the app. (required) - * @param webhookId Identifies the webhook. (required) - * @return ApiResponse<WebhookResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse getWebhookWithHttpInfo(String appId, String webhookId) throws ApiException { - com.squareup.okhttp.Call call = getWebhookValidateBeforeCall(appId, webhookId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Get the specified webhook. - * @param appId Identifies the app. (required) - * @param webhookId Identifies the webhook. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call getWebhookAsync(String appId, String webhookId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = getWebhookValidateBeforeCall(appId, webhookId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for listWebhooks - * @param appId Identifies the app. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call listWebhooksCall(String appId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/webhooks" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call listWebhooksValidateBeforeCall(String appId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling listWebhooks(Async)"); - } - - - com.squareup.okhttp.Call call = listWebhooksCall(appId, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * List webhooks for the specified app. - * @param appId Identifies the app. (required) - * @return ListWebhooksResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ListWebhooksResponse listWebhooks(String appId) throws ApiException { - ApiResponse resp = listWebhooksWithHttpInfo(appId); - return resp.getData(); - } - - /** - * - * List webhooks for the specified app. - * @param appId Identifies the app. (required) - * @return ApiResponse<ListWebhooksResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse listWebhooksWithHttpInfo(String appId) throws ApiException { - com.squareup.okhttp.Call call = listWebhooksValidateBeforeCall(appId, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * List webhooks for the specified app. - * @param appId Identifies the app. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call listWebhooksAsync(String appId, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = listWebhooksValidateBeforeCall(appId, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } - /** - * Build call for updateWebhook - * @param appId Identifies the app. (required) - * @param webhookId Identifies the webhook. (required) - * @param webhookUpdateBody Body for an updateWebhook request. (required) - * @param progressListener Progress listener - * @param progressRequestListener Progress request listener - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - */ - public com.squareup.okhttp.Call updateWebhookCall(String appId, String webhookId, WebhookUpdate webhookUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - Object localVarPostBody = webhookUpdateBody; - - // create path and map variables - String localVarPath = "/v1.1/apps/{appId}/webhooks/{webhookId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString())) - .replaceAll("\\{" + "webhookId" + "\\}", apiClient.escapeString(webhookId.toString())); - - List localVarQueryParams = new ArrayList(); - - Map localVarHeaderParams = new HashMap(); - - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - if(progressListener != null) { - apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { - @Override - public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { - com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - } - }); - } - - String[] localVarAuthNames = new String[] { "basicAuth", "jwt" }; - return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); - } - - @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call updateWebhookValidateBeforeCall(String appId, String webhookId, WebhookUpdate webhookUpdateBody, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException("Missing the required parameter 'appId' when calling updateWebhook(Async)"); - } - - // verify the required parameter 'webhookId' is set - if (webhookId == null) { - throw new ApiException("Missing the required parameter 'webhookId' when calling updateWebhook(Async)"); - } - - // verify the required parameter 'webhookUpdateBody' is set - if (webhookUpdateBody == null) { - throw new ApiException("Missing the required parameter 'webhookUpdateBody' when calling updateWebhook(Async)"); - } - - - com.squareup.okhttp.Call call = updateWebhookCall(appId, webhookId, webhookUpdateBody, progressListener, progressRequestListener); - return call; - - - - - - } - - /** - * - * Update the specified webhook. - * @param appId Identifies the app. (required) - * @param webhookId Identifies the webhook. (required) - * @param webhookUpdateBody Body for an updateWebhook request. (required) - * @return WebhookResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public WebhookResponse updateWebhook(String appId, String webhookId, WebhookUpdate webhookUpdateBody) throws ApiException { - ApiResponse resp = updateWebhookWithHttpInfo(appId, webhookId, webhookUpdateBody); - return resp.getData(); - } - - /** - * - * Update the specified webhook. - * @param appId Identifies the app. (required) - * @param webhookId Identifies the webhook. (required) - * @param webhookUpdateBody Body for an updateWebhook request. (required) - * @return ApiResponse<WebhookResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - */ - public ApiResponse updateWebhookWithHttpInfo(String appId, String webhookId, WebhookUpdate webhookUpdateBody) throws ApiException { - com.squareup.okhttp.Call call = updateWebhookValidateBeforeCall(appId, webhookId, webhookUpdateBody, null, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return apiClient.execute(call, localVarReturnType); - } - - /** - * (asynchronously) - * Update the specified webhook. - * @param appId Identifies the app. (required) - * @param webhookId Identifies the webhook. (required) - * @param webhookUpdateBody Body for an updateWebhook request. (required) - * @param callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - */ - public com.squareup.okhttp.Call updateWebhookAsync(String appId, String webhookId, WebhookUpdate webhookUpdateBody, final ApiCallback callback) throws ApiException { - - ProgressResponseBody.ProgressListener progressListener = null; - ProgressRequestBody.ProgressRequestListener progressRequestListener = null; - - if (callback != null) { - progressListener = new ProgressResponseBody.ProgressListener() { - @Override - public void update(long bytesRead, long contentLength, boolean done) { - callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - - progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { - @Override - public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { - callback.onUploadProgress(bytesWritten, contentLength, done); - } - }; - } - - com.squareup.okhttp.Call call = updateWebhookValidateBeforeCall(appId, webhookId, webhookUpdateBody, progressListener, progressRequestListener); - Type localVarReturnType = new TypeToken(){}.getType(); - apiClient.executeAsync(call, localVarReturnType, callback); - return call; - } -} diff --git a/src/main/java/io/smooch/client/auth/ApiKeyAuth.java b/src/main/java/io/smooch/client/auth/ApiKeyAuth.java deleted file mode 100644 index 5f1aa470..00000000 --- a/src/main/java/io/smooch/client/auth/ApiKeyAuth.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.auth; - -import io.smooch.client.Pair; - -import java.util.Map; -import java.util.List; - - -public class ApiKeyAuth implements Authentication { - private final String location; - private final String paramName; - - private String apiKey; - private String apiKeyPrefix; - - public ApiKeyAuth(String location, String paramName) { - this.location = location; - this.paramName = paramName; - } - - public String getLocation() { - return location; - } - - public String getParamName() { - return paramName; - } - - public String getApiKey() { - return apiKey; - } - - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - - public String getApiKeyPrefix() { - return apiKeyPrefix; - } - - public void setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - } - - @Override - public void applyToParams(List queryParams, Map headerParams) { - if (apiKey == null) { - return; - } - String value; - if (apiKeyPrefix != null) { - value = apiKeyPrefix + " " + apiKey; - } else { - value = apiKey; - } - if ("query".equals(location)) { - queryParams.add(new Pair(paramName, value)); - } else if ("header".equals(location)) { - headerParams.put(paramName, value); - } - } -} diff --git a/src/main/java/io/smooch/client/auth/Authentication.java b/src/main/java/io/smooch/client/auth/Authentication.java deleted file mode 100644 index 6d775c69..00000000 --- a/src/main/java/io/smooch/client/auth/Authentication.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.auth; - -import io.smooch.client.Pair; - -import java.util.Map; -import java.util.List; - -public interface Authentication { - /** - * Apply authentication settings to header and query params. - * - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - */ - void applyToParams(List queryParams, Map headerParams); -} diff --git a/src/main/java/io/smooch/client/auth/HttpBasicAuth.java b/src/main/java/io/smooch/client/auth/HttpBasicAuth.java deleted file mode 100644 index 8156a111..00000000 --- a/src/main/java/io/smooch/client/auth/HttpBasicAuth.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.auth; - -import io.smooch.client.Pair; - -import com.squareup.okhttp.Credentials; - -import java.util.Map; -import java.util.List; - -import java.io.UnsupportedEncodingException; - -public class HttpBasicAuth implements Authentication { - private String username; - private String password; - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - public void applyToParams(List queryParams, Map headerParams) { - if (username == null && password == null) { - return; - } - headerParams.put("Authorization", Credentials.basic( - username == null ? "" : username, - password == null ? "" : password)); - } -} diff --git a/src/main/java/io/smooch/client/auth/OAuth.java b/src/main/java/io/smooch/client/auth/OAuth.java deleted file mode 100644 index 7f7c9bde..00000000 --- a/src/main/java/io/smooch/client/auth/OAuth.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.auth; - -import io.smooch.client.Pair; - -import java.util.Map; -import java.util.List; - - -public class OAuth implements Authentication { - private String accessToken; - - public String getAccessToken() { - return accessToken; - } - - public void setAccessToken(String accessToken) { - this.accessToken = accessToken; - } - - @Override - public void applyToParams(List queryParams, Map headerParams) { - if (accessToken != null) { - headerParams.put("Authorization", "Bearer " + accessToken); - } - } -} diff --git a/src/main/java/io/smooch/client/auth/OAuthFlow.java b/src/main/java/io/smooch/client/auth/OAuthFlow.java deleted file mode 100644 index 8a99d274..00000000 --- a/src/main/java/io/smooch/client/auth/OAuthFlow.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.auth; - -public enum OAuthFlow { - accessCode, implicit, password, application -} diff --git a/src/main/java/io/smooch/client/model/Action.java b/src/main/java/io/smooch/client/model/Action.java deleted file mode 100644 index d7405de6..00000000 --- a/src/main/java/io/smooch/client/model/Action.java +++ /dev/null @@ -1,364 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * Action - */ - -public class Action { - @SerializedName("type") - private String type = null; - - @SerializedName("text") - private String text = null; - - @SerializedName("payload") - private String payload = null; - - @SerializedName("metadata") - private Object metadata = null; - - @SerializedName("amount") - private Integer amount = null; - - @SerializedName("currency") - private String currency = null; - - @SerializedName("default") - private Boolean _default = null; - - @SerializedName("iconUrl") - private String iconUrl = null; - - @SerializedName("uri") - private String uri = null; - - @SerializedName("fallback") - private String fallback = null; - - @SerializedName("size") - private String size = null; - - @SerializedName("extraChannelOptions") - private Object extraChannelOptions = null; - - @SerializedName("openOnReceive") - private Boolean openOnReceive = null; - - public Action type(String type) { - this.type = type; - return this; - } - - /** - * The action type. See [**ActionTypeEnum**](Enums.md#ActionTypeEnum) for available values. - * @return type - **/ - @ApiModelProperty(required = true, value = "The action type. See [**ActionTypeEnum**](Enums.md#ActionTypeEnum) for available values.") - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Action text(String text) { - this.text = text; - return this; - } - - /** - * The button text. - * @return text - **/ - @ApiModelProperty(required = true, value = "The button text.") - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public Action payload(String payload) { - this.payload = payload; - return this; - } - - /** - * The payload to be sent with the resulting webhook. Required for *postback* and *reply* actions. - * @return payload - **/ - @ApiModelProperty(value = "The payload to be sent with the resulting webhook. Required for *postback* and *reply* actions. ") - public String getPayload() { - return payload; - } - - public void setPayload(String payload) { - this.payload = payload; - } - - public Action metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - * Flat JSON object containing any custom properties associated with the action. - * @return metadata - **/ - @ApiModelProperty(value = "Flat JSON object containing any custom properties associated with the action.") - public Object getMetadata() { - return metadata; - } - - public void setMetadata(Object metadata) { - this.metadata = metadata; - } - - public Action amount(Integer amount) { - this.amount = amount; - return this; - } - - /** - * The amount being charged. It needs to be specified in cents and is an integer. Required for *buy* actions. - * @return amount - **/ - @ApiModelProperty(value = "The amount being charged. It needs to be specified in cents and is an integer. Required for *buy* actions. ") - public Integer getAmount() { - return amount; - } - - public void setAmount(Integer amount) { - this.amount = amount; - } - - public Action currency(String currency) { - this.currency = currency; - return this; - } - - /** - * The currency of the amount being charged (USD, CAD, etc.). - * @return currency - **/ - @ApiModelProperty(value = "The currency of the amount being charged (USD, CAD, etc.).") - public String getCurrency() { - return currency; - } - - public void setCurrency(String currency) { - this.currency = currency; - } - - public Action _default(Boolean _default) { - this._default = _default; - return this; - } - - /** - * Flag indicating if the message action is the default for a message item in Facebook Messenger. - * @return _default - **/ - @ApiModelProperty(value = "Flag indicating if the message action is the default for a message item in Facebook Messenger.") - public Boolean getDefault() { - return _default; - } - - public void setDefault(Boolean _default) { - this._default = _default; - } - - public Action iconUrl(String iconUrl) { - this.iconUrl = iconUrl; - return this; - } - - /** - * An icon to render next to the reply option (Facebook Messenger and Web Messenger only). - * @return iconUrl - **/ - @ApiModelProperty(value = "An icon to render next to the reply option (Facebook Messenger and Web Messenger only).") - public String getIconUrl() { - return iconUrl; - } - - public void setIconUrl(String iconUrl) { - this.iconUrl = iconUrl; - } - - public Action uri(String uri) { - this.uri = uri; - return this; - } - - /** - * The action URI. This is the link that will be used in the clients when clicking the button. Required for *link* and *webview* actions. - * @return uri - **/ - @ApiModelProperty(value = "The action URI. This is the link that will be used in the clients when clicking the button. Required for *link* and *webview* actions. ") - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public Action fallback(String fallback) { - this.fallback = fallback; - return this; - } - - /** - * The webview action fallback uri. This is the link that will be used in clients that do not support webviews. Required for *webview* actions. - * @return fallback - **/ - @ApiModelProperty(value = "The webview action fallback uri. This is the link that will be used in clients that do not support webviews. Required for *webview* actions. ") - public String getFallback() { - return fallback; - } - - public void setFallback(String fallback) { - this.fallback = fallback; - } - - public Action size(String size) { - this.size = size; - return this; - } - - /** - * The size used to display the webview. Allowed values are [\"compact\", \"tall\", \"full\"]. (Optional) Used for *webview* actions. See [**ActionSizeEnum**](Enums.md#ActionSizeEnum) for available values. - * @return size - **/ - @ApiModelProperty(value = "The size used to display the webview. Allowed values are [\"compact\", \"tall\", \"full\"]. (Optional) Used for *webview* actions. See [**ActionSizeEnum**](Enums.md#ActionSizeEnum) for available values. ") - public String getSize() { - return size; - } - - public void setSize(String size) { - this.size = size; - } - - public Action extraChannelOptions(Object extraChannelOptions) { - this.extraChannelOptions = extraChannelOptions; - return this; - } - - /** - * Extra options to pass directly to the channel API. See [Extra Channel Options](https://docs.smooch.io/rest#extra-channel-options-schema) - * @return extraChannelOptions - **/ - @ApiModelProperty(value = "Extra options to pass directly to the channel API. See [Extra Channel Options](https://docs.smooch.io/rest#extra-channel-options-schema)") - public Object getExtraChannelOptions() { - return extraChannelOptions; - } - - public void setExtraChannelOptions(Object extraChannelOptions) { - this.extraChannelOptions = extraChannelOptions; - } - - public Action openOnReceive(Boolean openOnReceive) { - this.openOnReceive = openOnReceive; - return this; - } - - /** - * Flag indicating if the webview should open automatically. Only one action per message can be set to true. Currently only supported on the Web Messenger. - * @return openOnReceive - **/ - @ApiModelProperty(value = "Flag indicating if the webview should open automatically. Only one action per message can be set to true. Currently only supported on the Web Messenger.") - public Boolean getOpenOnReceive() { - return openOnReceive; - } - - public void setOpenOnReceive(Boolean openOnReceive) { - this.openOnReceive = openOnReceive; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Action action = (Action) o; - return Objects.equals(this.type, action.type) && - Objects.equals(this.text, action.text) && - Objects.equals(this.payload, action.payload) && - Objects.equals(this.metadata, action.metadata) && - Objects.equals(this.amount, action.amount) && - Objects.equals(this.currency, action.currency) && - Objects.equals(this._default, action._default) && - Objects.equals(this.iconUrl, action.iconUrl) && - Objects.equals(this.uri, action.uri) && - Objects.equals(this.fallback, action.fallback) && - Objects.equals(this.size, action.size) && - Objects.equals(this.extraChannelOptions, action.extraChannelOptions) && - Objects.equals(this.openOnReceive, action.openOnReceive); - } - - @Override - public int hashCode() { - return Objects.hash(type, text, payload, metadata, amount, currency, _default, iconUrl, uri, fallback, size, extraChannelOptions, openOnReceive); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Action {\n"); - - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" text: ").append(toIndentedString(text)).append("\n"); - sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); - sb.append(" currency: ").append(toIndentedString(currency)).append("\n"); - sb.append(" _default: ").append(toIndentedString(_default)).append("\n"); - sb.append(" iconUrl: ").append(toIndentedString(iconUrl)).append("\n"); - sb.append(" uri: ").append(toIndentedString(uri)).append("\n"); - sb.append(" fallback: ").append(toIndentedString(fallback)).append("\n"); - sb.append(" size: ").append(toIndentedString(size)).append("\n"); - sb.append(" extraChannelOptions: ").append(toIndentedString(extraChannelOptions)).append("\n"); - sb.append(" openOnReceive: ").append(toIndentedString(openOnReceive)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/ActivityResponse.java b/src/main/java/io/smooch/client/model/ActivityResponse.java deleted file mode 100644 index 7877f0a8..00000000 --- a/src/main/java/io/smooch/client/model/ActivityResponse.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.smooch.client.model.Conversation; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * ActivityResponse - */ - -public class ActivityResponse { - @SerializedName("conversation") - private Conversation conversation = null; - - public ActivityResponse conversation(Conversation conversation) { - this.conversation = conversation; - return this; - } - - /** - * The conversation. - * @return conversation - **/ - @ApiModelProperty(required = true, value = "The conversation.") - public Conversation getConversation() { - return conversation; - } - - public void setConversation(Conversation conversation) { - this.conversation = conversation; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ActivityResponse activityResponse = (ActivityResponse) o; - return Objects.equals(this.conversation, activityResponse.conversation); - } - - @Override - public int hashCode() { - return Objects.hash(conversation); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ActivityResponse {\n"); - - sb.append(" conversation: ").append(toIndentedString(conversation)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/App.java b/src/main/java/io/smooch/client/model/App.java deleted file mode 100644 index e8c781e3..00000000 --- a/src/main/java/io/smooch/client/model/App.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.smooch.client.model.AppSettings; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * App - */ - -public class App { - @SerializedName("_id") - private String id = null; - - @SerializedName("appToken") - private String appToken = null; - - @SerializedName("name") - private String name = null; - - @SerializedName("settings") - private AppSettings settings = null; - - @SerializedName("metadata") - private Object metadata = null; - - public App id(String id) { - this.id = id; - return this; - } - - /** - * The app's ID. - * @return id - **/ - @ApiModelProperty(required = true, value = "The app's ID.") - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public App appToken(String appToken) { - this.appToken = appToken; - return this; - } - - /** - * The appToken, used to initialize the Web, iOS and Android clients and to make calls to the app user facing API. - * @return appToken - **/ - @ApiModelProperty(required = true, value = "The appToken, used to initialize the Web, iOS and Android clients and to make calls to the app user facing API.") - public String getAppToken() { - return appToken; - } - - public void setAppToken(String appToken) { - this.appToken = appToken; - } - - public App name(String name) { - this.name = name; - return this; - } - - /** - * The app's name. - * @return name - **/ - @ApiModelProperty(required = true, value = "The app's name.") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public App settings(AppSettings settings) { - this.settings = settings; - return this; - } - - /** - * Get settings - * @return settings - **/ - @ApiModelProperty(value = "") - public AppSettings getSettings() { - return settings; - } - - public void setSettings(AppSettings settings) { - this.settings = settings; - } - - public App metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - * Flat JSON object containing any custom properties associated with the app. - * @return metadata - **/ - @ApiModelProperty(value = "Flat JSON object containing any custom properties associated with the app.") - public Object getMetadata() { - return metadata; - } - - public void setMetadata(Object metadata) { - this.metadata = metadata; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - App app = (App) o; - return Objects.equals(this.id, app.id) && - Objects.equals(this.appToken, app.appToken) && - Objects.equals(this.name, app.name) && - Objects.equals(this.settings, app.settings) && - Objects.equals(this.metadata, app.metadata); - } - - @Override - public int hashCode() { - return Objects.hash(id, appToken, name, settings, metadata); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class App {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" appToken: ").append(toIndentedString(appToken)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/AppCreate.java b/src/main/java/io/smooch/client/model/AppCreate.java deleted file mode 100644 index 4bb1ddcb..00000000 --- a/src/main/java/io/smooch/client/model/AppCreate.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.smooch.client.model.AppSettings; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * AppCreate - */ - -public class AppCreate { - @SerializedName("name") - private String name = null; - - @SerializedName("settings") - private AppSettings settings = null; - - @SerializedName("metadata") - private Object metadata = null; - - public AppCreate name(String name) { - this.name = name; - return this; - } - - /** - * The app's name. - * @return name - **/ - @ApiModelProperty(required = true, value = "The app's name.") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public AppCreate settings(AppSettings settings) { - this.settings = settings; - return this; - } - - /** - * Get settings - * @return settings - **/ - @ApiModelProperty(value = "") - public AppSettings getSettings() { - return settings; - } - - public void setSettings(AppSettings settings) { - this.settings = settings; - } - - public AppCreate metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - * Flat JSON object containing any custom properties associated with the app. - * @return metadata - **/ - @ApiModelProperty(value = "Flat JSON object containing any custom properties associated with the app.") - public Object getMetadata() { - return metadata; - } - - public void setMetadata(Object metadata) { - this.metadata = metadata; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AppCreate appCreate = (AppCreate) o; - return Objects.equals(this.name, appCreate.name) && - Objects.equals(this.settings, appCreate.settings) && - Objects.equals(this.metadata, appCreate.metadata); - } - - @Override - public int hashCode() { - return Objects.hash(name, settings, metadata); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AppCreate {\n"); - - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/AppResponse.java b/src/main/java/io/smooch/client/model/AppResponse.java deleted file mode 100644 index a38ab626..00000000 --- a/src/main/java/io/smooch/client/model/AppResponse.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.smooch.client.model.App; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * AppResponse - */ - -public class AppResponse { - @SerializedName("app") - private App app = null; - - public AppResponse app(App app) { - this.app = app; - return this; - } - - /** - * The app. - * @return app - **/ - @ApiModelProperty(value = "The app.") - public App getApp() { - return app; - } - - public void setApp(App app) { - this.app = app; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AppResponse appResponse = (AppResponse) o; - return Objects.equals(this.app, appResponse.app); - } - - @Override - public int hashCode() { - return Objects.hash(app); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AppResponse {\n"); - - sb.append(" app: ").append(toIndentedString(app)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/AppSettings.java b/src/main/java/io/smooch/client/model/AppSettings.java deleted file mode 100644 index 7d07466c..00000000 --- a/src/main/java/io/smooch/client/model/AppSettings.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * Customizable app settings. - */ -@ApiModel(description = "Customizable app settings.") - -public class AppSettings { - @SerializedName("maskCreditCardNumbers") - private Boolean maskCreditCardNumbers = null; - - @SerializedName("useAnimalNames") - private Boolean useAnimalNames = null; - - @SerializedName("conversationRetentionSeconds") - private Integer conversationRetentionSeconds = null; - - @SerializedName("echoPostback") - private Boolean echoPostback = null; - - @SerializedName("ignoreAutoConversationStart") - private Boolean ignoreAutoConversationStart = null; - - public AppSettings maskCreditCardNumbers(Boolean maskCreditCardNumbers) { - this.maskCreditCardNumbers = maskCreditCardNumbers; - return this; - } - - /** - * Flag specifying whether credit card numbers will be automatically masked if sent through Smooch. - * @return maskCreditCardNumbers - **/ - @ApiModelProperty(value = "Flag specifying whether credit card numbers will be automatically masked if sent through Smooch.") - public Boolean getMaskCreditCardNumbers() { - return maskCreditCardNumbers; - } - - public void setMaskCreditCardNumbers(Boolean maskCreditCardNumbers) { - this.maskCreditCardNumbers = maskCreditCardNumbers; - } - - public AppSettings useAnimalNames(Boolean useAnimalNames) { - this.useAnimalNames = useAnimalNames; - return this; - } - - /** - * Flag specifying whether animal names should be used for anonymous users. - * @return useAnimalNames - **/ - @ApiModelProperty(value = "Flag specifying whether animal names should be used for anonymous users.") - public Boolean getUseAnimalNames() { - return useAnimalNames; - } - - public void setUseAnimalNames(Boolean useAnimalNames) { - this.useAnimalNames = useAnimalNames; - } - - public AppSettings conversationRetentionSeconds(Integer conversationRetentionSeconds) { - this.conversationRetentionSeconds = conversationRetentionSeconds; - return this; - } - - /** - * Number of seconds of inactivity before a conversation’s messages will be automatically deleted. - * @return conversationRetentionSeconds - **/ - @ApiModelProperty(value = "Number of seconds of inactivity before a conversation’s messages will be automatically deleted.") - public Integer getConversationRetentionSeconds() { - return conversationRetentionSeconds; - } - - public void setConversationRetentionSeconds(Integer conversationRetentionSeconds) { - this.conversationRetentionSeconds = conversationRetentionSeconds; - } - - public AppSettings echoPostback(Boolean echoPostback) { - this.echoPostback = echoPostback; - return this; - } - - /** - * A boolean specifying whether a message should be added to the conversation history when a postback button is clicked. - * @return echoPostback - **/ - @ApiModelProperty(value = "A boolean specifying whether a message should be added to the conversation history when a postback button is clicked.") - public Boolean getEchoPostback() { - return echoPostback; - } - - public void setEchoPostback(Boolean echoPostback) { - this.echoPostback = echoPostback; - } - - public AppSettings ignoreAutoConversationStart(Boolean ignoreAutoConversationStart) { - this.ignoreAutoConversationStart = ignoreAutoConversationStart; - return this; - } - - /** - * A boolean specifying whether a non message event coming from a social channel will trigger a start conversation event and count as an active user conversation (AUC).
**Note:** Calling *startConversation()* (or equivalent) from the Android-, iOS- or Web-SDK will count as an AUC, regardless of the value of this setting. - * @return ignoreAutoConversationStart - **/ - @ApiModelProperty(value = "A boolean specifying whether a non message event coming from a social channel will trigger a start conversation event and count as an active user conversation (AUC).
**Note:** Calling *startConversation()* (or equivalent) from the Android-, iOS- or Web-SDK will count as an AUC, regardless of the value of this setting.") - public Boolean getIgnoreAutoConversationStart() { - return ignoreAutoConversationStart; - } - - public void setIgnoreAutoConversationStart(Boolean ignoreAutoConversationStart) { - this.ignoreAutoConversationStart = ignoreAutoConversationStart; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AppSettings appSettings = (AppSettings) o; - return Objects.equals(this.maskCreditCardNumbers, appSettings.maskCreditCardNumbers) && - Objects.equals(this.useAnimalNames, appSettings.useAnimalNames) && - Objects.equals(this.conversationRetentionSeconds, appSettings.conversationRetentionSeconds) && - Objects.equals(this.echoPostback, appSettings.echoPostback) && - Objects.equals(this.ignoreAutoConversationStart, appSettings.ignoreAutoConversationStart); - } - - @Override - public int hashCode() { - return Objects.hash(maskCreditCardNumbers, useAnimalNames, conversationRetentionSeconds, echoPostback, ignoreAutoConversationStart); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AppSettings {\n"); - - sb.append(" maskCreditCardNumbers: ").append(toIndentedString(maskCreditCardNumbers)).append("\n"); - sb.append(" useAnimalNames: ").append(toIndentedString(useAnimalNames)).append("\n"); - sb.append(" conversationRetentionSeconds: ").append(toIndentedString(conversationRetentionSeconds)).append("\n"); - sb.append(" echoPostback: ").append(toIndentedString(echoPostback)).append("\n"); - sb.append(" ignoreAutoConversationStart: ").append(toIndentedString(ignoreAutoConversationStart)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/AppUpdate.java b/src/main/java/io/smooch/client/model/AppUpdate.java deleted file mode 100644 index f9496fc1..00000000 --- a/src/main/java/io/smooch/client/model/AppUpdate.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.smooch.client.model.AppSettings; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * AppUpdate - */ - -public class AppUpdate { - @SerializedName("name") - private String name = null; - - @SerializedName("settings") - private AppSettings settings = null; - - @SerializedName("metadata") - private Object metadata = null; - - public AppUpdate name(String name) { - this.name = name; - return this; - } - - /** - * The app's name. - * @return name - **/ - @ApiModelProperty(value = "The app's name.") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public AppUpdate settings(AppSettings settings) { - this.settings = settings; - return this; - } - - /** - * Get settings - * @return settings - **/ - @ApiModelProperty(value = "") - public AppSettings getSettings() { - return settings; - } - - public void setSettings(AppSettings settings) { - this.settings = settings; - } - - public AppUpdate metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - * Flat JSON object containing any custom properties associated with the app. - * @return metadata - **/ - @ApiModelProperty(value = "Flat JSON object containing any custom properties associated with the app.") - public Object getMetadata() { - return metadata; - } - - public void setMetadata(Object metadata) { - this.metadata = metadata; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AppUpdate appUpdate = (AppUpdate) o; - return Objects.equals(this.name, appUpdate.name) && - Objects.equals(this.settings, appUpdate.settings) && - Objects.equals(this.metadata, appUpdate.metadata); - } - - @Override - public int hashCode() { - return Objects.hash(name, settings, metadata); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AppUpdate {\n"); - - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" settings: ").append(toIndentedString(settings)).append("\n"); - sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/AppUser.java b/src/main/java/io/smooch/client/model/AppUser.java deleted file mode 100644 index 0632aed9..00000000 --- a/src/main/java/io/smooch/client/model/AppUser.java +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.smooch.client.model.Client; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; - -/** - * AppUser - */ - -public class AppUser { - @SerializedName("_id") - private String id = null; - - @SerializedName("userId") - private String userId = null; - - @SerializedName("givenName") - private String givenName = null; - - @SerializedName("surname") - private String surname = null; - - @SerializedName("email") - private String email = null; - - @SerializedName("signedUpAt") - private String signedUpAt = null; - - @SerializedName("properties") - private Object properties = null; - - @SerializedName("conversationStarted") - private Boolean conversationStarted = null; - - @SerializedName("clients") - private List clients = null; - - @SerializedName("pendingClients") - private List pendingClients = null; - - public AppUser id(String id) { - this.id = id; - return this; - } - - /** - * The app user's ID, generated automatically. - * @return id - **/ - @ApiModelProperty(required = true, value = "The app user's ID, generated automatically.") - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public AppUser userId(String userId) { - this.userId = userId; - return this; - } - - /** - * The app user's userId. This ID is specified by the appMaker. - * @return userId - **/ - @ApiModelProperty(value = "The app user's userId. This ID is specified by the appMaker. ") - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public AppUser givenName(String givenName) { - this.givenName = givenName; - return this; - } - - /** - * The app user's given name. - * @return givenName - **/ - @ApiModelProperty(value = "The app user's given name.") - public String getGivenName() { - return givenName; - } - - public void setGivenName(String givenName) { - this.givenName = givenName; - } - - public AppUser surname(String surname) { - this.surname = surname; - return this; - } - - /** - * The app user's surname. - * @return surname - **/ - @ApiModelProperty(value = "The app user's surname.") - public String getSurname() { - return surname; - } - - public void setSurname(String surname) { - this.surname = surname; - } - - public AppUser email(String email) { - this.email = email; - return this; - } - - /** - * The app user's email. - * @return email - **/ - @ApiModelProperty(value = "The app user's email.") - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public AppUser signedUpAt(String signedUpAt) { - this.signedUpAt = signedUpAt; - return this; - } - - /** - * A datetime string with the format *yyyy-mm-ddThh:mm:ssZ* representing the moment an appUser was created. - * @return signedUpAt - **/ - @ApiModelProperty(value = "A datetime string with the format *yyyy-mm-ddThh:mm:ssZ* representing the moment an appUser was created.") - public String getSignedUpAt() { - return signedUpAt; - } - - public void setSignedUpAt(String signedUpAt) { - this.signedUpAt = signedUpAt; - } - - public AppUser properties(Object properties) { - this.properties = properties; - return this; - } - - /** - * Custom properties for the app user. - * @return properties - **/ - @ApiModelProperty(required = true, value = "Custom properties for the app user.") - public Object getProperties() { - return properties; - } - - public void setProperties(Object properties) { - this.properties = properties; - } - - public AppUser conversationStarted(Boolean conversationStarted) { - this.conversationStarted = conversationStarted; - return this; - } - - /** - * Flag indicating if the conversation has started for the app user. - * @return conversationStarted - **/ - @ApiModelProperty(required = true, value = "Flag indicating if the conversation has started for the app user.") - public Boolean getConversationStarted() { - return conversationStarted; - } - - public void setConversationStarted(Boolean conversationStarted) { - this.conversationStarted = conversationStarted; - } - - public AppUser clients(List clients) { - this.clients = clients; - return this; - } - - public AppUser addClientsItem(Client clientsItem) { - if (this.clients == null) { - this.clients = new ArrayList(); - } - this.clients.add(clientsItem); - return this; - } - - /** - * List of clients associated with the app user. - * @return clients - **/ - @ApiModelProperty(value = "List of clients associated with the app user.") - public List getClients() { - return clients; - } - - public void setClients(List clients) { - this.clients = clients; - } - - public AppUser pendingClients(List pendingClients) { - this.pendingClients = pendingClients; - return this; - } - - public AppUser addPendingClientsItem(Client pendingClientsItem) { - if (this.pendingClients == null) { - this.pendingClients = new ArrayList(); - } - this.pendingClients.add(pendingClientsItem); - return this; - } - - /** - * As clients, but containing linked clients which have not been confirmed yet (i.e. Twilio SMS). - * @return pendingClients - **/ - @ApiModelProperty(value = "As clients, but containing linked clients which have not been confirmed yet (i.e. Twilio SMS).") - public List getPendingClients() { - return pendingClients; - } - - public void setPendingClients(List pendingClients) { - this.pendingClients = pendingClients; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AppUser appUser = (AppUser) o; - return Objects.equals(this.id, appUser.id) && - Objects.equals(this.userId, appUser.userId) && - Objects.equals(this.givenName, appUser.givenName) && - Objects.equals(this.surname, appUser.surname) && - Objects.equals(this.email, appUser.email) && - Objects.equals(this.signedUpAt, appUser.signedUpAt) && - Objects.equals(this.properties, appUser.properties) && - Objects.equals(this.conversationStarted, appUser.conversationStarted) && - Objects.equals(this.clients, appUser.clients) && - Objects.equals(this.pendingClients, appUser.pendingClients); - } - - @Override - public int hashCode() { - return Objects.hash(id, userId, givenName, surname, email, signedUpAt, properties, conversationStarted, clients, pendingClients); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AppUser {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); - sb.append(" givenName: ").append(toIndentedString(givenName)).append("\n"); - sb.append(" surname: ").append(toIndentedString(surname)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" signedUpAt: ").append(toIndentedString(signedUpAt)).append("\n"); - sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); - sb.append(" conversationStarted: ").append(toIndentedString(conversationStarted)).append("\n"); - sb.append(" clients: ").append(toIndentedString(clients)).append("\n"); - sb.append(" pendingClients: ").append(toIndentedString(pendingClients)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/AppUserBusinessSystemsResponse.java b/src/main/java/io/smooch/client/model/AppUserBusinessSystemsResponse.java deleted file mode 100644 index 5fecfb18..00000000 --- a/src/main/java/io/smooch/client/model/AppUserBusinessSystemsResponse.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.smooch.client.model.BusinessSystemItem; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; - -/** - * AppUserBusinessSystemsResponse - */ - -public class AppUserBusinessSystemsResponse { - @SerializedName("businessSystems") - private List businessSystems = new ArrayList(); - - public AppUserBusinessSystemsResponse businessSystems(List businessSystems) { - this.businessSystems = businessSystems; - return this; - } - - public AppUserBusinessSystemsResponse addBusinessSystemsItem(BusinessSystemItem businessSystemsItem) { - this.businessSystems.add(businessSystemsItem); - return this; - } - - /** - * An array of objects containing the business system type and the id. - * @return businessSystems - **/ - @ApiModelProperty(required = true, value = "An array of objects containing the business system type and the id.") - public List getBusinessSystems() { - return businessSystems; - } - - public void setBusinessSystems(List businessSystems) { - this.businessSystems = businessSystems; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AppUserBusinessSystemsResponse appUserBusinessSystemsResponse = (AppUserBusinessSystemsResponse) o; - return Objects.equals(this.businessSystems, appUserBusinessSystemsResponse.businessSystems); - } - - @Override - public int hashCode() { - return Objects.hash(businessSystems); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AppUserBusinessSystemsResponse {\n"); - - sb.append(" businessSystems: ").append(toIndentedString(businessSystems)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/AppUserChannelsResponse.java b/src/main/java/io/smooch/client/model/AppUserChannelsResponse.java deleted file mode 100644 index 56e963a1..00000000 --- a/src/main/java/io/smooch/client/model/AppUserChannelsResponse.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.smooch.client.model.ChannelEntityItem; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; - -/** - * AppUserChannelsResponse - */ - -public class AppUserChannelsResponse { - @SerializedName("channels") - private List channels = new ArrayList(); - - public AppUserChannelsResponse channels(List channels) { - this.channels = channels; - return this; - } - - public AppUserChannelsResponse addChannelsItem(ChannelEntityItem channelsItem) { - this.channels.add(channelsItem); - return this; - } - - /** - * An array of objects containing the channel type and the entity id. - * @return channels - **/ - @ApiModelProperty(required = true, value = "An array of objects containing the channel type and the entity id.") - public List getChannels() { - return channels; - } - - public void setChannels(List channels) { - this.channels = channels; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AppUserChannelsResponse appUserChannelsResponse = (AppUserChannelsResponse) o; - return Objects.equals(this.channels, appUserChannelsResponse.channels); - } - - @Override - public int hashCode() { - return Objects.hash(channels); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AppUserChannelsResponse {\n"); - - sb.append(" channels: ").append(toIndentedString(channels)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/AppUserLink.java b/src/main/java/io/smooch/client/model/AppUserLink.java deleted file mode 100644 index 1c7a2d93..00000000 --- a/src/main/java/io/smooch/client/model/AppUserLink.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.smooch.client.model.Confirmation; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * AppUserLink - */ - -public class AppUserLink { - @SerializedName("type") - private String type = null; - - @SerializedName("integrationId") - private String integrationId = null; - - @SerializedName("phoneNumber") - private String phoneNumber = null; - - @SerializedName("address") - private String address = null; - - @SerializedName("givenName") - private String givenName = null; - - @SerializedName("surname") - private String surname = null; - - @SerializedName("subject") - private String subject = null; - - @SerializedName("confirmation") - private Confirmation confirmation = null; - - public AppUserLink type(String type) { - this.type = type; - return this; - } - - /** - * The type of the channel to link. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values. - * @return type - **/ - @ApiModelProperty(required = true, value = "The type of the channel to link. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values.") - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public AppUserLink integrationId(String integrationId) { - this.integrationId = integrationId; - return this; - } - - /** - * The id of the integration to link, it must match the provided type. - * @return integrationId - **/ - @ApiModelProperty(value = "The id of the integration to link, it must match the provided type.") - public String getIntegrationId() { - return integrationId; - } - - public void setIntegrationId(String integrationId) { - this.integrationId = integrationId; - } - - public AppUserLink phoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - return this; - } - - /** - * A String of the appUser’s phone number. It must contain the + prefix and the country code. Required for *messenger*, *twilio*, *messagebird* and *whatsapp* linking. - * @return phoneNumber - **/ - @ApiModelProperty(value = "A String of the appUser’s phone number. It must contain the + prefix and the country code. Required for *messenger*, *twilio*, *messagebird* and *whatsapp* linking. ") - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public AppUserLink address(String address) { - this.address = address; - return this; - } - - /** - * A String of the appUser’s email address. Required for *mailgun* linking. - * @return address - **/ - @ApiModelProperty(value = "A String of the appUser’s email address. Required for *mailgun* linking. ") - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public AppUserLink givenName(String givenName) { - this.givenName = givenName; - return this; - } - - /** - * A String of the appUser’s given name. Used as additional criteria to increase the likelihood of a match. (Optional) Used for *messenger* linking. - * @return givenName - **/ - @ApiModelProperty(value = "A String of the appUser’s given name. Used as additional criteria to increase the likelihood of a match. (Optional) Used for *messenger* linking. ") - public String getGivenName() { - return givenName; - } - - public void setGivenName(String givenName) { - this.givenName = givenName; - } - - public AppUserLink surname(String surname) { - this.surname = surname; - return this; - } - - /** - * A String of the appUser’s surname. Used as additional criteria to increase the likelihood of a match. (Optional) Used for *messenger* linking. - * @return surname - **/ - @ApiModelProperty(value = "A String of the appUser’s surname. Used as additional criteria to increase the likelihood of a match. (Optional) Used for *messenger* linking. ") - public String getSurname() { - return surname; - } - - public void setSurname(String surname) { - this.surname = surname; - } - - public AppUserLink subject(String subject) { - this.subject = subject; - return this; - } - - /** - * Subject for the outgoing email. (Optional) Used for *mailgun* linking. - * @return subject - **/ - @ApiModelProperty(value = "Subject for the outgoing email. (Optional) Used for *mailgun* linking. ") - public String getSubject() { - return subject; - } - - public void setSubject(String subject) { - this.subject = subject; - } - - public AppUserLink confirmation(Confirmation confirmation) { - this.confirmation = confirmation; - return this; - } - - /** - * Allows you to specify the strategy used to initiate a link with the target user. - * @return confirmation - **/ - @ApiModelProperty(required = true, value = "Allows you to specify the strategy used to initiate a link with the target user.") - public Confirmation getConfirmation() { - return confirmation; - } - - public void setConfirmation(Confirmation confirmation) { - this.confirmation = confirmation; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AppUserLink appUserLink = (AppUserLink) o; - return Objects.equals(this.type, appUserLink.type) && - Objects.equals(this.integrationId, appUserLink.integrationId) && - Objects.equals(this.phoneNumber, appUserLink.phoneNumber) && - Objects.equals(this.address, appUserLink.address) && - Objects.equals(this.givenName, appUserLink.givenName) && - Objects.equals(this.surname, appUserLink.surname) && - Objects.equals(this.subject, appUserLink.subject) && - Objects.equals(this.confirmation, appUserLink.confirmation); - } - - @Override - public int hashCode() { - return Objects.hash(type, integrationId, phoneNumber, address, givenName, surname, subject, confirmation); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AppUserLink {\n"); - - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); - sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); - sb.append(" address: ").append(toIndentedString(address)).append("\n"); - sb.append(" givenName: ").append(toIndentedString(givenName)).append("\n"); - sb.append(" surname: ").append(toIndentedString(surname)).append("\n"); - sb.append(" subject: ").append(toIndentedString(subject)).append("\n"); - sb.append(" confirmation: ").append(toIndentedString(confirmation)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/AppUserMerge.java b/src/main/java/io/smooch/client/model/AppUserMerge.java deleted file mode 100644 index 346aee22..00000000 --- a/src/main/java/io/smooch/client/model/AppUserMerge.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.smooch.client.model.MergedUser; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * AppUserMerge - */ - -public class AppUserMerge { - @SerializedName("surviving") - private MergedUser surviving = null; - - @SerializedName("discarded") - private MergedUser discarded = null; - - public AppUserMerge surviving(MergedUser surviving) { - this.surviving = surviving; - return this; - } - - /** - * Nested object representing the user that will survive at the end of the merge - * @return surviving - **/ - @ApiModelProperty(required = true, value = "Nested object representing the user that will survive at the end of the merge") - public MergedUser getSurviving() { - return surviving; - } - - public void setSurviving(MergedUser surviving) { - this.surviving = surviving; - } - - public AppUserMerge discarded(MergedUser discarded) { - this.discarded = discarded; - return this; - } - - /** - * Nested object representing the user to merge into the surviving user. This user will be deleted as part of the process. - * @return discarded - **/ - @ApiModelProperty(required = true, value = "Nested object representing the user to merge into the surviving user. This user will be deleted as part of the process.") - public MergedUser getDiscarded() { - return discarded; - } - - public void setDiscarded(MergedUser discarded) { - this.discarded = discarded; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AppUserMerge appUserMerge = (AppUserMerge) o; - return Objects.equals(this.surviving, appUserMerge.surviving) && - Objects.equals(this.discarded, appUserMerge.discarded); - } - - @Override - public int hashCode() { - return Objects.hash(surviving, discarded); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AppUserMerge {\n"); - - sb.append(" surviving: ").append(toIndentedString(surviving)).append("\n"); - sb.append(" discarded: ").append(toIndentedString(discarded)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/AppUserPreCreate.java b/src/main/java/io/smooch/client/model/AppUserPreCreate.java deleted file mode 100644 index 98d1ba28..00000000 --- a/src/main/java/io/smooch/client/model/AppUserPreCreate.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * AppUserPreCreate - */ - -public class AppUserPreCreate { - @SerializedName("userId") - private String userId = null; - - @SerializedName("givenName") - private String givenName = null; - - @SerializedName("surname") - private String surname = null; - - @SerializedName("email") - private String email = null; - - @SerializedName("signedUpAt") - private String signedUpAt = null; - - @SerializedName("properties") - private Object properties = null; - - public AppUserPreCreate userId(String userId) { - this.userId = userId; - return this; - } - - /** - * The app user's userId. This ID is specified by the appMaker. - * @return userId - **/ - @ApiModelProperty(required = true, value = "The app user's userId. This ID is specified by the appMaker. ") - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public AppUserPreCreate givenName(String givenName) { - this.givenName = givenName; - return this; - } - - /** - * The app user's given name. - * @return givenName - **/ - @ApiModelProperty(value = "The app user's given name.") - public String getGivenName() { - return givenName; - } - - public void setGivenName(String givenName) { - this.givenName = givenName; - } - - public AppUserPreCreate surname(String surname) { - this.surname = surname; - return this; - } - - /** - * The app user's surname. - * @return surname - **/ - @ApiModelProperty(value = "The app user's surname.") - public String getSurname() { - return surname; - } - - public void setSurname(String surname) { - this.surname = surname; - } - - public AppUserPreCreate email(String email) { - this.email = email; - return this; - } - - /** - * The app user's email. - * @return email - **/ - @ApiModelProperty(value = "The app user's email.") - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public AppUserPreCreate signedUpAt(String signedUpAt) { - this.signedUpAt = signedUpAt; - return this; - } - - /** - * A datetime string with the format *yyyy-mm-ddThh:mm:ssZ* representing the moment an appUser was created. - * @return signedUpAt - **/ - @ApiModelProperty(value = "A datetime string with the format *yyyy-mm-ddThh:mm:ssZ* representing the moment an appUser was created.") - public String getSignedUpAt() { - return signedUpAt; - } - - public void setSignedUpAt(String signedUpAt) { - this.signedUpAt = signedUpAt; - } - - public AppUserPreCreate properties(Object properties) { - this.properties = properties; - return this; - } - - /** - * Custom properties for the app user. - * @return properties - **/ - @ApiModelProperty(value = "Custom properties for the app user.") - public Object getProperties() { - return properties; - } - - public void setProperties(Object properties) { - this.properties = properties; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AppUserPreCreate appUserPreCreate = (AppUserPreCreate) o; - return Objects.equals(this.userId, appUserPreCreate.userId) && - Objects.equals(this.givenName, appUserPreCreate.givenName) && - Objects.equals(this.surname, appUserPreCreate.surname) && - Objects.equals(this.email, appUserPreCreate.email) && - Objects.equals(this.signedUpAt, appUserPreCreate.signedUpAt) && - Objects.equals(this.properties, appUserPreCreate.properties); - } - - @Override - public int hashCode() { - return Objects.hash(userId, givenName, surname, email, signedUpAt, properties); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AppUserPreCreate {\n"); - - sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); - sb.append(" givenName: ").append(toIndentedString(givenName)).append("\n"); - sb.append(" surname: ").append(toIndentedString(surname)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" signedUpAt: ").append(toIndentedString(signedUpAt)).append("\n"); - sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/AppUserResponse.java b/src/main/java/io/smooch/client/model/AppUserResponse.java deleted file mode 100644 index fe4ad421..00000000 --- a/src/main/java/io/smooch/client/model/AppUserResponse.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.smooch.client.model.AppUser; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * AppUserResponse - */ - -public class AppUserResponse { - @SerializedName("appUser") - private AppUser appUser = null; - - public AppUserResponse appUser(AppUser appUser) { - this.appUser = appUser; - return this; - } - - /** - * The app user. - * @return appUser - **/ - @ApiModelProperty(required = true, value = "The app user.") - public AppUser getAppUser() { - return appUser; - } - - public void setAppUser(AppUser appUser) { - this.appUser = appUser; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AppUserResponse appUserResponse = (AppUserResponse) o; - return Objects.equals(this.appUser, appUserResponse.appUser); - } - - @Override - public int hashCode() { - return Objects.hash(appUser); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AppUserResponse {\n"); - - sb.append(" appUser: ").append(toIndentedString(appUser)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/AppUserUpdate.java b/src/main/java/io/smooch/client/model/AppUserUpdate.java deleted file mode 100644 index 8cdc7637..00000000 --- a/src/main/java/io/smooch/client/model/AppUserUpdate.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * AppUserUpdate - */ - -public class AppUserUpdate { - @SerializedName("givenName") - private String givenName = null; - - @SerializedName("surname") - private String surname = null; - - @SerializedName("email") - private String email = null; - - @SerializedName("signedUpAt") - private String signedUpAt = null; - - @SerializedName("properties") - private Object properties = null; - - public AppUserUpdate givenName(String givenName) { - this.givenName = givenName; - return this; - } - - /** - * The app user's given name. - * @return givenName - **/ - @ApiModelProperty(value = "The app user's given name.") - public String getGivenName() { - return givenName; - } - - public void setGivenName(String givenName) { - this.givenName = givenName; - } - - public AppUserUpdate surname(String surname) { - this.surname = surname; - return this; - } - - /** - * The app user's surname. - * @return surname - **/ - @ApiModelProperty(value = "The app user's surname.") - public String getSurname() { - return surname; - } - - public void setSurname(String surname) { - this.surname = surname; - } - - public AppUserUpdate email(String email) { - this.email = email; - return this; - } - - /** - * The app user's email. - * @return email - **/ - @ApiModelProperty(value = "The app user's email.") - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public AppUserUpdate signedUpAt(String signedUpAt) { - this.signedUpAt = signedUpAt; - return this; - } - - /** - * A datetime string with the format *yyyy-mm-ddThh:mm:ssZ* representing the moment an appUser was created. - * @return signedUpAt - **/ - @ApiModelProperty(value = "A datetime string with the format *yyyy-mm-ddThh:mm:ssZ* representing the moment an appUser was created.") - public String getSignedUpAt() { - return signedUpAt; - } - - public void setSignedUpAt(String signedUpAt) { - this.signedUpAt = signedUpAt; - } - - public AppUserUpdate properties(Object properties) { - this.properties = properties; - return this; - } - - /** - * Custom properties for the app user. - * @return properties - **/ - @ApiModelProperty(value = "Custom properties for the app user.") - public Object getProperties() { - return properties; - } - - public void setProperties(Object properties) { - this.properties = properties; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AppUserUpdate appUserUpdate = (AppUserUpdate) o; - return Objects.equals(this.givenName, appUserUpdate.givenName) && - Objects.equals(this.surname, appUserUpdate.surname) && - Objects.equals(this.email, appUserUpdate.email) && - Objects.equals(this.signedUpAt, appUserUpdate.signedUpAt) && - Objects.equals(this.properties, appUserUpdate.properties); - } - - @Override - public int hashCode() { - return Objects.hash(givenName, surname, email, signedUpAt, properties); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AppUserUpdate {\n"); - - sb.append(" givenName: ").append(toIndentedString(givenName)).append("\n"); - sb.append(" surname: ").append(toIndentedString(surname)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" signedUpAt: ").append(toIndentedString(signedUpAt)).append("\n"); - sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/AttachmentRemove.java b/src/main/java/io/smooch/client/model/AttachmentRemove.java deleted file mode 100644 index 8c787b0b..00000000 --- a/src/main/java/io/smooch/client/model/AttachmentRemove.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * AttachmentRemove - */ - -public class AttachmentRemove { - @SerializedName("mediaUrl") - private String mediaUrl = null; - - public AttachmentRemove mediaUrl(String mediaUrl) { - this.mediaUrl = mediaUrl; - return this; - } - - /** - * The mediaUrl for the message. Required for image/file messages. - * @return mediaUrl - **/ - @ApiModelProperty(required = true, value = "The mediaUrl for the message. Required for image/file messages. ") - public String getMediaUrl() { - return mediaUrl; - } - - public void setMediaUrl(String mediaUrl) { - this.mediaUrl = mediaUrl; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AttachmentRemove attachmentRemove = (AttachmentRemove) o; - return Objects.equals(this.mediaUrl, attachmentRemove.mediaUrl); - } - - @Override - public int hashCode() { - return Objects.hash(mediaUrl); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AttachmentRemove {\n"); - - sb.append(" mediaUrl: ").append(toIndentedString(mediaUrl)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/AttachmentResponse.java b/src/main/java/io/smooch/client/model/AttachmentResponse.java deleted file mode 100644 index 9dd7a973..00000000 --- a/src/main/java/io/smooch/client/model/AttachmentResponse.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * AttachmentResponse - */ - -public class AttachmentResponse { - @SerializedName("mediaUrl") - private String mediaUrl = null; - - @SerializedName("mediaType") - private String mediaType = null; - - public AttachmentResponse mediaUrl(String mediaUrl) { - this.mediaUrl = mediaUrl; - return this; - } - - /** - * The mediaUrl for the message. Required for image/file messages. - * @return mediaUrl - **/ - @ApiModelProperty(required = true, value = "The mediaUrl for the message. Required for image/file messages. ") - public String getMediaUrl() { - return mediaUrl; - } - - public void setMediaUrl(String mediaUrl) { - this.mediaUrl = mediaUrl; - } - - public AttachmentResponse mediaType(String mediaType) { - this.mediaType = mediaType; - return this; - } - - /** - * The mediaType for the message. Required for image/file messages. - * @return mediaType - **/ - @ApiModelProperty(required = true, value = "The mediaType for the message. Required for image/file messages. ") - public String getMediaType() { - return mediaType; - } - - public void setMediaType(String mediaType) { - this.mediaType = mediaType; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AttachmentResponse attachmentResponse = (AttachmentResponse) o; - return Objects.equals(this.mediaUrl, attachmentResponse.mediaUrl) && - Objects.equals(this.mediaType, attachmentResponse.mediaType); - } - - @Override - public int hashCode() { - return Objects.hash(mediaUrl, mediaType); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AttachmentResponse {\n"); - - sb.append(" mediaUrl: ").append(toIndentedString(mediaUrl)).append("\n"); - sb.append(" mediaType: ").append(toIndentedString(mediaType)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/AuthCodeResponse.java b/src/main/java/io/smooch/client/model/AuthCodeResponse.java deleted file mode 100644 index 7af65669..00000000 --- a/src/main/java/io/smooch/client/model/AuthCodeResponse.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * AuthCodeResponse - */ - -public class AuthCodeResponse { - @SerializedName("authCode") - private String authCode = null; - - public AuthCodeResponse authCode(String authCode) { - this.authCode = authCode; - return this; - } - - /** - * The auth code - * @return authCode - **/ - @ApiModelProperty(required = true, value = "The auth code") - public String getAuthCode() { - return authCode; - } - - public void setAuthCode(String authCode) { - this.authCode = authCode; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AuthCodeResponse authCodeResponse = (AuthCodeResponse) o; - return Objects.equals(this.authCode, authCodeResponse.authCode); - } - - @Override - public int hashCode() { - return Objects.hash(authCode); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AuthCodeResponse {\n"); - - sb.append(" authCode: ").append(toIndentedString(authCode)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/Author.java b/src/main/java/io/smooch/client/model/Author.java deleted file mode 100644 index abe62f88..00000000 --- a/src/main/java/io/smooch/client/model/Author.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * Author - */ - -public class Author { - @SerializedName("role") - private String role = null; - - @SerializedName("name") - private String name = null; - - @SerializedName("email") - private String email = null; - - @SerializedName("avatarUrl") - private String avatarUrl = null; - - public Author role(String role) { - this.role = role; - return this; - } - - /** - * The role of the individual posting the message. The only accepted value is \"appMaker\". - * @return role - **/ - @ApiModelProperty(required = true, value = "The role of the individual posting the message. The only accepted value is \"appMaker\".") - public String getRole() { - return role; - } - - public void setRole(String role) { - this.role = role; - } - - public Author name(String name) { - this.name = name; - return this; - } - - /** - * The display name of the message author. - * @return name - **/ - @ApiModelProperty(value = "The display name of the message author.") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Author email(String email) { - this.email = email; - return this; - } - - /** - * The email address of the message author. - * @return email - **/ - @ApiModelProperty(value = "The email address of the message author.") - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public Author avatarUrl(String avatarUrl) { - this.avatarUrl = avatarUrl; - return this; - } - - /** - * The URL of the desired message avatar image. - * @return avatarUrl - **/ - @ApiModelProperty(value = "The URL of the desired message avatar image.") - public String getAvatarUrl() { - return avatarUrl; - } - - public void setAvatarUrl(String avatarUrl) { - this.avatarUrl = avatarUrl; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Author author = (Author) o; - return Objects.equals(this.role, author.role) && - Objects.equals(this.name, author.name) && - Objects.equals(this.email, author.email) && - Objects.equals(this.avatarUrl, author.avatarUrl); - } - - @Override - public int hashCode() { - return Objects.hash(role, name, email, avatarUrl); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Author {\n"); - - sb.append(" role: ").append(toIndentedString(role)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" avatarUrl: ").append(toIndentedString(avatarUrl)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/BusinessSystemItem.java b/src/main/java/io/smooch/client/model/BusinessSystemItem.java deleted file mode 100644 index a2c3191f..00000000 --- a/src/main/java/io/smooch/client/model/BusinessSystemItem.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * BusinessSystemItem - */ - -public class BusinessSystemItem { - @SerializedName("type") - private String type = null; - - @SerializedName("channelId") - private String channelId = null; - - @SerializedName("ticketId") - private String ticketId = null; - - @SerializedName("roomId") - private Integer roomId = null; - - @SerializedName("conversationId") - private String conversationId = null; - - public BusinessSystemItem type(String type) { - this.type = type; - return this; - } - - /** - * The type of business system. See [**BusinessSystemTypeEnum**](Enums.md#BusinessSystemTypeEnum) for available values. - * @return type - **/ - @ApiModelProperty(required = true, value = "The type of business system. See [**BusinessSystemTypeEnum**](Enums.md#BusinessSystemTypeEnum) for available values.") - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public BusinessSystemItem channelId(String channelId) { - this.channelId = channelId; - return this; - } - - /** - * The channel id for a *slack* integration - * @return channelId - **/ - @ApiModelProperty(value = "The channel id for a *slack* integration") - public String getChannelId() { - return channelId; - } - - public void setChannelId(String channelId) { - this.channelId = channelId; - } - - public BusinessSystemItem ticketId(String ticketId) { - this.ticketId = ticketId; - return this; - } - - /** - * The ticket id for a *zendesk* integration - * @return ticketId - **/ - @ApiModelProperty(value = "The ticket id for a *zendesk* integration") - public String getTicketId() { - return ticketId; - } - - public void setTicketId(String ticketId) { - this.ticketId = ticketId; - } - - public BusinessSystemItem roomId(Integer roomId) { - this.roomId = roomId; - return this; - } - - /** - * The room id for a *hipchat* integration - * @return roomId - **/ - @ApiModelProperty(value = "The room id for a *hipchat* integration") - public Integer getRoomId() { - return roomId; - } - - public void setRoomId(Integer roomId) { - this.roomId = roomId; - } - - public BusinessSystemItem conversationId(String conversationId) { - this.conversationId = conversationId; - return this; - } - - /** - * The conversation id for a *helpscout* integration - * @return conversationId - **/ - @ApiModelProperty(value = "The conversation id for a *helpscout* integration") - public String getConversationId() { - return conversationId; - } - - public void setConversationId(String conversationId) { - this.conversationId = conversationId; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - BusinessSystemItem businessSystemItem = (BusinessSystemItem) o; - return Objects.equals(this.type, businessSystemItem.type) && - Objects.equals(this.channelId, businessSystemItem.channelId) && - Objects.equals(this.ticketId, businessSystemItem.ticketId) && - Objects.equals(this.roomId, businessSystemItem.roomId) && - Objects.equals(this.conversationId, businessSystemItem.conversationId); - } - - @Override - public int hashCode() { - return Objects.hash(type, channelId, ticketId, roomId, conversationId); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BusinessSystemItem {\n"); - - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" channelId: ").append(toIndentedString(channelId)).append("\n"); - sb.append(" ticketId: ").append(toIndentedString(ticketId)).append("\n"); - sb.append(" roomId: ").append(toIndentedString(roomId)).append("\n"); - sb.append(" conversationId: ").append(toIndentedString(conversationId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/ChannelEntityItem.java b/src/main/java/io/smooch/client/model/ChannelEntityItem.java deleted file mode 100644 index 1251cb51..00000000 --- a/src/main/java/io/smooch/client/model/ChannelEntityItem.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * ChannelEntityItem - */ - -public class ChannelEntityItem { - @SerializedName("type") - private String type = null; - - @SerializedName("integrationId") - private String integrationId = null; - - @SerializedName("phoneNumber") - private String phoneNumber = null; - - @SerializedName("userId") - private String userId = null; - - @SerializedName("address") - private String address = null; - - @SerializedName("username") - private String username = null; - - @SerializedName("chatId") - private String chatId = null; - - public ChannelEntityItem type(String type) { - this.type = type; - return this; - } - - /** - * The type of channel. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values. - * @return type - **/ - @ApiModelProperty(required = true, value = "The type of channel. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values.") - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public ChannelEntityItem integrationId(String integrationId) { - this.integrationId = integrationId; - return this; - } - - /** - * The ID of the integration. - * @return integrationId - **/ - @ApiModelProperty(value = "The ID of the integration.") - public String getIntegrationId() { - return integrationId; - } - - public void setIntegrationId(String integrationId) { - this.integrationId = integrationId; - } - - public ChannelEntityItem phoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - return this; - } - - /** - * The phone number for a *twilio* or *messagebird* integration - * @return phoneNumber - **/ - @ApiModelProperty(value = "The phone number for a *twilio* or *messagebird* integration") - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public ChannelEntityItem userId(String userId) { - this.userId = userId; - return this; - } - - /** - * The userId for a *messenger*, *viber*, *line*, *wechat* or *twitter* integration - * @return userId - **/ - @ApiModelProperty(value = "The userId for a *messenger*, *viber*, *line*, *wechat* or *twitter* integration") - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public ChannelEntityItem address(String address) { - this.address = address; - return this; - } - - /** - * The email address for a *mailgun* integration - * @return address - **/ - @ApiModelProperty(value = "The email address for a *mailgun* integration") - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public ChannelEntityItem username(String username) { - this.username = username; - return this; - } - - /** - * The username for a *whatsapp* integration - * @return username - **/ - @ApiModelProperty(value = "The username for a *whatsapp* integration") - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public ChannelEntityItem chatId(String chatId) { - this.chatId = chatId; - return this; - } - - /** - * The chat id for a *telegram* integration - * @return chatId - **/ - @ApiModelProperty(value = "The chat id for a *telegram* integration") - public String getChatId() { - return chatId; - } - - public void setChatId(String chatId) { - this.chatId = chatId; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ChannelEntityItem channelEntityItem = (ChannelEntityItem) o; - return Objects.equals(this.type, channelEntityItem.type) && - Objects.equals(this.integrationId, channelEntityItem.integrationId) && - Objects.equals(this.phoneNumber, channelEntityItem.phoneNumber) && - Objects.equals(this.userId, channelEntityItem.userId) && - Objects.equals(this.address, channelEntityItem.address) && - Objects.equals(this.username, channelEntityItem.username) && - Objects.equals(this.chatId, channelEntityItem.chatId); - } - - @Override - public int hashCode() { - return Objects.hash(type, integrationId, phoneNumber, userId, address, username, chatId); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ChannelEntityItem {\n"); - - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); - sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); - sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); - sb.append(" address: ").append(toIndentedString(address)).append("\n"); - sb.append(" username: ").append(toIndentedString(username)).append("\n"); - sb.append(" chatId: ").append(toIndentedString(chatId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/Client.java b/src/main/java/io/smooch/client/model/Client.java deleted file mode 100644 index d11e9911..00000000 --- a/src/main/java/io/smooch/client/model/Client.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.smooch.client.model.ClientInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * Client - */ - -public class Client { - @SerializedName("id") - private String id = null; - - @SerializedName("status") - private String status = null; - - @SerializedName("externalId") - private String externalId = null; - - @SerializedName("active") - private Boolean active = null; - - @SerializedName("lastSeen") - private String lastSeen = null; - - @SerializedName("platform") - private String platform = null; - - @SerializedName("integrationId") - private String integrationId = null; - - @SerializedName("pushNotificationToken") - private String pushNotificationToken = null; - - @SerializedName("appVersion") - private String appVersion = null; - - @SerializedName("displayName") - private String displayName = null; - - @SerializedName("info") - private ClientInfo info = null; - - @SerializedName("raw") - private Object raw = null; - - public Client id(String id) { - this.id = id; - return this; - } - - /** - * An identifier for the client. Must be globally unique. - * @return id - **/ - @ApiModelProperty(required = true, value = "An identifier for the client. Must be globally unique.") - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Client status(String status) { - this.status = status; - return this; - } - - /** - * The client status. Indicates if the client is able to receive messages or not. See [**ClientStatusEnum**](Enums.md#ClientStatusEnum) for available values. - * @return status - **/ - @ApiModelProperty(value = "The client status. Indicates if the client is able to receive messages or not. See [**ClientStatusEnum**](Enums.md#ClientStatusEnum) for available values.") - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public Client externalId(String externalId) { - this.externalId = externalId; - return this; - } - - /** - * The ID of the user on an external channel. For example, the user's phone number for Twilio, or their page-scoped user ID for Facebook Messenger. Applies only to non-SDK clients. - * @return externalId - **/ - @ApiModelProperty(value = "The ID of the user on an external channel. For example, the user's phone number for Twilio, or their page-scoped user ID for Facebook Messenger. Applies only to non-SDK clients.") - public String getExternalId() { - return externalId; - } - - public void setExternalId(String externalId) { - this.externalId = externalId; - } - - public Client active(Boolean active) { - this.active = active; - return this; - } - - /** - * Deprecated - use the status property instead. - * @return active - **/ - @ApiModelProperty(value = "Deprecated - use the status property instead.") - public Boolean getActive() { - return active; - } - - public void setActive(Boolean active) { - this.active = active; - } - - public Client lastSeen(String lastSeen) { - this.lastSeen = lastSeen; - return this; - } - - /** - * The date time the client was last seen. - * @return lastSeen - **/ - @ApiModelProperty(value = "The date time the client was last seen.") - public String getLastSeen() { - return lastSeen; - } - - public void setLastSeen(String lastSeen) { - this.lastSeen = lastSeen; - } - - public Client platform(String platform) { - this.platform = platform; - return this; - } - - /** - * The client's platform. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values. - * @return platform - **/ - @ApiModelProperty(required = true, value = "The client's platform. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values.") - public String getPlatform() { - return platform; - } - - public void setPlatform(String platform) { - this.platform = platform; - } - - public Client integrationId(String integrationId) { - this.integrationId = integrationId; - return this; - } - - /** - * The ID of the integration that the client was created for. - * @return integrationId - **/ - @ApiModelProperty(value = "The ID of the integration that the client was created for.") - public String getIntegrationId() { - return integrationId; - } - - public void setIntegrationId(String integrationId) { - this.integrationId = integrationId; - } - - public Client pushNotificationToken(String pushNotificationToken) { - this.pushNotificationToken = pushNotificationToken; - return this; - } - - /** - * The GCM or APN token to be used for sending push notifications to the device. Applies to only *android* and *ios* clients. - * @return pushNotificationToken - **/ - @ApiModelProperty(value = "The GCM or APN token to be used for sending push notifications to the device. Applies to only *android* and *ios* clients. ") - public String getPushNotificationToken() { - return pushNotificationToken; - } - - public void setPushNotificationToken(String pushNotificationToken) { - this.pushNotificationToken = pushNotificationToken; - } - - public Client appVersion(String appVersion) { - this.appVersion = appVersion; - return this; - } - - /** - * A reserved string field for reporting the app version running on the device. - * @return appVersion - **/ - @ApiModelProperty(value = "A reserved string field for reporting the app version running on the device.") - public String getAppVersion() { - return appVersion; - } - - public void setAppVersion(String appVersion) { - this.appVersion = appVersion; - } - - public Client displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - * The client's display name. - * @return displayName - **/ - @ApiModelProperty(value = "The client's display name.") - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - public Client info(ClientInfo info) { - this.info = info; - return this; - } - - /** - * Get info - * @return info - **/ - @ApiModelProperty(value = "") - public ClientInfo getInfo() { - return info; - } - - public void setInfo(ClientInfo info) { - this.info = info; - } - - public Client raw(Object raw) { - this.raw = raw; - return this; - } - - /** - * An Object with raw properties that vary for each client platform. All keys are optional and not guaranteed to be available. - * @return raw - **/ - @ApiModelProperty(value = "An Object with raw properties that vary for each client platform. All keys are optional and not guaranteed to be available.") - public Object getRaw() { - return raw; - } - - public void setRaw(Object raw) { - this.raw = raw; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Client client = (Client) o; - return Objects.equals(this.id, client.id) && - Objects.equals(this.status, client.status) && - Objects.equals(this.externalId, client.externalId) && - Objects.equals(this.active, client.active) && - Objects.equals(this.lastSeen, client.lastSeen) && - Objects.equals(this.platform, client.platform) && - Objects.equals(this.integrationId, client.integrationId) && - Objects.equals(this.pushNotificationToken, client.pushNotificationToken) && - Objects.equals(this.appVersion, client.appVersion) && - Objects.equals(this.displayName, client.displayName) && - Objects.equals(this.info, client.info) && - Objects.equals(this.raw, client.raw); - } - - @Override - public int hashCode() { - return Objects.hash(id, status, externalId, active, lastSeen, platform, integrationId, pushNotificationToken, appVersion, displayName, info, raw); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Client {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" externalId: ").append(toIndentedString(externalId)).append("\n"); - sb.append(" active: ").append(toIndentedString(active)).append("\n"); - sb.append(" lastSeen: ").append(toIndentedString(lastSeen)).append("\n"); - sb.append(" platform: ").append(toIndentedString(platform)).append("\n"); - sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); - sb.append(" pushNotificationToken: ").append(toIndentedString(pushNotificationToken)).append("\n"); - sb.append(" appVersion: ").append(toIndentedString(appVersion)).append("\n"); - sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); - sb.append(" info: ").append(toIndentedString(info)).append("\n"); - sb.append(" raw: ").append(toIndentedString(raw)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/ClientInfo.java b/src/main/java/io/smooch/client/model/ClientInfo.java deleted file mode 100644 index f5028f7e..00000000 --- a/src/main/java/io/smooch/client/model/ClientInfo.java +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * ClientInfo - */ - -public class ClientInfo { - @SerializedName("appName") - private String appName = null; - - @SerializedName("avatarUrl") - private String avatarUrl = null; - - @SerializedName("carrier") - private String carrier = null; - - @SerializedName("city") - private String city = null; - - @SerializedName("country") - private String country = null; - - @SerializedName("deviceModel") - private String deviceModel = null; - - @SerializedName("devicePlatform") - private String devicePlatform = null; - - @SerializedName("gender") - private String gender = null; - - @SerializedName("isPaymentEnabled") - private Boolean isPaymentEnabled = null; - - @SerializedName("locale") - private String locale = null; - - @SerializedName("os") - private String os = null; - - @SerializedName("osVersion") - private String osVersion = null; - - @SerializedName("phoneNumber") - private String phoneNumber = null; - - @SerializedName("radioAccessTechnology") - private String radioAccessTechnology = null; - - @SerializedName("state") - private String state = null; - - @SerializedName("timezone") - private Double timezone = null; - - @SerializedName("wifi") - private String wifi = null; - - public ClientInfo appName(String appName) { - this.appName = appName; - return this; - } - - /** - * Name of the app associated with the client. - * @return appName - **/ - @ApiModelProperty(value = "Name of the app associated with the client.") - public String getAppName() { - return appName; - } - - public void setAppName(String appName) { - this.appName = appName; - } - - public ClientInfo avatarUrl(String avatarUrl) { - this.avatarUrl = avatarUrl; - return this; - } - - /** - * The client's avatar URL. - * @return avatarUrl - **/ - @ApiModelProperty(value = "The client's avatar URL.") - public String getAvatarUrl() { - return avatarUrl; - } - - public void setAvatarUrl(String avatarUrl) { - this.avatarUrl = avatarUrl; - } - - public ClientInfo carrier(String carrier) { - this.carrier = carrier; - return this; - } - - /** - * The client's carrier. - * @return carrier - **/ - @ApiModelProperty(value = "The client's carrier.") - public String getCarrier() { - return carrier; - } - - public void setCarrier(String carrier) { - this.carrier = carrier; - } - - public ClientInfo city(String city) { - this.city = city; - return this; - } - - /** - * The client's city. - * @return city - **/ - @ApiModelProperty(value = "The client's city.") - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public ClientInfo country(String country) { - this.country = country; - return this; - } - - /** - * The client's country. - * @return country - **/ - @ApiModelProperty(value = "The client's country.") - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - public ClientInfo deviceModel(String deviceModel) { - this.deviceModel = deviceModel; - return this; - } - - /** - * The client's device model. - * @return deviceModel - **/ - @ApiModelProperty(value = "The client's device model.") - public String getDeviceModel() { - return deviceModel; - } - - public void setDeviceModel(String deviceModel) { - this.deviceModel = deviceModel; - } - - public ClientInfo devicePlatform(String devicePlatform) { - this.devicePlatform = devicePlatform; - return this; - } - - /** - * The client's device platform. - * @return devicePlatform - **/ - @ApiModelProperty(value = "The client's device platform.") - public String getDevicePlatform() { - return devicePlatform; - } - - public void setDevicePlatform(String devicePlatform) { - this.devicePlatform = devicePlatform; - } - - public ClientInfo gender(String gender) { - this.gender = gender; - return this; - } - - /** - * The client user's gender. - * @return gender - **/ - @ApiModelProperty(value = "The client user's gender.") - public String getGender() { - return gender; - } - - public void setGender(String gender) { - this.gender = gender; - } - - public ClientInfo isPaymentEnabled(Boolean isPaymentEnabled) { - this.isPaymentEnabled = isPaymentEnabled; - return this; - } - - /** - * Whether or not payment is enabled for client. - * @return isPaymentEnabled - **/ - @ApiModelProperty(value = "Whether or not payment is enabled for client.") - public Boolean getIsPaymentEnabled() { - return isPaymentEnabled; - } - - public void setIsPaymentEnabled(Boolean isPaymentEnabled) { - this.isPaymentEnabled = isPaymentEnabled; - } - - public ClientInfo locale(String locale) { - this.locale = locale; - return this; - } - - /** - * The client's locale. - * @return locale - **/ - @ApiModelProperty(value = "The client's locale.") - public String getLocale() { - return locale; - } - - public void setLocale(String locale) { - this.locale = locale; - } - - public ClientInfo os(String os) { - this.os = os; - return this; - } - - /** - * The client's OS. - * @return os - **/ - @ApiModelProperty(value = "The client's OS.") - public String getOs() { - return os; - } - - public void setOs(String os) { - this.os = os; - } - - public ClientInfo osVersion(String osVersion) { - this.osVersion = osVersion; - return this; - } - - /** - * The client's OS version. - * @return osVersion - **/ - @ApiModelProperty(value = "The client's OS version.") - public String getOsVersion() { - return osVersion; - } - - public void setOsVersion(String osVersion) { - this.osVersion = osVersion; - } - - public ClientInfo phoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - return this; - } - - /** - * The client's phone number. - * @return phoneNumber - **/ - @ApiModelProperty(value = "The client's phone number.") - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public ClientInfo radioAccessTechnology(String radioAccessTechnology) { - this.radioAccessTechnology = radioAccessTechnology; - return this; - } - - /** - * The client's radioAccessTechnology (Ex. HSDPA). - * @return radioAccessTechnology - **/ - @ApiModelProperty(value = "The client's radioAccessTechnology (Ex. HSDPA).") - public String getRadioAccessTechnology() { - return radioAccessTechnology; - } - - public void setRadioAccessTechnology(String radioAccessTechnology) { - this.radioAccessTechnology = radioAccessTechnology; - } - - public ClientInfo state(String state) { - this.state = state; - return this; - } - - /** - * The client's state or province. - * @return state - **/ - @ApiModelProperty(value = "The client's state or province.") - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public ClientInfo timezone(Double timezone) { - this.timezone = timezone; - return this; - } - - /** - * The client's timezone offset. - * @return timezone - **/ - @ApiModelProperty(value = "The client's timezone offset.") - public Double getTimezone() { - return timezone; - } - - public void setTimezone(Double timezone) { - this.timezone = timezone; - } - - public ClientInfo wifi(String wifi) { - this.wifi = wifi; - return this; - } - - /** - * Whether or not the client has wifi. - * @return wifi - **/ - @ApiModelProperty(value = "Whether or not the client has wifi.") - public String getWifi() { - return wifi; - } - - public void setWifi(String wifi) { - this.wifi = wifi; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ClientInfo clientInfo = (ClientInfo) o; - return Objects.equals(this.appName, clientInfo.appName) && - Objects.equals(this.avatarUrl, clientInfo.avatarUrl) && - Objects.equals(this.carrier, clientInfo.carrier) && - Objects.equals(this.city, clientInfo.city) && - Objects.equals(this.country, clientInfo.country) && - Objects.equals(this.deviceModel, clientInfo.deviceModel) && - Objects.equals(this.devicePlatform, clientInfo.devicePlatform) && - Objects.equals(this.gender, clientInfo.gender) && - Objects.equals(this.isPaymentEnabled, clientInfo.isPaymentEnabled) && - Objects.equals(this.locale, clientInfo.locale) && - Objects.equals(this.os, clientInfo.os) && - Objects.equals(this.osVersion, clientInfo.osVersion) && - Objects.equals(this.phoneNumber, clientInfo.phoneNumber) && - Objects.equals(this.radioAccessTechnology, clientInfo.radioAccessTechnology) && - Objects.equals(this.state, clientInfo.state) && - Objects.equals(this.timezone, clientInfo.timezone) && - Objects.equals(this.wifi, clientInfo.wifi); - } - - @Override - public int hashCode() { - return Objects.hash(appName, avatarUrl, carrier, city, country, deviceModel, devicePlatform, gender, isPaymentEnabled, locale, os, osVersion, phoneNumber, radioAccessTechnology, state, timezone, wifi); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ClientInfo {\n"); - - sb.append(" appName: ").append(toIndentedString(appName)).append("\n"); - sb.append(" avatarUrl: ").append(toIndentedString(avatarUrl)).append("\n"); - sb.append(" carrier: ").append(toIndentedString(carrier)).append("\n"); - sb.append(" city: ").append(toIndentedString(city)).append("\n"); - sb.append(" country: ").append(toIndentedString(country)).append("\n"); - sb.append(" deviceModel: ").append(toIndentedString(deviceModel)).append("\n"); - sb.append(" devicePlatform: ").append(toIndentedString(devicePlatform)).append("\n"); - sb.append(" gender: ").append(toIndentedString(gender)).append("\n"); - sb.append(" isPaymentEnabled: ").append(toIndentedString(isPaymentEnabled)).append("\n"); - sb.append(" locale: ").append(toIndentedString(locale)).append("\n"); - sb.append(" os: ").append(toIndentedString(os)).append("\n"); - sb.append(" osVersion: ").append(toIndentedString(osVersion)).append("\n"); - sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); - sb.append(" radioAccessTechnology: ").append(toIndentedString(radioAccessTechnology)).append("\n"); - sb.append(" state: ").append(toIndentedString(state)).append("\n"); - sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); - sb.append(" wifi: ").append(toIndentedString(wifi)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/Confirmation.java b/src/main/java/io/smooch/client/model/Confirmation.java deleted file mode 100644 index 11adbdd7..00000000 --- a/src/main/java/io/smooch/client/model/Confirmation.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.smooch.client.model.Message; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * Confirmation - */ - -public class Confirmation { - @SerializedName("type") - private String type = null; - - @SerializedName("message") - private Message message = null; - - public Confirmation type(String type) { - this.type = type; - return this; - } - - /** - * The confirmation type. See [**ConfirmationTypeEnum**](Enums.md#ConfirmationTypeEnum) for available values. - * @return type - **/ - @ApiModelProperty(required = true, value = "The confirmation type. See [**ConfirmationTypeEnum**](Enums.md#ConfirmationTypeEnum) for available values.") - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Confirmation message(Message message) { - this.message = message; - return this; - } - - /** - * The message used to reach out to the user. Must be a valid message object as per the post message API. - * @return message - **/ - @ApiModelProperty(value = "The message used to reach out to the user. Must be a valid message object as per the post message API.") - public Message getMessage() { - return message; - } - - public void setMessage(Message message) { - this.message = message; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Confirmation confirmation = (Confirmation) o; - return Objects.equals(this.type, confirmation.type) && - Objects.equals(this.message, confirmation.message); - } - - @Override - public int hashCode() { - return Objects.hash(type, message); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Confirmation {\n"); - - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/Conversation.java b/src/main/java/io/smooch/client/model/Conversation.java deleted file mode 100644 index cd5cfbf1..00000000 --- a/src/main/java/io/smooch/client/model/Conversation.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * Conversation - */ - -public class Conversation { - @SerializedName("_id") - private String id = null; - - @SerializedName("unreadCount") - private Integer unreadCount = null; - - public Conversation id(String id) { - this.id = id; - return this; - } - - /** - * The conversation ID, generated automatically. - * @return id - **/ - @ApiModelProperty(required = true, value = "The conversation ID, generated automatically.") - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Conversation unreadCount(Integer unreadCount) { - this.unreadCount = unreadCount; - return this; - } - - /** - * The number of unread messages in the conversation. - * @return unreadCount - **/ - @ApiModelProperty(required = true, value = "The number of unread messages in the conversation.") - public Integer getUnreadCount() { - return unreadCount; - } - - public void setUnreadCount(Integer unreadCount) { - this.unreadCount = unreadCount; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Conversation conversation = (Conversation) o; - return Objects.equals(this.id, conversation.id) && - Objects.equals(this.unreadCount, conversation.unreadCount); - } - - @Override - public int hashCode() { - return Objects.hash(id, unreadCount); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Conversation {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" unreadCount: ").append(toIndentedString(unreadCount)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/ConversationActivity.java b/src/main/java/io/smooch/client/model/ConversationActivity.java deleted file mode 100644 index 7f526859..00000000 --- a/src/main/java/io/smooch/client/model/ConversationActivity.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * ConversationActivity - */ - -public class ConversationActivity { - @SerializedName("role") - private String role = null; - - @SerializedName("type") - private String type = null; - - @SerializedName("name") - private String name = null; - - @SerializedName("avatarUrl") - private String avatarUrl = null; - - public ConversationActivity role(String role) { - this.role = role; - return this; - } - - /** - * The role of the actor. Must be *appMaker*. See [**RoleEnum**](Enums.md#RoleEnum) for available values. - * @return role - **/ - @ApiModelProperty(required = true, value = "The role of the actor. Must be *appMaker*. See [**RoleEnum**](Enums.md#RoleEnum) for available values.") - public String getRole() { - return role; - } - - public void setRole(String role) { - this.role = role; - } - - public ConversationActivity type(String type) { - this.type = type; - return this; - } - - /** - * The type of activity to trigger. Must be either *typing:start* or *typing:stop*. See [**MessageTypeEnum**](Enums.md#MessageTypeEnum) for available values. - * @return type - **/ - @ApiModelProperty(required = true, value = "The type of activity to trigger. Must be either *typing:start* or *typing:stop*. See [**MessageTypeEnum**](Enums.md#MessageTypeEnum) for available values.") - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public ConversationActivity name(String name) { - this.name = name; - return this; - } - - /** - * The name of the app maker that starts or stops typing a response. - * @return name - **/ - @ApiModelProperty(value = "The name of the app maker that starts or stops typing a response.") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public ConversationActivity avatarUrl(String avatarUrl) { - this.avatarUrl = avatarUrl; - return this; - } - - /** - * The avatar URL of the app maker that starts typing a response. - * @return avatarUrl - **/ - @ApiModelProperty(value = "The avatar URL of the app maker that starts typing a response.") - public String getAvatarUrl() { - return avatarUrl; - } - - public void setAvatarUrl(String avatarUrl) { - this.avatarUrl = avatarUrl; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ConversationActivity conversationActivity = (ConversationActivity) o; - return Objects.equals(this.role, conversationActivity.role) && - Objects.equals(this.type, conversationActivity.type) && - Objects.equals(this.name, conversationActivity.name) && - Objects.equals(this.avatarUrl, conversationActivity.avatarUrl); - } - - @Override - public int hashCode() { - return Objects.hash(role, type, name, avatarUrl); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ConversationActivity {\n"); - - sb.append(" role: ").append(toIndentedString(role)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" avatarUrl: ").append(toIndentedString(avatarUrl)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/Coordinates.java b/src/main/java/io/smooch/client/model/Coordinates.java deleted file mode 100644 index bd51aebc..00000000 --- a/src/main/java/io/smooch/client/model/Coordinates.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * Coordinates - */ - -public class Coordinates { - @SerializedName("lat") - private Double lat = null; - - @SerializedName("long") - private Double _long = null; - - public Coordinates lat(Double lat) { - this.lat = lat; - return this; - } - - /** - * A floating point value representing the latitude of the location. - * @return lat - **/ - @ApiModelProperty(required = true, value = "A floating point value representing the latitude of the location.") - public Double getLat() { - return lat; - } - - public void setLat(Double lat) { - this.lat = lat; - } - - public Coordinates _long(Double _long) { - this._long = _long; - return this; - } - - /** - * A floating point value representing the longitude of the location. - * @return _long - **/ - @ApiModelProperty(required = true, value = "A floating point value representing the longitude of the location.") - public Double getLong() { - return _long; - } - - public void setLong(Double _long) { - this._long = _long; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Coordinates coordinates = (Coordinates) o; - return Objects.equals(this.lat, coordinates.lat) && - Objects.equals(this._long, coordinates._long); - } - - @Override - public int hashCode() { - return Objects.hash(lat, _long); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Coordinates {\n"); - - sb.append(" lat: ").append(toIndentedString(lat)).append("\n"); - sb.append(" _long: ").append(toIndentedString(_long)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/Deployment.java b/src/main/java/io/smooch/client/model/Deployment.java deleted file mode 100644 index f16765fc..00000000 --- a/src/main/java/io/smooch/client/model/Deployment.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * Deployment - */ - -public class Deployment { - @SerializedName("_id") - private String id = null; - - @SerializedName("status") - private String status = null; - - @SerializedName("hosting") - private String hosting = null; - - @SerializedName("baseUrl") - private String baseUrl = null; - - @SerializedName("username") - private String username = null; - - @SerializedName("phoneNumber") - private String phoneNumber = null; - - @SerializedName("callbackUrl") - private String callbackUrl = null; - - @SerializedName("callbackSecret") - private String callbackSecret = null; - - @SerializedName("integrationId") - private String integrationId = null; - - @SerializedName("appId") - private String appId = null; - - public Deployment id(String id) { - this.id = id; - return this; - } - - /** - * The deployment ID, generated automatically. - * @return id - **/ - @ApiModelProperty(required = true, value = "The deployment ID, generated automatically.") - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Deployment status(String status) { - this.status = status; - return this; - } - - /** - * The deployment status. See [**DeploymentStatusEnum**](Enums.md#DeploymentStatusEnum) for available values. - * @return status - **/ - @ApiModelProperty(required = true, value = "The deployment status. See [**DeploymentStatusEnum**](Enums.md#DeploymentStatusEnum) for available values.") - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public Deployment hosting(String hosting) { - this.hosting = hosting; - return this; - } - - /** - * The deployment hosting. See [**DeploymentHostingEnum**](Enums.md#DeploymentHostingEnum) for available values. - * @return hosting - **/ - @ApiModelProperty(required = true, value = "The deployment hosting. See [**DeploymentHostingEnum**](Enums.md#DeploymentHostingEnum) for available values.") - public String getHosting() { - return hosting; - } - - public void setHosting(String hosting) { - this.hosting = hosting; - } - - public Deployment baseUrl(String baseUrl) { - this.baseUrl = baseUrl; - return this; - } - - /** - * The baseUrl of the deployment. Only present for `self` hosted deployments. - * @return baseUrl - **/ - @ApiModelProperty(value = "The baseUrl of the deployment. Only present for `self` hosted deployments.") - public String getBaseUrl() { - return baseUrl; - } - - public void setBaseUrl(String baseUrl) { - this.baseUrl = baseUrl; - } - - public Deployment username(String username) { - this.username = username; - return this; - } - - /** - * The username of the deployment. Only present for `self` hosted deployments. - * @return username - **/ - @ApiModelProperty(value = "The username of the deployment. Only present for `self` hosted deployments.") - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public Deployment phoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - return this; - } - - /** - * The phoneNumber of the deployment. Only present once the deployment has been registered. - * @return phoneNumber - **/ - @ApiModelProperty(value = "The phoneNumber of the deployment. Only present once the deployment has been registered.") - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public Deployment callbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - return this; - } - - /** - * The URL to be called by Smooch when the status of the deployment changes. - * @return callbackUrl - **/ - @ApiModelProperty(value = "The URL to be called by Smooch when the status of the deployment changes.") - public String getCallbackUrl() { - return callbackUrl; - } - - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - } - - public Deployment callbackSecret(String callbackSecret) { - this.callbackSecret = callbackSecret; - return this; - } - - /** - * The secret used to secure the callback. - * @return callbackSecret - **/ - @ApiModelProperty(value = "The secret used to secure the callback.") - public String getCallbackSecret() { - return callbackSecret; - } - - public void setCallbackSecret(String callbackSecret) { - this.callbackSecret = callbackSecret; - } - - public Deployment integrationId(String integrationId) { - this.integrationId = integrationId; - return this; - } - - /** - * The integrationId of the integration using this deployment. - * @return integrationId - **/ - @ApiModelProperty(value = "The integrationId of the integration using this deployment.") - public String getIntegrationId() { - return integrationId; - } - - public void setIntegrationId(String integrationId) { - this.integrationId = integrationId; - } - - public Deployment appId(String appId) { - this.appId = appId; - return this; - } - - /** - * The appId of the integration using this deployment. - * @return appId - **/ - @ApiModelProperty(value = "The appId of the integration using this deployment.") - public String getAppId() { - return appId; - } - - public void setAppId(String appId) { - this.appId = appId; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Deployment deployment = (Deployment) o; - return Objects.equals(this.id, deployment.id) && - Objects.equals(this.status, deployment.status) && - Objects.equals(this.hosting, deployment.hosting) && - Objects.equals(this.baseUrl, deployment.baseUrl) && - Objects.equals(this.username, deployment.username) && - Objects.equals(this.phoneNumber, deployment.phoneNumber) && - Objects.equals(this.callbackUrl, deployment.callbackUrl) && - Objects.equals(this.callbackSecret, deployment.callbackSecret) && - Objects.equals(this.integrationId, deployment.integrationId) && - Objects.equals(this.appId, deployment.appId); - } - - @Override - public int hashCode() { - return Objects.hash(id, status, hosting, baseUrl, username, phoneNumber, callbackUrl, callbackSecret, integrationId, appId); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Deployment {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" hosting: ").append(toIndentedString(hosting)).append("\n"); - sb.append(" baseUrl: ").append(toIndentedString(baseUrl)).append("\n"); - sb.append(" username: ").append(toIndentedString(username)).append("\n"); - sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); - sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); - sb.append(" callbackSecret: ").append(toIndentedString(callbackSecret)).append("\n"); - sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); - sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/DeploymentActivatePhoneNumber.java b/src/main/java/io/smooch/client/model/DeploymentActivatePhoneNumber.java deleted file mode 100644 index 72ff25f8..00000000 --- a/src/main/java/io/smooch/client/model/DeploymentActivatePhoneNumber.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * DeploymentActivatePhoneNumber - */ - -public class DeploymentActivatePhoneNumber { - @SerializedName("phoneNumber") - private String phoneNumber = null; - - @SerializedName("verifiedNameCertificate") - private String verifiedNameCertificate = null; - - @SerializedName("method") - private String method = null; - - public DeploymentActivatePhoneNumber phoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - return this; - } - - /** - * The phone number to send the activation code to. - * @return phoneNumber - **/ - @ApiModelProperty(required = true, value = "The phone number to send the activation code to.") - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public DeploymentActivatePhoneNumber verifiedNameCertificate(String verifiedNameCertificate) { - this.verifiedNameCertificate = verifiedNameCertificate; - return this; - } - - /** - * The verified name certificate for the phone number. - * @return verifiedNameCertificate - **/ - @ApiModelProperty(required = true, value = "The verified name certificate for the phone number.") - public String getVerifiedNameCertificate() { - return verifiedNameCertificate; - } - - public void setVerifiedNameCertificate(String verifiedNameCertificate) { - this.verifiedNameCertificate = verifiedNameCertificate; - } - - public DeploymentActivatePhoneNumber method(String method) { - this.method = method; - return this; - } - - /** - * The method desired to receive the activation code. See [**DeploymentActivationMethodEnum**](Enums.md#DeploymentActivationMethodEnum) for available values. - * @return method - **/ - @ApiModelProperty(required = true, value = "The method desired to receive the activation code. See [**DeploymentActivationMethodEnum**](Enums.md#DeploymentActivationMethodEnum) for available values.") - public String getMethod() { - return method; - } - - public void setMethod(String method) { - this.method = method; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DeploymentActivatePhoneNumber deploymentActivatePhoneNumber = (DeploymentActivatePhoneNumber) o; - return Objects.equals(this.phoneNumber, deploymentActivatePhoneNumber.phoneNumber) && - Objects.equals(this.verifiedNameCertificate, deploymentActivatePhoneNumber.verifiedNameCertificate) && - Objects.equals(this.method, deploymentActivatePhoneNumber.method); - } - - @Override - public int hashCode() { - return Objects.hash(phoneNumber, verifiedNameCertificate, method); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeploymentActivatePhoneNumber {\n"); - - sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).append("\n"); - sb.append(" verifiedNameCertificate: ").append(toIndentedString(verifiedNameCertificate)).append("\n"); - sb.append(" method: ").append(toIndentedString(method)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/DeploymentConfirmCode.java b/src/main/java/io/smooch/client/model/DeploymentConfirmCode.java deleted file mode 100644 index 1eddeaa4..00000000 --- a/src/main/java/io/smooch/client/model/DeploymentConfirmCode.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * DeploymentConfirmCode - */ - -public class DeploymentConfirmCode { - @SerializedName("code") - private String code = null; - - public DeploymentConfirmCode code(String code) { - this.code = code; - return this; - } - - /** - * The code that was sent to you via SMS or phone call. - * @return code - **/ - @ApiModelProperty(required = true, value = "The code that was sent to you via SMS or phone call.") - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DeploymentConfirmCode deploymentConfirmCode = (DeploymentConfirmCode) o; - return Objects.equals(this.code, deploymentConfirmCode.code); - } - - @Override - public int hashCode() { - return Objects.hash(code); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeploymentConfirmCode {\n"); - - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/DeploymentCreate.java b/src/main/java/io/smooch/client/model/DeploymentCreate.java deleted file mode 100644 index c0ebf421..00000000 --- a/src/main/java/io/smooch/client/model/DeploymentCreate.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * DeploymentCreate - */ - -public class DeploymentCreate { - @SerializedName("hosting") - private String hosting = null; - - @SerializedName("baseUrl") - private String baseUrl = null; - - @SerializedName("username") - private String username = null; - - @SerializedName("password") - private String password = null; - - @SerializedName("callbackUrl") - private String callbackUrl = null; - - public DeploymentCreate hosting(String hosting) { - this.hosting = hosting; - return this; - } - - /** - * The deployment hosting. See [**DeploymentHostingEnum**](Enums.md#DeploymentHostingEnum) for available values. - * @return hosting - **/ - @ApiModelProperty(required = true, value = "The deployment hosting. See [**DeploymentHostingEnum**](Enums.md#DeploymentHostingEnum) for available values.") - public String getHosting() { - return hosting; - } - - public void setHosting(String hosting) { - this.hosting = hosting; - } - - public DeploymentCreate baseUrl(String baseUrl) { - this.baseUrl = baseUrl; - return this; - } - - /** - * The base URL to access your WhatsApp EC. Only provide for `self` hosted deployments. - * @return baseUrl - **/ - @ApiModelProperty(value = "The base URL to access your WhatsApp EC. Only provide for `self` hosted deployments.") - public String getBaseUrl() { - return baseUrl; - } - - public void setBaseUrl(String baseUrl) { - this.baseUrl = baseUrl; - } - - public DeploymentCreate username(String username) { - this.username = username; - return this; - } - - /** - * The username to access your WhatsApp EC. Only provide for `self` hosted deployments. - * @return username - **/ - @ApiModelProperty(value = "The username to access your WhatsApp EC. Only provide for `self` hosted deployments.") - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public DeploymentCreate password(String password) { - this.password = password; - return this; - } - - /** - * The password to access your WhatsApp EC. Only provide for `self` hosted deployments. - * @return password - **/ - @ApiModelProperty(value = "The password to access your WhatsApp EC. Only provide for `self` hosted deployments.") - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public DeploymentCreate callbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - return this; - } - - /** - * The URL to be called by Smooch when the status of the deployment changes. - * @return callbackUrl - **/ - @ApiModelProperty(value = "The URL to be called by Smooch when the status of the deployment changes.") - public String getCallbackUrl() { - return callbackUrl; - } - - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DeploymentCreate deploymentCreate = (DeploymentCreate) o; - return Objects.equals(this.hosting, deploymentCreate.hosting) && - Objects.equals(this.baseUrl, deploymentCreate.baseUrl) && - Objects.equals(this.username, deploymentCreate.username) && - Objects.equals(this.password, deploymentCreate.password) && - Objects.equals(this.callbackUrl, deploymentCreate.callbackUrl); - } - - @Override - public int hashCode() { - return Objects.hash(hosting, baseUrl, username, password, callbackUrl); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeploymentCreate {\n"); - - sb.append(" hosting: ").append(toIndentedString(hosting)).append("\n"); - sb.append(" baseUrl: ").append(toIndentedString(baseUrl)).append("\n"); - sb.append(" username: ").append(toIndentedString(username)).append("\n"); - sb.append(" password: ").append(toIndentedString(password)).append("\n"); - sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/DeploymentResponse.java b/src/main/java/io/smooch/client/model/DeploymentResponse.java deleted file mode 100644 index 12de668f..00000000 --- a/src/main/java/io/smooch/client/model/DeploymentResponse.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.smooch.client.model.Deployment; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * DeploymentResponse - */ - -public class DeploymentResponse { - @SerializedName("deployment") - private Deployment deployment = null; - - public DeploymentResponse deployment(Deployment deployment) { - this.deployment = deployment; - return this; - } - - /** - * The deployment. - * @return deployment - **/ - @ApiModelProperty(required = true, value = "The deployment.") - public Deployment getDeployment() { - return deployment; - } - - public void setDeployment(Deployment deployment) { - this.deployment = deployment; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DeploymentResponse deploymentResponse = (DeploymentResponse) o; - return Objects.equals(this.deployment, deploymentResponse.deployment); - } - - @Override - public int hashCode() { - return Objects.hash(deployment); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeploymentResponse {\n"); - - sb.append(" deployment: ").append(toIndentedString(deployment)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/Destination.java b/src/main/java/io/smooch/client/model/Destination.java deleted file mode 100644 index a6f70194..00000000 --- a/src/main/java/io/smooch/client/model/Destination.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * Destination - */ - -public class Destination { - @SerializedName("integrationId") - private String integrationId = null; - - @SerializedName("integrationType") - private String integrationType = null; - - public Destination integrationId(String integrationId) { - this.integrationId = integrationId; - return this; - } - - /** - * The ID of the target integration. - * @return integrationId - **/ - @ApiModelProperty(required = true, value = "The ID of the target integration.") - public String getIntegrationId() { - return integrationId; - } - - public void setIntegrationId(String integrationId) { - this.integrationId = integrationId; - } - - public Destination integrationType(String integrationType) { - this.integrationType = integrationType; - return this; - } - - /** - * The type of the target integration. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values. - * @return integrationType - **/ - @ApiModelProperty(required = true, value = "The type of the target integration. See [**IntegrationTypeEnum**](Enums.md#IntegrationTypeEnum) for available values.") - public String getIntegrationType() { - return integrationType; - } - - public void setIntegrationType(String integrationType) { - this.integrationType = integrationType; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Destination destination = (Destination) o; - return Objects.equals(this.integrationId, destination.integrationId) && - Objects.equals(this.integrationType, destination.integrationType); - } - - @Override - public int hashCode() { - return Objects.hash(integrationId, integrationType); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Destination {\n"); - - sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); - sb.append(" integrationType: ").append(toIndentedString(integrationType)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/DisplaySettings.java b/src/main/java/io/smooch/client/model/DisplaySettings.java deleted file mode 100644 index 47df0b4e..00000000 --- a/src/main/java/io/smooch/client/model/DisplaySettings.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * DisplaySettings - */ - -public class DisplaySettings { - @SerializedName("imageAspectRatio") - private String imageAspectRatio = null; - - public DisplaySettings imageAspectRatio(String imageAspectRatio) { - this.imageAspectRatio = imageAspectRatio; - return this; - } - - /** - * Specifies how to display all carousel images. See [**ImageAspectRatioEnum**](Enums.md#ImageAspectRatioEnum) for available values. - * @return imageAspectRatio - **/ - @ApiModelProperty(value = "Specifies how to display all carousel images. See [**ImageAspectRatioEnum**](Enums.md#ImageAspectRatioEnum) for available values.") - public String getImageAspectRatio() { - return imageAspectRatio; - } - - public void setImageAspectRatio(String imageAspectRatio) { - this.imageAspectRatio = imageAspectRatio; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DisplaySettings displaySettings = (DisplaySettings) o; - return Objects.equals(this.imageAspectRatio, displaySettings.imageAspectRatio); - } - - @Override - public int hashCode() { - return Objects.hash(imageAspectRatio); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DisplaySettings {\n"); - - sb.append(" imageAspectRatio: ").append(toIndentedString(imageAspectRatio)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/Enums.java b/src/main/java/io/smooch/client/model/Enums.java deleted file mode 100644 index b88b3b8f..00000000 --- a/src/main/java/io/smooch/client/model/Enums.java +++ /dev/null @@ -1,1094 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -/** - * Enums - */ - -public class Enums { - /** - * Gets or Sets actionSize - */ - public enum ActionSizeEnum { - @SerializedName("compact") - COMPACT("compact"), - - @SerializedName("full") - FULL("full"), - - @SerializedName("tall") - TALL("tall"); - - private String value; - - ActionSizeEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("ActionSize") - private ActionSizeEnum actionSize = null; - - /** - * Gets or Sets actionType - */ - public enum ActionTypeEnum { - @SerializedName("buy") - BUY("buy"), - - @SerializedName("link") - LINK("link"), - - @SerializedName("locationRequest") - LOCATIONREQUEST("locationRequest"), - - @SerializedName("postback") - POSTBACK("postback"), - - @SerializedName("reply") - REPLY("reply"), - - @SerializedName("share") - SHARE("share"), - - @SerializedName("webview") - WEBVIEW("webview"); - - private String value; - - ActionTypeEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("ActionType") - private ActionTypeEnum actionType = null; - - /** - * Gets or Sets businessSystemType - */ - public enum BusinessSystemTypeEnum { - @SerializedName("helpscout") - HELPSCOUT("helpscout"), - - @SerializedName("slack") - SLACK("slack"), - - @SerializedName("zendesk") - ZENDESK("zendesk"); - - private String value; - - BusinessSystemTypeEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("BusinessSystemType") - private BusinessSystemTypeEnum businessSystemType = null; - - /** - * Gets or Sets clientStatus - */ - public enum ClientStatusEnum { - @SerializedName("active") - ACTIVE("active"), - - @SerializedName("blocked") - BLOCKED("blocked"), - - @SerializedName("inactive") - INACTIVE("inactive"), - - @SerializedName("pending") - PENDING("pending"); - - private String value; - - ClientStatusEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("ClientStatus") - private ClientStatusEnum clientStatus = null; - - /** - * Gets or Sets confirmationType - */ - public enum ConfirmationTypeEnum { - @SerializedName("immediate") - IMMEDIATE("immediate"), - - @SerializedName("userActivity") - USERACTIVITY("userActivity"), - - @SerializedName("prompt") - PROMPT("prompt"); - - private String value; - - ConfirmationTypeEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("ConfirmationType") - private ConfirmationTypeEnum confirmationType = null; - - /** - * Gets or Sets conversationActivityType - */ - public enum ConversationActivityTypeEnum { - @SerializedName("conversation:read") - CONVERSATION_READ("conversation:read"), - - @SerializedName("typing:start") - TYPING_START("typing:start"), - - @SerializedName("typing:stop") - TYPING_STOP("typing:stop"); - - private String value; - - ConversationActivityTypeEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("ConversationActivityType") - private ConversationActivityTypeEnum conversationActivityType = null; - - /** - * Gets or Sets deploymentActivationMethod - */ - public enum DeploymentActivationMethodEnum { - @SerializedName("sms") - SMS("sms"), - - @SerializedName("voice") - VOICE("voice"); - - private String value; - - DeploymentActivationMethodEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("DeploymentActivationMethod") - private DeploymentActivationMethodEnum deploymentActivationMethod = null; - - /** - * Gets or Sets deploymentHosting - */ - public enum DeploymentHostingEnum { - @SerializedName("self") - SELF("self"), - - @SerializedName("smooch") - SMOOCH("smooch"); - - private String value; - - DeploymentHostingEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("DeploymentHosting") - private DeploymentHostingEnum deploymentHosting = null; - - /** - * Gets or Sets deploymentStatus - */ - public enum DeploymentStatusEnum { - @SerializedName("deleting") - DELETING("deleting"), - - @SerializedName("error") - ERROR("error"), - - @SerializedName("integrated") - INTEGRATED("integrated"), - - @SerializedName("pending") - PENDING("pending"), - - @SerializedName("registered") - REGISTERED("registered"), - - @SerializedName("starting") - STARTING("starting"), - - @SerializedName("unregistered") - UNREGISTERED("unregistered"); - - private String value; - - DeploymentStatusEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("DeploymentStatus") - private DeploymentStatusEnum deploymentStatus = null; - - /** - * Gets or Sets imageAspectRatio - */ - public enum ImageAspectRatioEnum { - @SerializedName("horizontal") - HORIZONTAL("horizontal"), - - @SerializedName("square") - SQUARE("square"); - - private String value; - - ImageAspectRatioEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("ImageAspectRatio") - private ImageAspectRatioEnum imageAspectRatio = null; - - /** - * Gets or Sets integrationStatus - */ - public enum IntegrationStatusEnum { - @SerializedName("active") - ACTIVE("active"), - - @SerializedName("inactive") - INACTIVE("inactive"), - - @SerializedName("error") - ERROR("error"); - - private String value; - - IntegrationStatusEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("IntegrationStatus") - private IntegrationStatusEnum integrationStatus = null; - - /** - * Gets or Sets integrationType - */ - public enum IntegrationTypeEnum { - @SerializedName("android") - ANDROID("android"), - - @SerializedName("api") - API("api"), - - @SerializedName("apn") - APN("apn"), - - @SerializedName("fcm") - FCM("fcm"), - - @SerializedName("ios") - IOS("ios"), - - @SerializedName("line") - LINE("line"), - - @SerializedName("mailgun") - MAILGUN("mailgun"), - - @SerializedName("messagebird") - MESSAGEBIRD("messagebird"), - - @SerializedName("messenger") - MESSENGER("messenger"), - - @SerializedName("telegram") - TELEGRAM("telegram"), - - @SerializedName("twilio") - TWILIO("twilio"), - - @SerializedName("twitter") - TWITTER("twitter"), - - @SerializedName("viber") - VIBER("viber"), - - @SerializedName("web") - WEB("web"), - - @SerializedName("wechat") - WECHAT("wechat"), - - @SerializedName("whatsapp") - WHATSAPP("whatsapp"); - - private String value; - - IntegrationTypeEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("IntegrationType") - private IntegrationTypeEnum integrationType = null; - - /** - * Gets or Sets menuItemType - */ - public enum MenuItemTypeEnum { - @SerializedName("link") - LINK("link"), - - @SerializedName("postback") - POSTBACK("postback"), - - @SerializedName("submenu") - SUBMENU("submenu"); - - private String value; - - MenuItemTypeEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("MenuItemType") - private MenuItemTypeEnum menuItemType = null; - - /** - * Gets or Sets messageItemSize - */ - public enum MessageItemSizeEnum { - @SerializedName("compact") - COMPACT("compact"), - - @SerializedName("large") - LARGE("large"); - - private String value; - - MessageItemSizeEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("MessageItemSize") - private MessageItemSizeEnum messageItemSize = null; - - /** - * Gets or Sets messageType - */ - public enum MessageTypeEnum { - @SerializedName("carousel") - CAROUSEL("carousel"), - - @SerializedName("file") - FILE("file"), - - @SerializedName("image") - IMAGE("image"), - - @SerializedName("list") - LIST("list"), - - @SerializedName("location") - LOCATION("location"), - - @SerializedName("text") - TEXT("text"), - - @SerializedName("form") - FORM("form"), - - @SerializedName("formResponse") - FORMRESPONSE("formResponse"); - - private String value; - - MessageTypeEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("MessageType") - private MessageTypeEnum messageType = null; - - /** - * Gets or Sets fieldType - */ - public enum FieldTypeEnum { - @SerializedName("text") - TEXT("text"), - - @SerializedName("email") - EMAIL("email"), - - @SerializedName("select") - SELECT("select"); - - private String value; - - FieldTypeEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("FieldType") - private FieldTypeEnum fieldType = null; - - /** - * Gets or Sets quotedMessageType - */ - public enum QuotedMessageTypeEnum { - @SerializedName("message") - MESSAGE("message"), - - @SerializedName("externalMessageId") - EXTERNALMESSAGEID("externalMessageId"); - - private String value; - - QuotedMessageTypeEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("QuotedMessageType") - private QuotedMessageTypeEnum quotedMessageType = null; - - /** - * Gets or Sets role - */ - public enum RoleEnum { - @SerializedName("appMaker") - APPMAKER("appMaker"), - - @SerializedName("appUser") - APPUSER("appUser"); - - private String value; - - RoleEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("Role") - private RoleEnum role = null; - - /** - * Gets or Sets webhookTriggers - */ - public enum WebhookTriggersEnum { - @SerializedName("appUser:delete") - APPUSER_DELETE("appUser:delete"), - - @SerializedName("client:add") - CLIENT_ADD("client:add"), - - @SerializedName("client:remove") - CLIENT_REMOVE("client:remove"), - - @SerializedName("conversation:read") - CONVERSATION_READ("conversation:read"), - - @SerializedName("conversation:referral") - CONVERSATION_REFERRAL("conversation:referral"), - - @SerializedName("conversation:start") - CONVERSATION_START("conversation:start"), - - @SerializedName("link:failure") - LINK_FAILURE("link:failure"), - - @SerializedName("link:match") - LINK_MATCH("link:match"), - - @SerializedName("link:success") - LINK_SUCCESS("link:success"), - - @SerializedName("merge:appUser") - MERGE_APPUSER("merge:appUser"), - - @SerializedName("message:appMaker") - MESSAGE_APPMAKER("message:appMaker"), - - @SerializedName("message:appUser") - MESSAGE_APPUSER("message:appUser"), - - @SerializedName("message:delivery:channel") - MESSAGE_DELIVERY_CHANNEL("message:delivery:channel"), - - @SerializedName("message:delivery:failure") - MESSAGE_DELIVERY_FAILURE("message:delivery:failure"), - - @SerializedName("message:delivery:user") - MESSAGE_DELIVERY_USER("message:delivery:user"), - - @SerializedName("notification:delivery:channel") - NOTIFICATION_DELIVERY_CHANNEL("notification:delivery:channel"), - - @SerializedName("notification:delivery:failure") - NOTIFICATION_DELIVERY_FAILURE("notification:delivery:failure"), - - @SerializedName("notification:delivery:user") - NOTIFICATION_DELIVERY_USER("notification:delivery:user"), - - @SerializedName("payment:success") - PAYMENT_SUCCESS("payment:success"), - - @SerializedName("postback") - POSTBACK("postback"), - - @SerializedName("typing:appUser") - TYPING_APPUSER("typing:appUser"); - - private String value; - - WebhookTriggersEnum(String value) { - this.value = value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - } - - @SerializedName("WebhookTriggers") - private WebhookTriggersEnum webhookTriggers = null; - - public Enums actionSize(ActionSizeEnum actionSize) { - this.actionSize = actionSize; - return this; - } - - /** - * Get actionSize - * @return actionSize - **/ - @ApiModelProperty(value = "") - public ActionSizeEnum getActionSize() { - return actionSize; - } - - public void setActionSize(ActionSizeEnum actionSize) { - this.actionSize = actionSize; - } - - public Enums actionType(ActionTypeEnum actionType) { - this.actionType = actionType; - return this; - } - - /** - * Get actionType - * @return actionType - **/ - @ApiModelProperty(value = "") - public ActionTypeEnum getActionType() { - return actionType; - } - - public void setActionType(ActionTypeEnum actionType) { - this.actionType = actionType; - } - - public Enums businessSystemType(BusinessSystemTypeEnum businessSystemType) { - this.businessSystemType = businessSystemType; - return this; - } - - /** - * Get businessSystemType - * @return businessSystemType - **/ - @ApiModelProperty(value = "") - public BusinessSystemTypeEnum getBusinessSystemType() { - return businessSystemType; - } - - public void setBusinessSystemType(BusinessSystemTypeEnum businessSystemType) { - this.businessSystemType = businessSystemType; - } - - public Enums clientStatus(ClientStatusEnum clientStatus) { - this.clientStatus = clientStatus; - return this; - } - - /** - * Get clientStatus - * @return clientStatus - **/ - @ApiModelProperty(value = "") - public ClientStatusEnum getClientStatus() { - return clientStatus; - } - - public void setClientStatus(ClientStatusEnum clientStatus) { - this.clientStatus = clientStatus; - } - - public Enums confirmationType(ConfirmationTypeEnum confirmationType) { - this.confirmationType = confirmationType; - return this; - } - - /** - * Get confirmationType - * @return confirmationType - **/ - @ApiModelProperty(value = "") - public ConfirmationTypeEnum getConfirmationType() { - return confirmationType; - } - - public void setConfirmationType(ConfirmationTypeEnum confirmationType) { - this.confirmationType = confirmationType; - } - - public Enums conversationActivityType(ConversationActivityTypeEnum conversationActivityType) { - this.conversationActivityType = conversationActivityType; - return this; - } - - /** - * Get conversationActivityType - * @return conversationActivityType - **/ - @ApiModelProperty(value = "") - public ConversationActivityTypeEnum getConversationActivityType() { - return conversationActivityType; - } - - public void setConversationActivityType(ConversationActivityTypeEnum conversationActivityType) { - this.conversationActivityType = conversationActivityType; - } - - public Enums deploymentActivationMethod(DeploymentActivationMethodEnum deploymentActivationMethod) { - this.deploymentActivationMethod = deploymentActivationMethod; - return this; - } - - /** - * Get deploymentActivationMethod - * @return deploymentActivationMethod - **/ - @ApiModelProperty(value = "") - public DeploymentActivationMethodEnum getDeploymentActivationMethod() { - return deploymentActivationMethod; - } - - public void setDeploymentActivationMethod(DeploymentActivationMethodEnum deploymentActivationMethod) { - this.deploymentActivationMethod = deploymentActivationMethod; - } - - public Enums deploymentHosting(DeploymentHostingEnum deploymentHosting) { - this.deploymentHosting = deploymentHosting; - return this; - } - - /** - * Get deploymentHosting - * @return deploymentHosting - **/ - @ApiModelProperty(value = "") - public DeploymentHostingEnum getDeploymentHosting() { - return deploymentHosting; - } - - public void setDeploymentHosting(DeploymentHostingEnum deploymentHosting) { - this.deploymentHosting = deploymentHosting; - } - - public Enums deploymentStatus(DeploymentStatusEnum deploymentStatus) { - this.deploymentStatus = deploymentStatus; - return this; - } - - /** - * Get deploymentStatus - * @return deploymentStatus - **/ - @ApiModelProperty(value = "") - public DeploymentStatusEnum getDeploymentStatus() { - return deploymentStatus; - } - - public void setDeploymentStatus(DeploymentStatusEnum deploymentStatus) { - this.deploymentStatus = deploymentStatus; - } - - public Enums imageAspectRatio(ImageAspectRatioEnum imageAspectRatio) { - this.imageAspectRatio = imageAspectRatio; - return this; - } - - /** - * Get imageAspectRatio - * @return imageAspectRatio - **/ - @ApiModelProperty(value = "") - public ImageAspectRatioEnum getImageAspectRatio() { - return imageAspectRatio; - } - - public void setImageAspectRatio(ImageAspectRatioEnum imageAspectRatio) { - this.imageAspectRatio = imageAspectRatio; - } - - public Enums integrationStatus(IntegrationStatusEnum integrationStatus) { - this.integrationStatus = integrationStatus; - return this; - } - - /** - * Get integrationStatus - * @return integrationStatus - **/ - @ApiModelProperty(value = "") - public IntegrationStatusEnum getIntegrationStatus() { - return integrationStatus; - } - - public void setIntegrationStatus(IntegrationStatusEnum integrationStatus) { - this.integrationStatus = integrationStatus; - } - - public Enums integrationType(IntegrationTypeEnum integrationType) { - this.integrationType = integrationType; - return this; - } - - /** - * Get integrationType - * @return integrationType - **/ - @ApiModelProperty(value = "") - public IntegrationTypeEnum getIntegrationType() { - return integrationType; - } - - public void setIntegrationType(IntegrationTypeEnum integrationType) { - this.integrationType = integrationType; - } - - public Enums menuItemType(MenuItemTypeEnum menuItemType) { - this.menuItemType = menuItemType; - return this; - } - - /** - * Get menuItemType - * @return menuItemType - **/ - @ApiModelProperty(value = "") - public MenuItemTypeEnum getMenuItemType() { - return menuItemType; - } - - public void setMenuItemType(MenuItemTypeEnum menuItemType) { - this.menuItemType = menuItemType; - } - - public Enums messageItemSize(MessageItemSizeEnum messageItemSize) { - this.messageItemSize = messageItemSize; - return this; - } - - /** - * Get messageItemSize - * @return messageItemSize - **/ - @ApiModelProperty(value = "") - public MessageItemSizeEnum getMessageItemSize() { - return messageItemSize; - } - - public void setMessageItemSize(MessageItemSizeEnum messageItemSize) { - this.messageItemSize = messageItemSize; - } - - public Enums messageType(MessageTypeEnum messageType) { - this.messageType = messageType; - return this; - } - - /** - * Get messageType - * @return messageType - **/ - @ApiModelProperty(value = "") - public MessageTypeEnum getMessageType() { - return messageType; - } - - public void setMessageType(MessageTypeEnum messageType) { - this.messageType = messageType; - } - - public Enums fieldType(FieldTypeEnum fieldType) { - this.fieldType = fieldType; - return this; - } - - /** - * Get fieldType - * @return fieldType - **/ - @ApiModelProperty(value = "") - public FieldTypeEnum getFieldType() { - return fieldType; - } - - public void setFieldType(FieldTypeEnum fieldType) { - this.fieldType = fieldType; - } - - public Enums quotedMessageType(QuotedMessageTypeEnum quotedMessageType) { - this.quotedMessageType = quotedMessageType; - return this; - } - - /** - * Get quotedMessageType - * @return quotedMessageType - **/ - @ApiModelProperty(value = "") - public QuotedMessageTypeEnum getQuotedMessageType() { - return quotedMessageType; - } - - public void setQuotedMessageType(QuotedMessageTypeEnum quotedMessageType) { - this.quotedMessageType = quotedMessageType; - } - - public Enums role(RoleEnum role) { - this.role = role; - return this; - } - - /** - * Get role - * @return role - **/ - @ApiModelProperty(value = "") - public RoleEnum getRole() { - return role; - } - - public void setRole(RoleEnum role) { - this.role = role; - } - - public Enums webhookTriggers(WebhookTriggersEnum webhookTriggers) { - this.webhookTriggers = webhookTriggers; - return this; - } - - /** - * Get webhookTriggers - * @return webhookTriggers - **/ - @ApiModelProperty(value = "") - public WebhookTriggersEnum getWebhookTriggers() { - return webhookTriggers; - } - - public void setWebhookTriggers(WebhookTriggersEnum webhookTriggers) { - this.webhookTriggers = webhookTriggers; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Enums enums = (Enums) o; - return Objects.equals(this.actionSize, enums.actionSize) && - Objects.equals(this.actionType, enums.actionType) && - Objects.equals(this.businessSystemType, enums.businessSystemType) && - Objects.equals(this.clientStatus, enums.clientStatus) && - Objects.equals(this.confirmationType, enums.confirmationType) && - Objects.equals(this.conversationActivityType, enums.conversationActivityType) && - Objects.equals(this.deploymentActivationMethod, enums.deploymentActivationMethod) && - Objects.equals(this.deploymentHosting, enums.deploymentHosting) && - Objects.equals(this.deploymentStatus, enums.deploymentStatus) && - Objects.equals(this.imageAspectRatio, enums.imageAspectRatio) && - Objects.equals(this.integrationStatus, enums.integrationStatus) && - Objects.equals(this.integrationType, enums.integrationType) && - Objects.equals(this.menuItemType, enums.menuItemType) && - Objects.equals(this.messageItemSize, enums.messageItemSize) && - Objects.equals(this.messageType, enums.messageType) && - Objects.equals(this.fieldType, enums.fieldType) && - Objects.equals(this.quotedMessageType, enums.quotedMessageType) && - Objects.equals(this.role, enums.role) && - Objects.equals(this.webhookTriggers, enums.webhookTriggers); - } - - @Override - public int hashCode() { - return Objects.hash(actionSize, actionType, businessSystemType, clientStatus, confirmationType, conversationActivityType, deploymentActivationMethod, deploymentHosting, deploymentStatus, imageAspectRatio, integrationStatus, integrationType, menuItemType, messageItemSize, messageType, fieldType, quotedMessageType, role, webhookTriggers); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Enums {\n"); - - sb.append(" actionSize: ").append(toIndentedString(actionSize)).append("\n"); - sb.append(" actionType: ").append(toIndentedString(actionType)).append("\n"); - sb.append(" businessSystemType: ").append(toIndentedString(businessSystemType)).append("\n"); - sb.append(" clientStatus: ").append(toIndentedString(clientStatus)).append("\n"); - sb.append(" confirmationType: ").append(toIndentedString(confirmationType)).append("\n"); - sb.append(" conversationActivityType: ").append(toIndentedString(conversationActivityType)).append("\n"); - sb.append(" deploymentActivationMethod: ").append(toIndentedString(deploymentActivationMethod)).append("\n"); - sb.append(" deploymentHosting: ").append(toIndentedString(deploymentHosting)).append("\n"); - sb.append(" deploymentStatus: ").append(toIndentedString(deploymentStatus)).append("\n"); - sb.append(" imageAspectRatio: ").append(toIndentedString(imageAspectRatio)).append("\n"); - sb.append(" integrationStatus: ").append(toIndentedString(integrationStatus)).append("\n"); - sb.append(" integrationType: ").append(toIndentedString(integrationType)).append("\n"); - sb.append(" menuItemType: ").append(toIndentedString(menuItemType)).append("\n"); - sb.append(" messageItemSize: ").append(toIndentedString(messageItemSize)).append("\n"); - sb.append(" messageType: ").append(toIndentedString(messageType)).append("\n"); - sb.append(" fieldType: ").append(toIndentedString(fieldType)).append("\n"); - sb.append(" quotedMessageType: ").append(toIndentedString(quotedMessageType)).append("\n"); - sb.append(" role: ").append(toIndentedString(role)).append("\n"); - sb.append(" webhookTriggers: ").append(toIndentedString(webhookTriggers)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/io/smooch/client/model/Field.java b/src/main/java/io/smooch/client/model/Field.java deleted file mode 100644 index 6b61cc80..00000000 --- a/src/main/java/io/smooch/client/model/Field.java +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Smooch - * The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). - * - * OpenAPI spec version: 5.29 - * - * - * NOTE: This class is auto generated by the swagger code generator program. - * https://github.com/swagger-api/swagger-codegen.git - * Do not edit the class manually. - */ - - -package io.smooch.client.model; - -import java.util.Objects; -import com.google.gson.annotations.SerializedName; -import io.smooch.client.model.Option; -import io.smooch.client.model.Select; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; -import java.util.List; - -/** - * Field - */ - -public class Field { - @SerializedName("_id") - private String id = null; - - @SerializedName("type") - private String type = null; - - @SerializedName("name") - private String name = null; - - @SerializedName("label") - private String label = null; - - @SerializedName("placeholder") - private String placeholder = null; - - @SerializedName("minSize") - private Integer minSize = null; - - @SerializedName("maxSize") - private Integer maxSize = null; - - @SerializedName("options") - private List