Skip to content

Latest commit

 

History

History
526 lines (467 loc) · 30.7 KB

README.md

File metadata and controls

526 lines (467 loc) · 30.7 KB

sunshine-conversations-java

The Java package for the Sunshine Conversations API

This SDK is automatically generated by the OpenAPI Generator Codegen project using the Sunshine Conversations API spec.

Sunshine Conversations API Version

The Sunshine Conversations API offers multiple versions. 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:

Sunshine Conversations API version zendesk/sunshine-conversations-java version to use
v2 Implementation guide 9.* or newer
v1.1 Upgrade guide 4.* or 5.*
v1 3.* or older

Installation

Maven users

Add the following remote repo to your project's POM:

<project ...>
<repositories>
    <repository>
      <id>zendesk-sunshine-conversations</id>
      <url>https://smoochorg.bintray.com/maven/</url>
    </repository>
 </repositories>
</project>

Add this dependency to your project's POM:

<dependency>
    <groupId>com.zendesk</groupId>
    <artifactId>sunshine-conversations-client</artifactId>
    <version>12.4.0</version>
    <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "com.zendesk:sunshine-conversations-client:12.4.0"

Getting Started

Familiarity with Sunshine Conversations API authentication is recommended.

Basic Authentication (recommended)

With basic authentication, you can use your API key ID and secret to authenticate API requests. See below for a code sample.

Authentication with JSON Web Tokens (JWTs)

See the JSON Web Tokens (JWTs) guide for more information and guidelines on when to use this method. In general, you'll want to favor using basic authentication.

To generate a JWT, use your API key ID and secret.

Using the jjwt package:

import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.impl.crypto.MacProvider;
import io.jsonwebtoken.security.Keys;

import static io.jsonwebtoken.JwsHeader.KEY_ID;

// ...

String jwt = Jwts.builder()
    .claim("scope", "app")
    .setHeaderParam(KEY_ID, "YOUR_KEY_ID")
    .signWith(
        Keys.hmacShaKeyFor("YOUR_SECRET".getBytes()),
        SignatureAlgorithm.HS256
    )
    .compact();

Running the code

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 ActivitiesApiExample {

    public static void main(String[] args) {
        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");

        // Configure HTTP basic authorization (recommended): bearerAuth
        HttpBasicAuth bearerAuth = (HttpBasicAuth) defaultClient.getAuthentication("bearerAuth");
        bearerAuth.setUsername("API_KEY_ID");
        bearerAuth.setPassword("API_KEY_SECRET");

        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 {
            Object result = apiInstance.postActivity(activityPost, appId, conversationId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ActivitiesApi#postActivity");
            e.printStackTrace();
        }
    }
}

Region

Smooch is available in the following regions. The US region will be used by default. To target any other region, specify the region API host in setBasePath(). For example:

defaultClient.setBasePath("https://api.eu-1.smooch.io");

Documentation for API Endpoints

All URIs are relative to https://api.smooch.io

Class Method HTTP request Description
ActivitiesApi postActivity POST /v2/apps/{appId}/conversations/{conversationId}/activity Post Activity
AppKeysApi createAppKey POST /v2/apps/{appId}/keys Create App Key
AppKeysApi deleteAppKey DELETE /v2/apps/{appId}/keys/{keyId} Delete App Key
AppKeysApi getAppKey GET /v2/apps/{appId}/keys/{keyId} Get App Key
AppKeysApi listAppKeys GET /v2/apps/{appId}/keys List App Keys
AppsApi createApp POST /v2/apps Create App
AppsApi deleteApp DELETE /v2/apps/{appId} Delete App
AppsApi getApp GET /v2/apps/{appId} Get App
AppsApi listApps GET /v2/apps List Apps
AppsApi updateApp PATCH /v2/apps/{appId} Update App
AttachmentsApi deleteAttachment POST /v2/apps/{appId}/attachments/remove Delete Attachment
AttachmentsApi generateMediaJsonWebToken POST /v2/apps/{appId}/attachments/token Generate Media Token
AttachmentsApi setCookie GET /v2/apps/{appId}/attachments/cookie Set Cookie
AttachmentsApi uploadAttachment POST /v2/apps/{appId}/attachments Upload Attachment
ClientsApi createClient POST /v2/apps/{appId}/users/{userIdOrExternalId}/clients Create Client
ClientsApi listClients GET /v2/apps/{appId}/users/{userIdOrExternalId}/clients List Clients
ClientsApi removeClient DELETE /v2/apps/{appId}/users/{userIdOrExternalId}/clients/{clientId} Remove Client
ConversationsApi createConversation POST /v2/apps/{appId}/conversations Create Conversation
ConversationsApi deleteConversation DELETE /v2/apps/{appId}/conversations/{conversationId} Delete Conversation
ConversationsApi getConversation GET /v2/apps/{appId}/conversations/{conversationId} Get Conversation
ConversationsApi listConversations GET /v2/apps/{appId}/conversations List Conversations
ConversationsApi updateConversation PATCH /v2/apps/{appId}/conversations/{conversationId} Update Conversation
CustomIntegrationApiKeysApi createCustomIntegrationKey POST /v2/apps/{appId}/integrations/{integrationId}/keys Create Integration Key
CustomIntegrationApiKeysApi deleteCustomIntegrationKey DELETE /v2/apps/{appId}/integrations/{integrationId}/keys/{keyId} Delete Integration Key
CustomIntegrationApiKeysApi getCustomIntegrationKey GET /v2/apps/{appId}/integrations/{integrationId}/keys/{keyId} Get Integration Key
CustomIntegrationApiKeysApi listCustomIntegrationKeys GET /v2/apps/{appId}/integrations/{integrationId}/keys List Integration Keys
IntegrationsApi createIntegration POST /v2/apps/{appId}/integrations Create Integration
IntegrationsApi deleteIntegration DELETE /v2/apps/{appId}/integrations/{integrationId} Delete Integration
IntegrationsApi getIntegration GET /v2/apps/{appId}/integrations/{integrationId} Get Integration
IntegrationsApi listIntegrations GET /v2/apps/{appId}/integrations List Integrations
IntegrationsApi updateIntegration PATCH /v2/apps/{appId}/integrations/{integrationId} Update Integration
MessagesApi deleteAllMessages DELETE /v2/apps/{appId}/conversations/{conversationId}/messages Delete All Messages
MessagesApi deleteMessage DELETE /v2/apps/{appId}/conversations/{conversationId}/messages/{messageId} Delete Message
MessagesApi listMessages GET /v2/apps/{appId}/conversations/{conversationId}/messages List Messages
MessagesApi postMessage POST /v2/apps/{appId}/conversations/{conversationId}/messages Post Message
OAuthEndpointsApi authorize GET /oauth/authorize Authorize
OAuthEndpointsApi getToken POST /oauth/token Get Token
OAuthEndpointsApi revokeAccess DELETE /oauth/authorization Revoke Access
ParticipantsApi joinConversation POST /v2/apps/{appId}/conversations/{conversationId}/join Join Conversation
ParticipantsApi leaveConversation POST /v2/apps/{appId}/conversations/{conversationId}/leave Leave Conversation
ParticipantsApi listParticipants GET /v2/apps/{appId}/conversations/{conversationId}/participants List Participants
SwitchboardActionsApi acceptControl POST /v2/apps/{appId}/conversations/{conversationId}/acceptControl Accept Control
SwitchboardActionsApi offerControl POST /v2/apps/{appId}/conversations/{conversationId}/offerControl Offer Control
SwitchboardActionsApi passControl POST /v2/apps/{appId}/conversations/{conversationId}/passControl Pass Control
SwitchboardActionsApi releaseControl POST /v2/apps/{appId}/conversations/{conversationId}/releaseControl Release Control
SwitchboardIntegrationsApi createSwitchboardIntegration POST /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations Create Switchboard Integration
SwitchboardIntegrationsApi deleteSwitchboardIntegration DELETE /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations/{switchboardIntegrationId} Delete Switchboard Integration
SwitchboardIntegrationsApi listSwitchboardIntegrations GET /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations List Switchboard Integrations
SwitchboardIntegrationsApi updateSwitchboardIntegration PATCH /v2/apps/{appId}/switchboards/{switchboardId}/switchboardIntegrations/{switchboardIntegrationId} Update Switchboard Integration
SwitchboardsApi createSwitchboard POST /v2/apps/{appId}/switchboards Create Switchboard
SwitchboardsApi deleteSwitchboard DELETE /v2/apps/{appId}/switchboards/{switchboardId} Delete Switchboard
SwitchboardsApi listSwitchboards GET /v2/apps/{appId}/switchboards List Switchboards
SwitchboardsApi updateSwitchboard PATCH /v2/apps/{appId}/switchboards/{switchboardId} Update Switchboard
UsersApi createUser POST /v2/apps/{appId}/users Create User
UsersApi deleteUser DELETE /v2/apps/{appId}/users/{userIdOrExternalId} Delete User
UsersApi deleteUserPersonalInformation DELETE /v2/apps/{appId}/users/{userIdOrExternalId}/personalinformation Delete User Personal Information
UsersApi getUser GET /v2/apps/{appId}/users/{userIdOrExternalId} Get User
UsersApi updateUser PATCH /v2/apps/{appId}/users/{userIdOrExternalId} Update User
WebhooksApi createWebhook POST /v2/apps/{appId}/integrations/{integrationId}/webhooks Create Webhook
WebhooksApi deleteWebhook DELETE /v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId} Delete Webhook
WebhooksApi getWebhook GET /v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId} Get Webhook
WebhooksApi listWebhooks GET /v2/apps/{appId}/integrations/{integrationId}/webhooks List Webhooks
WebhooksApi updateWebhook PATCH /v2/apps/{appId}/integrations/{integrationId}/webhooks/{webhookId} Update Webhook

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

basicAuth

  • Type: HTTP basic authentication

bearerAuth

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

Copyright 2018 Zendesk, Inc.

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

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.