Coder Social home page Coder Social logo

rubydirectlineclient's Introduction

swagger_client

SwaggerClient - the Ruby gem for the Bot Connector - Direct Line API - V1.0

Direct Line =========== The Direct Line API is a simple REST API for connecting directly to a single bot. This API is intended for developers writing their own client applications, web chat controls, or mobile apps that will talk to their bot. Credentials for the Direct Line API may be obtained from the Bot Framework developer portal, and will only allow the caller to connect to the bot for which they were generated. If you are writing a server-to-server application, the Direct Line secret may be used directly against the API. If instead you are writing an application where a client connects directly (and possibly insecurely) to the Direct Line API, you may exchange the secret for a token that will work only for a single conversation and only for a limited amount of time. Tokens expire by default after 30 minutes although they may be renewed up until their expiration. The secret or token (depending on the authorization model) are supplied as basic auth with the "BotConnector" scheme and no further encoding. Example auth header: -- connect to directline.botframework.com -- GET /api/tokens Authorization: BotConnector RCurR_XV9ZA.cwA.BKA.iaJrC8xpy8qbOF5xnR2vtCX7CZj0LdjAPGfiCpg4Fv0 Don't include the Ocp-Apim-Subscription-Key header. The contents of this header are your bot's secret key. The bot's secret key is not necessary when using the Direct Line API. Each conversation on the Direct Line channel must be explicitly started using a POST to the https://directline.botframework.com/api/conversations endpoint. If the call was authorized with a token, the conversation ID is the conversation ID in the scoped token. If a secret was used to start the conversation, the conversation will be started with a new, random ID. The client may send messages to the bot by calling POST on https://directline.botframework.com/api/conversations/{conversationId}/messages. The client may retrieve messages sent by the bot by calling GET on https://directline.botframework.com/api/conversations/{conversationId}/messages. The JSON structure returned contains a watermark that can be sent on subsequent requests to skip old messages. The Direct Line API does not store messages indefinitely. Your client application must pick them up quickly before they are deleted. # Client libraries for the Direct Line API * Direct Line Nuget package * Generate your own from the Direct Line Swagger file

This SDK is automatically generated by the Swagger Codegen project:

  • API version: v1
  • Package version: 1.0.0
  • Build date: 2016-08-10T09:20:22.973Z
  • Build package: class io.swagger.codegen.languages.RubyClientCodegen For more information, please visit https://botframework.com

Installation

Build a gem

To build the Ruby code into a gem:

gem build swagger_client.gemspec

Then either install the gem locally:

gem install ./swagger_client-1.0.0.gem

(for development, run gem install --dev ./swagger_client-1.0.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'swagger_client', '~> 1.0.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/YOUR_GIT_USERNAME/YOUR_GIT_REPO, then add the following in the Gemfile:

gem 'swagger_client', :git => 'https://github.com/YOUR_GIT_USERNAME/YOUR_GIT_REPO.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'swagger_client'

api_instance = SwaggerClient::ConversationsApi.new

conversation_id = "conversation_id_example" # String | Conversation ID

opts = { 
  watermark: "watermark_example" # String | (Optional) only returns messages newer than this watermark
}

begin
  #Get messages in this conversation. This method is paged with the 'watermark' parameter.
  result = api_instance.conversations_get_messages(conversation_id, opts)
  p result
rescue SwaggerClient::ApiError => e
  puts "Exception when calling ConversationsApi->conversations_get_messages: #{e}"
end

Documentation for API Endpoints

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

Class Method HTTP request Description
SwaggerClient::ConversationsApi conversations_get_messages GET /api/conversations/{conversationId}/messages Get messages in this conversation. This method is paged with the 'watermark' parameter.
SwaggerClient::ConversationsApi conversations_new_conversation POST /api/conversations Start a new conversation
SwaggerClient::ConversationsApi conversations_post_message POST /api/conversations/{conversationId}/messages Send a message
SwaggerClient::ConversationsApi conversations_upload POST /api/conversations/{conversationId}/upload Upload file(s) and send as attachment(s)
SwaggerClient::TokensApi tokens_generate_token_for_new_conversation POST /api/tokens/conversation Generate a token for a new conversation
SwaggerClient::TokensApi tokens_renew_token GET /api/tokens/{conversationId}/renew Renew a token for a conversation

Documentation for Models

Documentation for Authorization

basic

  • Type: HTTP basic authentication

rubydirectlineclient's People

Watchers

bluenoah1991 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.