Skip to content

ahilton/v3-bot-client

Repository files navigation

v3-bot-client

  ____              _       _           _   _
 |  _ \            | |     | |         | | | |
 | |_) | __ _ _ __ | | __  | |_ ___    | |_| |__   ___
 |  _ < / _` | '_ \| |/ /  | __/ _ \   | __| '_ \ / _ \
 | |_) | (_| | | | |   <   | || (_) |  | |_| | | |  __/
 |____/ \__,_|_| |_|_|\_\   \__\___/    \__|_| |_|\___|
      __
      \ \        ________  __________  ______  ______
  _____\ \      / ____/ / / /_  __/ / / / __ \/ ____/
 |______> >    / /_  / / / / / / / / / / /_/ / __/
       / /    / __/ / /_/ / / / / /_/ / _, _/ /__
      /_/    /_/    \____/ /_/  \____/_/ |_/_____/

                               - Hackathon 2017 -

Background

Implements MS Bot v3 rest api via swagger codegen:

java -jar /swagger-codegen-cli-2.2.1.jar generate -i https://docs.botframework.com/en-us/restapi/directline3/swagger.json -l java --library okhttp-gson -c java-config.json -o v3client-okhttp

Config:

{
  "modelPackage" : "org.bttf.v3client.model",
  "apiPackage"   : "org.bttf.v3client.api",
  "invokerPackage" : "org.bttf.v3client",
  "groupId" : "org.bttf.v3",
  "artifactId"  : "v3client",
  "dateLibrary" : "java8"
}

Requirements

Building the API client library requires Maven to be installed.

Installation

To install the API client library to your local Maven repository, simply execute:

mvn install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn deploy

Refer to the official documentation for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
    <groupId>org.bttf.v3</groupId>
    <artifactId>v3-bot-client</artifactId>
    <version>1.0.0</version>
    <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "org.bttf.v3:v3-bot-client:1.0.0"

Others

At first generate the JAR by executing:

mvn package

Then manually install the following JARs:

  • target/v3-bot-client-1.0.0.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

import org.bttf.v3client.*;
import org.bttf.v3client.auth.*;
import org.bttf.v3client.model.*;
import org.bttf.v3client.api.ConversationsApi;

import java.io.File;
import java.util.*;

public class ConversationsApiExample {

    public static void main(String[] args) {
        
        ConversationsApi apiInstance = new ConversationsApi();
        String conversationId = "conversationId_example"; // String | Conversation ID
        String watermark = "watermark_example"; // String | (Optional) only returns activities newer than this watermark
        try {
            ActivitySet result = apiInstance.conversationsGetActivities(conversationId, watermark);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ConversationsApi#conversationsGetActivities");
            e.printStackTrace();
        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://directline.botframework.com

Class Method HTTP request Description
ConversationsApi conversationsGetActivities GET /v3/directline/conversations/{conversationId}/activities Get activities in this conversation. This method is paged with the 'watermark' parameter.
ConversationsApi conversationsPostActivity POST /v3/directline/conversations/{conversationId}/activities Send an activity
ConversationsApi conversationsReconnectToConversation GET /v3/directline/conversations/{conversationId} Get information about an existing conversation
ConversationsApi conversationsStartConversation POST /v3/directline/conversations Start a new conversation
ConversationsApi conversationsUpload POST /v3/directline/conversations/{conversationId}/upload Upload file(s) and send as attachment(s)
TokensApi tokensGenerateTokenForNewConversation POST /v3/directline/tokens/generate Generate a token for a new conversation
TokensApi tokensRefreshToken POST /v3/directline/tokens/refresh Refresh a token

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization. Authentication schemes defined for the API:

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issue.

Author

botframework@microsoft.com

About

Implements MS Bot v3 rest api via swagger codegen

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages