From da9ceb8f0b08c9644cc8f819672d0eeeda5a9c20 Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Tue, 30 Jul 2019 07:58:02 -0500 Subject: [PATCH 01/12] Ignore .factorypath files --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9d6304e11..48a8d5082 100644 --- a/.gitignore +++ b/.gitignore @@ -53,4 +53,5 @@ target Thumbs.db # reduced pom files should not be included -dependency-reduced-pom.xml \ No newline at end of file +dependency-reduced-pom.xml +*.factorypath From 52e3a53ec2552d9968a2951e5d2217cf63656200 Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Tue, 30 Jul 2019 08:00:15 -0500 Subject: [PATCH 02/12] Revert "Ignore .factorypath files" This reverts commit da9ceb8f0b08c9644cc8f819672d0eeeda5a9c20. --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 48a8d5082..9d6304e11 100644 --- a/.gitignore +++ b/.gitignore @@ -53,5 +53,4 @@ target Thumbs.db # reduced pom files should not be included -dependency-reduced-pom.xml -*.factorypath +dependency-reduced-pom.xml \ No newline at end of file From b96294d51ae43c56d09e75cb4119b4cbf16f0729 Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Tue, 30 Jul 2019 08:03:02 -0500 Subject: [PATCH 03/12] Ignore .factorypath files --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9d6304e11..48a8d5082 100644 --- a/.gitignore +++ b/.gitignore @@ -53,4 +53,5 @@ target Thumbs.db # reduced pom files should not be included -dependency-reduced-pom.xml \ No newline at end of file +dependency-reduced-pom.xml +*.factorypath From b005dcf4ac15d6de9f6490405e2ee5719e41ae6d Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Tue, 30 Jul 2019 08:03:49 -0500 Subject: [PATCH 04/12] Commit test TranscriptMiddlewareTest fix --- .../com/microsoft/bot/builder/TranscriptMiddlewareTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java b/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java index 863f21098..832a7c03f 100644 --- a/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java +++ b/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java @@ -207,7 +207,7 @@ public void Transcript_LogUpdateActivities() throws InterruptedException, Execut .Send("update") .AssertReply("new response") .StartTest(); - Thread.sleep(500); + Thread.sleep(5000); PagedResult pagedResult = transcriptStore.GetTranscriptActivitiesAsync("test", conversationId[0]).join(); Assert.assertEquals(4, pagedResult.getItems().length); Assert.assertEquals("foo", ((Activity)pagedResult.getItems()[0]).text()); From cc99082d5ab3f09860138b027417f30a711b6358 Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Tue, 30 Jul 2019 08:28:20 -0500 Subject: [PATCH 05/12] Schema dependencies correction on pom.xml --- .gitignore | 2 ++ libraries/botbuilder-schema/pom.xml | 4 ++-- samples/bot-connector-sample/pom.xml | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 48a8d5082..a2fa067fb 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,5 @@ Thumbs.db # reduced pom files should not be included dependency-reduced-pom.xml *.factorypath +.vscode/settings.json +pom.xml.versionsBackup diff --git a/libraries/botbuilder-schema/pom.xml b/libraries/botbuilder-schema/pom.xml index eb5d7bfac..8751c97b1 100644 --- a/libraries/botbuilder-schema/pom.xml +++ b/libraries/botbuilder-schema/pom.xml @@ -64,12 +64,12 @@ joda-time joda-time - RELEASE + 2.10.3 org.apache.commons commons-lang3 - RELEASE + 3.9 compile diff --git a/samples/bot-connector-sample/pom.xml b/samples/bot-connector-sample/pom.xml index d4f7248cd..4df7b51c3 100644 --- a/samples/bot-connector-sample/pom.xml +++ b/samples/bot-connector-sample/pom.xml @@ -41,12 +41,12 @@ org.slf4j slf4j-api - LATEST + 1.7.26 org.slf4j slf4j-simple - LATEST + 1.7.26 com.microsoft.bot.schema From e5944af878a43422ef76acebad4288f3d4010d5a Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Tue, 30 Jul 2019 08:49:08 -0500 Subject: [PATCH 06/12] Removed .vscode\settings.json from repos --- .vscode/settings.json | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index c5f3f6b9c..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "java.configuration.updateBuildConfiguration": "interactive" -} \ No newline at end of file From 264d8429bec951478c00bd6b94de654b52e19cd9 Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Tue, 30 Jul 2019 09:33:04 -0500 Subject: [PATCH 07/12] Revert "Commit test TranscriptMiddlewareTest fix" This reverts commit b005dcf4ac15d6de9f6490405e2ee5719e41ae6d. --- .../com/microsoft/bot/builder/TranscriptMiddlewareTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java b/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java index 832a7c03f..863f21098 100644 --- a/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java +++ b/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java @@ -207,7 +207,7 @@ public void Transcript_LogUpdateActivities() throws InterruptedException, Execut .Send("update") .AssertReply("new response") .StartTest(); - Thread.sleep(5000); + Thread.sleep(500); PagedResult pagedResult = transcriptStore.GetTranscriptActivitiesAsync("test", conversationId[0]).join(); Assert.assertEquals(4, pagedResult.getItems().length); Assert.assertEquals("foo", ((Activity)pagedResult.getItems()[0]).text()); From 0291dd04cbf1ddb487b5ceffccbc9087817c6aaa Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Tue, 30 Jul 2019 10:19:01 -0500 Subject: [PATCH 08/12] Removed unused imports --- .../main/java/com/microsoft/bot/schema/ActivityImpl.java | 2 -- .../main/java/com/microsoft/bot/schema/TraceActivity.java | 1 - .../microsoft/bot/schema/models/ConversationAccount.java | 3 --- .../com/microsoft/bot/builder/DeleteActivityHandler.java | 3 --- .../src/main/java/com/microsoft/bot/builder/Middleware.java | 2 -- .../main/java/com/microsoft/bot/builder/MiddlewareCall.java | 2 -- .../main/java/com/microsoft/bot/builder/MiddlewareSet.java | 3 --- .../main/java/com/microsoft/bot/builder/NextDelegate.java | 2 -- .../com/microsoft/bot/builder/SendActivitiesHandler.java | 1 - .../com/microsoft/bot/builder/TraceTranscriptLogger.java | 1 - .../src/main/java/com/microsoft/bot/builder/Transcript.java | 2 -- .../java/com/microsoft/bot/builder/TranscriptLogger.java | 2 -- .../com/microsoft/bot/builder/UpdateActivityHandler.java | 1 - .../test/java/com/microsoft/bot/builder/BotStateTest.java | 4 ---- .../java/com/microsoft/bot/builder/DictionaryStorage.java | 1 - .../java/com/microsoft/bot/builder/MiddlewareSetTest.java | 5 ----- .../com/microsoft/bot/builder/TranscriptMiddlewareTest.java | 6 ------ .../java/com/microsoft/bot/builder/WasCalledMiddlware.java | 2 -- 18 files changed, 43 deletions(-) diff --git a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/ActivityImpl.java b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/ActivityImpl.java index f10dda109..756deb39d 100644 --- a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/ActivityImpl.java +++ b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/ActivityImpl.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.core.TreeNode; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; import com.microsoft.bot.schema.ContactRelationUpdateActivity; import com.microsoft.bot.schema.TraceActivity; import com.microsoft.bot.schema.models.*; @@ -17,7 +16,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; /** * An Activity is the basic communication type for the Bot Framework 3.0 protocol diff --git a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/TraceActivity.java b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/TraceActivity.java index 14e0e40b5..927a597ac 100644 --- a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/TraceActivity.java +++ b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/TraceActivity.java @@ -1,6 +1,5 @@ package com.microsoft.bot.schema; -import com.microsoft.bot.schema.models.Activity; import com.microsoft.bot.schema.models.ConversationReference; /** diff --git a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/models/ConversationAccount.java b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/models/ConversationAccount.java index c998270ad..46f83368c 100644 --- a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/models/ConversationAccount.java +++ b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/models/ConversationAccount.java @@ -7,13 +7,10 @@ package com.microsoft.bot.schema.models; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.JsonNode; import java.util.HashMap; -import java.util.Map; /** * Channel account information for a conversation. diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/DeleteActivityHandler.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/DeleteActivityHandler.java index 2847152a2..af7820ca7 100644 --- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/DeleteActivityHandler.java +++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/DeleteActivityHandler.java @@ -2,9 +2,6 @@ import com.microsoft.bot.schema.models.ConversationReference; -import java.util.concurrent.Callable; -import java.util.concurrent.CompletableFuture; - /** * A method that can participate in delete activity events for the current turn. * @param context The context object for the turn. diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Middleware.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Middleware.java index 8e952c17d..f76d47ed9 100644 --- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Middleware.java +++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Middleware.java @@ -2,8 +2,6 @@ // Licensed under the MIT License. package com.microsoft.bot.builder; -import java.util.concurrent.CompletableFuture; - /** * Represents middleware that can operate on incoming activities. * A {@link BotAdapter} passes incoming activities from the user's diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/MiddlewareCall.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/MiddlewareCall.java index eff1039a0..8ed161ca1 100644 --- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/MiddlewareCall.java +++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/MiddlewareCall.java @@ -1,7 +1,5 @@ package com.microsoft.bot.builder; -import java.util.concurrent.CompletableFuture; - @FunctionalInterface public interface MiddlewareCall { void requestHandler(TurnContext tc, NextDelegate nd) throws Exception; diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/MiddlewareSet.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/MiddlewareSet.java index 1466c0b97..d0414d7a8 100644 --- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/MiddlewareSet.java +++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/MiddlewareSet.java @@ -9,9 +9,6 @@ import java.util.concurrent.ExecutionException; import java.util.function.Consumer; -import static java.util.concurrent.CompletableFuture.completedFuture; - - public class MiddlewareSet implements Middleware { public NextDelegate Next; diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/NextDelegate.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/NextDelegate.java index 565812465..d665f4dfe 100644 --- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/NextDelegate.java +++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/NextDelegate.java @@ -1,7 +1,5 @@ package com.microsoft.bot.builder; -import java.util.concurrent.CompletableFuture; - @FunctionalInterface public interface NextDelegate { void next() throws Exception; diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/SendActivitiesHandler.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/SendActivitiesHandler.java index 66a22d160..b605b2f4e 100644 --- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/SendActivitiesHandler.java +++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/SendActivitiesHandler.java @@ -6,7 +6,6 @@ import java.util.List; import java.util.concurrent.Callable; -import java.util.concurrent.CompletableFuture; @FunctionalInterface public interface SendActivitiesHandler { diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/TraceTranscriptLogger.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/TraceTranscriptLogger.java index e4ce49333..5c884eed8 100644 --- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/TraceTranscriptLogger.java +++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/TraceTranscriptLogger.java @@ -12,7 +12,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinWorkerThread; diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Transcript.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Transcript.java index 6ae45f67c..0601a108d 100644 --- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Transcript.java +++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/Transcript.java @@ -4,8 +4,6 @@ // Licensed under the MIT License. -import org.joda.time.DateTime; - import java.time.OffsetDateTime; /** diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/TranscriptLogger.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/TranscriptLogger.java index 0264f41d0..fe13afa4b 100644 --- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/TranscriptLogger.java +++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/TranscriptLogger.java @@ -7,8 +7,6 @@ import com.microsoft.bot.schema.models.Activity; -import java.util.concurrent.CompletableFuture; - /** * Transcript logger stores activities for conversations for recall. */ diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/UpdateActivityHandler.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/UpdateActivityHandler.java index f9b9105cf..c8291dd32 100644 --- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/UpdateActivityHandler.java +++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/UpdateActivityHandler.java @@ -5,7 +5,6 @@ import com.microsoft.bot.schema.models.ResourceResponse; import java.util.concurrent.Callable; -import java.util.concurrent.CompletableFuture; /** * A method that can participate in update activity events for the current turn. diff --git a/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/BotStateTest.java b/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/BotStateTest.java index 3829391a9..f8849c659 100644 --- a/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/BotStateTest.java +++ b/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/BotStateTest.java @@ -18,14 +18,10 @@ import org.junit.Test; import java.util.UUID; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.function.Consumer; -import java.util.function.Function; -import static java.util.concurrent.CompletableFuture.completedFuture; - // [TestClass] // [TestCategory("State Management")] public class BotStateTest { diff --git a/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/DictionaryStorage.java b/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/DictionaryStorage.java index bae9f2415..697f42785 100644 --- a/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/DictionaryStorage.java +++ b/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/DictionaryStorage.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.bot.schema.models.Entity; import java.util.HashMap; import java.util.Map; diff --git a/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/MiddlewareSetTest.java b/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/MiddlewareSetTest.java index dd185245d..2c58b0d64 100644 --- a/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/MiddlewareSetTest.java +++ b/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/MiddlewareSetTest.java @@ -9,13 +9,8 @@ import org.junit.Assert; import org.junit.Test; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.function.Consumer; -import java.util.function.Function; - - -import static java.util.concurrent.CompletableFuture.completedFuture; // [TestCategory("Russian Doll Middleware, Nested Middleware sets")] diff --git a/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java b/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java index c09dddafb..080b1ccd9 100644 --- a/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java +++ b/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/TranscriptMiddlewareTest.java @@ -3,7 +3,6 @@ package com.microsoft.bot.builder; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.joda.JodaModule; import com.microsoft.bot.builder.adapters.TestAdapter; @@ -17,14 +16,9 @@ import org.junit.Assert; import org.junit.Test; -import java.util.ArrayList; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import static java.util.concurrent.CompletableFuture.completedFuture; - - public class TranscriptMiddlewareTest { @Test diff --git a/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/WasCalledMiddlware.java b/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/WasCalledMiddlware.java index 190aaf36f..a54b4e083 100644 --- a/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/WasCalledMiddlware.java +++ b/libraries/botbuilder/src/test/java/com/microsoft/bot/builder/WasCalledMiddlware.java @@ -1,7 +1,5 @@ package com.microsoft.bot.builder; -import java.util.concurrent.CompletableFuture; - public class WasCalledMiddlware implements Middleware { boolean called = false; public boolean getCalled() { From 10f72dc480dbdc115811a5183092ce7fedb9ffd9 Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Wed, 31 Jul 2019 16:39:21 -0500 Subject: [PATCH 09/12] Revert "Removing Swagger since we can't regen" This reverts commit bf21c3961460c711d1f86dfa5f81e7240efc019d. --- libraries/swagger/ConnectorAPI.json | 2439 ++++++++++++++++++++++++++ libraries/swagger/README.md | 4 +- libraries/swagger/generateClient.cmd | 17 + 3 files changed, 2457 insertions(+), 3 deletions(-) create mode 100644 libraries/swagger/ConnectorAPI.json create mode 100644 libraries/swagger/generateClient.cmd diff --git a/libraries/swagger/ConnectorAPI.json b/libraries/swagger/ConnectorAPI.json new file mode 100644 index 000000000..e64ba630a --- /dev/null +++ b/libraries/swagger/ConnectorAPI.json @@ -0,0 +1,2439 @@ +{ + "swagger": "2.0", + "info": { + "version": "v3", + "title": "Microsoft Bot Connector API - v3.0", + "description": "The Bot Connector REST API allows your bot to send and receive messages to channels configured in the\r\n[Bot Framework Developer Portal](https://dev.botframework.com). The Connector service uses industry-standard REST\r\nand JSON over HTTPS.\r\n\r\nClient libraries for this REST API are available. See below for a list.\r\n\r\nMany bots will use both the Bot Connector REST API and the associated [Bot State REST API](/en-us/restapi/state). The\r\nBot State REST API allows a bot to store and retrieve state associated with users and conversations.\r\n\r\nAuthentication for both the Bot Connector and Bot State REST APIs is accomplished with JWT Bearer tokens, and is\r\ndescribed in detail in the [Connector Authentication](/en-us/restapi/authentication) document.\r\n\r\n# Client Libraries for the Bot Connector REST API\r\n\r\n* [Bot Builder for C#](/en-us/csharp/builder/sdkreference/)\r\n* [Bot Builder for Node.js](/en-us/node/builder/overview/)\r\n* Generate your own from the [Connector API Swagger file](https://raw.githubusercontent.com/Microsoft/BotBuilder/master/CSharp/Library/Microsoft.Bot.Connector.Shared/Swagger/ConnectorAPI.json)\r\n\r\n© 2016 Microsoft", + "termsOfService": "https://www.microsoft.com/en-us/legal/intellectualproperty/copyright/default.aspx", + "contact": { + "name": "Bot Framework", + "url": "https://botframework.com", + "email": "botframework@microsoft.com" + }, + "license": { + "name": "The MIT License (MIT)", + "url": "https://opensource.org/licenses/MIT" + } + }, + "host": "api.botframework.com", + "schemes": [ + "https" + ], + "paths": { + "/v3/attachments/{attachmentId}": { + "get": { + "tags": [ + "Attachments" + ], + "summary": "GetAttachmentInfo", + "description": "Get AttachmentInfo structure describing the attachment views", + "operationId": "Attachments_GetAttachmentInfo", + "consumes": [ + + ], + "produces": [ + "application/json", + "text/json", + "application/xml", + "text/xml" + ], + "parameters": [ + { + "name": "attachmentId", + "in": "path", + "description": "attachment id", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "An attachmentInfo object is returned which describes the:\r\n* type of the attachment\r\n* name of the attachment\r\n\r\n\r\nand an array of views:\r\n* Size - size of the object\r\n* ViewId - View Id which can be used to fetch a variation on the content (ex: original or thumbnail)", + "schema": { + "$ref": "#/definitions/AttachmentInfo" + } + }, + "default": { + "description": "The operation failed and the response is an error object describing the status code and failure.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + } + } + }, + "/v3/attachments/{attachmentId}/views/{viewId}": { + "get": { + "tags": [ + "Attachments" + ], + "summary": "GetAttachment", + "description": "Get the named view as binary content", + "operationId": "Attachments_GetAttachment", + "consumes": [ + + ], + "produces": [ + "application/json", + "text/json", + "application/xml", + "text/xml" + ], + "parameters": [ + { + "name": "attachmentId", + "in": "path", + "description": "attachment id", + "required": true, + "type": "string" + }, + { + "name": "viewId", + "in": "path", + "description": "View id from attachmentInfo", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Attachment stream", + "schema": { + "format": "byte", + "type": "file" + } + }, + "301": { + "description": "The Location header describes where the content is now." + }, + "302": { + "description": "The Location header describes where the content is now." + }, + "default": { + "description": "The operation failed and the response is an error object describing the status code and failure.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + } + } + }, + "/v3/conversations": { + "get": { + "tags": [ + "Conversations" + ], + "summary": "GetConversations", + "description": "List the Conversations in which this bot has participated.\r\n\r\nGET from this method with a skip token\r\n\r\nThe return value is a ConversationsResult, which contains an array of ConversationMembers and a skip token. If the skip token is not empty, then \r\nthere are further values to be returned. Call this method again with the returned token to get more values.\r\n\r\nEach ConversationMembers object contains the ID of the conversation and an array of ChannelAccounts that describe the members of the conversation.", + "operationId": "Conversations_GetConversations", + "consumes": [ + + ], + "produces": [ + "application/json", + "text/json", + "application/xml", + "text/xml" + ], + "parameters": [ + { + "name": "continuationToken", + "in": "query", + "description": "skip or continuation token", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "An object will be returned containing \r\n* an array (Conversations) of ConversationMembers objects\r\n* a continuation token\r\n\r\nEach ConversationMembers object contains:\r\n* the Id of the conversation\r\n* an array (Members) of ChannelAccount objects", + "schema": { + "$ref": "#/definitions/ConversationsResult" + } + }, + "default": { + "description": "The operation failed and the response is an error object describing the status code and failure.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + } + }, + "post": { + "tags": [ + "Conversations" + ], + "summary": "CreateConversation", + "description": "Create a new Conversation.\r\n\r\nPOST to this method with a\r\n* Bot being the bot creating the conversation\r\n* IsGroup set to true if this is not a direct message (default is false)\r\n* Members array contining the members you want to have be in the conversation.\r\n\r\nThe return value is a ResourceResponse which contains a conversation id which is suitable for use\r\nin the message payload and REST API uris.\r\n\r\nMost channels only support the semantics of bots initiating a direct message conversation. An example of how to do that would be:\r\n\r\n```\r\nvar resource = await connector.conversations.CreateConversation(new ConversationParameters(){ Bot = bot, members = new ChannelAccount[] { new ChannelAccount(\"user1\") } );\r\nawait connect.Conversations.SendToConversationAsync(resource.Id, new Activity() ... ) ;\r\n\r\n```", + "operationId": "Conversations_CreateConversation", + "consumes": [ + "application/json", + "text/json", + "application/xml", + "text/xml", + "application/x-www-form-urlencoded" + ], + "produces": [ + "application/json", + "text/json", + "application/xml", + "text/xml" + ], + "parameters": [ + { + "name": "parameters", + "in": "body", + "description": "Parameters to create the conversation from", + "required": true, + "schema": { + "$ref": "#/definitions/ConversationParameters" + } + } + ], + "responses": { + "200": { + "description": "An object will be returned containing \r\n* the ID for the conversation\r\n* ActivityId for the activity if provided. If ActivityId is null then the channel doesn't support returning resource id's for activity.", + "schema": { + "$ref": "#/definitions/ConversationResourceResponse" + } + }, + "201": { + "description": "An object will be returned containing \r\n* the ID for the conversation\r\n* ActivityId for the activity if provided. If ActivityId is null then the channel doesn't support returning resource id's for activity.", + "schema": { + "$ref": "#/definitions/ConversationResourceResponse" + } + }, + "202": { + "description": "An object will be returned containing \r\n* the ID for the conversation\r\n* ActivityId for the activity if provided. If ActivityId is null then the channel doesn't support returning resource id's for activity.", + "schema": { + "$ref": "#/definitions/ConversationResourceResponse" + } + }, + "default": { + "description": "The operation failed and the response is an error object describing the status code and failure.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + } + } + }, + "/v3/conversations/{conversationId}/activities": { + "post": { + "tags": [ + "Conversations" + ], + "summary": "SendToConversation", + "description": "This method allows you to send an activity to the end of a conversation.\r\n\r\nThis is slightly different from ReplyToActivity().\r\n* SendToConverstion(conversationId) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel.\r\n* ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation.\r\n\r\nUse ReplyToActivity when replying to a specific activity in the conversation.\r\n\r\nUse SendToConversation in all other cases.", + "operationId": "Conversations_SendToConversation", + "consumes": [ + "application/json", + "text/json", + "application/xml", + "text/xml", + "application/x-www-form-urlencoded" + ], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "conversationId", + "in": "path", + "description": "Conversation ID", + "required": true, + "type": "string" + }, + { + "name": "activity", + "in": "body", + "description": "Activity to send", + "required": true, + "schema": { + "$ref": "#/definitions/Activity" + } + } + ], + "responses": { + "200": { + "description": "An object will be returned containing the ID for the resource.", + "schema": { + "$ref": "#/definitions/ResourceResponse" + } + }, + "201": { + "description": "A ResourceResponse object will be returned containing the ID for the resource.", + "schema": { + "$ref": "#/definitions/ResourceResponse" + } + }, + "202": { + "description": "An object will be returned containing the ID for the resource.", + "schema": { + "$ref": "#/definitions/ResourceResponse" + } + }, + "default": { + "description": "The operation failed and the response is an error object describing the status code and failure.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + } + } + }, + "/v3/conversations/{conversationId}/activities/{activityId}": { + "put": { + "tags": [ + "Conversations" + ], + "summary": "UpdateActivity", + "description": "Edit an existing activity.\r\n\r\nSome channels allow you to edit an existing activity to reflect the new state of a bot conversation.\r\n\r\nFor example, you can remove buttons after someone has clicked \"Approve\" button.", + "operationId": "Conversations_UpdateActivity", + "consumes": [ + "application/json", + "text/json", + "application/xml", + "text/xml", + "application/x-www-form-urlencoded" + ], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "conversationId", + "in": "path", + "description": "Conversation ID", + "required": true, + "type": "string" + }, + { + "name": "activityId", + "in": "path", + "description": "activityId to update", + "required": true, + "type": "string" + }, + { + "name": "activity", + "in": "body", + "description": "replacement Activity", + "required": true, + "schema": { + "$ref": "#/definitions/Activity" + } + } + ], + "responses": { + "200": { + "description": "An object will be returned containing the ID for the resource.", + "schema": { + "$ref": "#/definitions/ResourceResponse" + } + }, + "201": { + "description": "A ResourceResponse object will be returned containing the ID for the resource.", + "schema": { + "$ref": "#/definitions/ResourceResponse" + } + }, + "202": { + "description": "An object will be returned containing the ID for the resource.", + "schema": { + "$ref": "#/definitions/ResourceResponse" + } + }, + "default": { + "description": "The operation failed and the response is an error object describing the status code and failure.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + } + }, + "post": { + "tags": [ + "Conversations" + ], + "summary": "ReplyToActivity", + "description": "This method allows you to reply to an activity.\r\n\r\nThis is slightly different from SendToConversation().\r\n* SendToConverstion(conversationId) - will append the activity to the end of the conversation according to the timestamp or semantics of the channel.\r\n* ReplyToActivity(conversationId,ActivityId) - adds the activity as a reply to another activity, if the channel supports it. If the channel does not support nested replies, ReplyToActivity falls back to SendToConversation.\r\n\r\nUse ReplyToActivity when replying to a specific activity in the conversation.\r\n\r\nUse SendToConversation in all other cases.", + "operationId": "Conversations_ReplyToActivity", + "consumes": [ + "application/json", + "text/json", + "application/xml", + "text/xml", + "application/x-www-form-urlencoded" + ], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "conversationId", + "in": "path", + "description": "Conversation ID", + "required": true, + "type": "string" + }, + { + "name": "activityId", + "in": "path", + "description": "activityId the reply is to (OPTIONAL)", + "required": true, + "type": "string" + }, + { + "name": "activity", + "in": "body", + "description": "Activity to send", + "required": true, + "schema": { + "$ref": "#/definitions/Activity" + } + } + ], + "responses": { + "200": { + "description": "An object will be returned containing the ID for the resource.", + "schema": { + "$ref": "#/definitions/ResourceResponse" + } + }, + "201": { + "description": "A ResourceResponse object will be returned containing the ID for the resource.", + "schema": { + "$ref": "#/definitions/ResourceResponse" + } + }, + "202": { + "description": "An object will be returned containing the ID for the resource.", + "schema": { + "$ref": "#/definitions/ResourceResponse" + } + }, + "default": { + "description": "The operation failed and the response is an error object describing the status code and failure.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + } + }, + "delete": { + "tags": [ + "Conversations" + ], + "summary": "DeleteActivity", + "description": "Delete an existing activity.\r\n\r\nSome channels allow you to delete an existing activity, and if successful this method will remove the specified activity.", + "operationId": "Conversations_DeleteActivity", + "consumes": [ + + ], + "produces": [ + "application/json", + "text/json", + "application/xml", + "text/xml" + ], + "parameters": [ + { + "name": "conversationId", + "in": "path", + "description": "Conversation ID", + "required": true, + "type": "string" + }, + { + "name": "activityId", + "in": "path", + "description": "activityId to delete", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The operation succeeded, there is no response." + }, + "202": { + "description": "The request has been accepted for processing, but the processing has not been completed" + }, + "default": { + "description": "The operation failed and the response is an error object describing the status code and failure.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + } + } + }, + "/v3/conversations/{conversationId}/members": { + "get": { + "tags": [ + "Conversations" + ], + "summary": "GetConversationMembers", + "description": "Enumerate the members of a converstion. \r\n\r\nThis REST API takes a ConversationId and returns an array of ChannelAccount objects representing the members of the conversation.", + "operationId": "Conversations_GetConversationMembers", + "consumes": [ + + ], + "produces": [ + "application/json", + "text/json", + "application/xml", + "text/xml" + ], + "parameters": [ + { + "name": "conversationId", + "in": "path", + "description": "Conversation ID", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "An array of ChannelAccount objects", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ChannelAccount" + } + } + }, + "default": { + "description": "The operation failed and the response is an error object describing the status code and failure.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + } + } + }, + "/v3/conversations/{conversationId}/members/{memberId}": { + "delete": { + "tags": [ + "Conversations" + ], + "summary": "DeleteConversationMember", + "description": "Deletes a member from a converstion. \r\n\r\nThis REST API takes a ConversationId and a memberId (of type string) and removes that member from the conversation. If that member was the last member\r\nof the conversation, the conversation will also be deleted.", + "operationId": "Conversations_DeleteConversationMember", + "consumes": [ + + ], + "produces": [ + "application/json", + "text/json", + "application/xml", + "text/xml" + ], + "parameters": [ + { + "name": "conversationId", + "in": "path", + "description": "Conversation ID", + "required": true, + "type": "string" + }, + { + "name": "memberId", + "in": "path", + "description": "ID of the member to delete from this conversation", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "The operation succeeded, there is no response." + }, + "204": { + "description": "The operation succeeded but no content was returned." + }, + "default": { + "description": "The operation failed and the response is an error object describing the status code and failure.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + } + } + }, + "/v3/conversations/{conversationId}/activities/{activityId}/members": { + "get": { + "tags": [ + "Conversations" + ], + "summary": "GetActivityMembers", + "description": "Enumerate the members of an activity. \r\n\r\nThis REST API takes a ConversationId and a ActivityId, returning an array of ChannelAccount objects representing the members of the particular activity in the conversation.", + "operationId": "Conversations_GetActivityMembers", + "consumes": [ + + ], + "produces": [ + "application/json", + "text/json", + "application/xml", + "text/xml" + ], + "parameters": [ + { + "name": "conversationId", + "in": "path", + "description": "Conversation ID", + "required": true, + "type": "string" + }, + { + "name": "activityId", + "in": "path", + "description": "Activity ID", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "An array of ChannelAccount objects", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/ChannelAccount" + } + } + }, + "default": { + "description": "The operation failed and the response is an error object describing the status code and failure.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + } + } + }, + "/v3/conversations/{conversationId}/attachments": { + "post": { + "tags": [ + "Conversations" + ], + "summary": "UploadAttachment", + "description": "Upload an attachment directly into a channel's blob storage.\r\n\r\nThis is useful because it allows you to store data in a compliant store when dealing with enterprises.\r\n\r\nThe response is a ResourceResponse which contains an AttachmentId which is suitable for using with the attachments API.", + "operationId": "Conversations_UploadAttachment", + "consumes": [ + "application/json", + "text/json", + "application/xml", + "text/xml", + "application/x-www-form-urlencoded" + ], + "produces": [ + "application/json", + "text/json" + ], + "parameters": [ + { + "name": "conversationId", + "in": "path", + "description": "Conversation ID", + "required": true, + "type": "string" + }, + { + "name": "attachmentUpload", + "in": "body", + "description": "Attachment data", + "required": true, + "schema": { + "$ref": "#/definitions/AttachmentData" + } + } + ], + "responses": { + "200": { + "description": "An object will be returned containing the ID for the resource.", + "schema": { + "$ref": "#/definitions/ResourceResponse" + } + }, + "201": { + "description": "A ResourceResponse object will be returned containing the ID for the resource.", + "schema": { + "$ref": "#/definitions/ResourceResponse" + } + }, + "202": { + "description": "An object will be returned containing the ID for the resource.", + "schema": { + "$ref": "#/definitions/ResourceResponse" + } + }, + "default": { + "description": "The operation failed and the response is an error object describing the status code and failure.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + } + } + } + }, + "definitions": { + "AttachmentInfo": { + "description": "Metdata for an attachment", + "type": "object", + "properties": { + "name": { + "description": "Name of the attachment", + "type": "string" + }, + "type": { + "description": "ContentType of the attachment", + "type": "string" + }, + "views": { + "description": "attachment views", + "type": "array", + "items": { + "$ref": "#/definitions/AttachmentView" + } + } + } + }, + "AttachmentView": { + "description": "Attachment View name and size", + "type": "object", + "properties": { + "viewId": { + "description": "Content type of the attachment", + "type": "string" + }, + "size": { + "format": "int32", + "description": "Name of the attachment", + "type": "integer" + } + } + }, + "ErrorResponse": { + "description": "An HTTP API response", + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/Error", + "description": "Error message" + } + } + }, + "Error": { + "description": "Object representing error information", + "type": "object", + "properties": { + "code": { + "description": "Error code", + "type": "string" + }, + "message": { + "description": "Error message", + "type": "string" + } + } + }, + "ConversationParameters": { + "description": "Parameters for creating a new conversation", + "type": "object", + "properties": { + "isGroup": { + "description": "IsGroup", + "type": "boolean" + }, + "bot": { + "$ref": "#/definitions/ChannelAccount", + "description": "The bot address for this conversation" + }, + "members": { + "description": "Members to add to the conversation", + "type": "array", + "items": { + "$ref": "#/definitions/ChannelAccount" + } + }, + "topicName": { + "description": "(Optional) Topic of the conversation (if supported by the channel)", + "type": "string" + }, + "activity": { + "$ref": "#/definitions/Activity", + "description": "(Optional) When creating a new conversation, use this activity as the intial message to the conversation" + }, + "channelData": { + "description": "Channel specific payload for creating the conversation", + "type": "object" + } + } + }, + "ChannelAccount": { + "description": "Channel account information needed to route a message", + "type": "object", + "properties": { + "id": { + "description": "Channel id for the user or bot on this channel (Example: joe@smith.com, or @joesmith or 123456)", + "type": "string" + }, + "name": { + "description": "Display friendly name", + "type": "string" + }, + "role": { + "$ref": "#/definitions/RoleTypes", + "description": "Role of the entity behind the account (Example: User, Bot, etc.)" + } + } + }, + "Activity": { + "description": "An Activity is the basic communication type for the Bot Framework 3.0 protocol", + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/ActivityTypes", + "description": "The type of the activity" + }, + "id": { + "description": "ID of this activity", + "type": "string" + }, + "timestamp": { + "format": "date-time", + "description": "UTC Time when message was sent (set by service)", + "type": "string" + }, + "localTimestamp": { + "format": "date-time", + "description": "Local time when message was sent (set by client, Ex: 2016-09-23T13:07:49.4714686-07:00)", + "type": "string" + }, + "serviceUrl": { + "description": "Service endpoint where operations concerning the activity may be performed", + "type": "string" + }, + "channelId": { + "description": "ID of the channel where the activity was sent", + "type": "string" + }, + "from": { + "$ref": "#/definitions/ChannelAccount", + "description": "Sender address" + }, + "conversation": { + "$ref": "#/definitions/ConversationAccount", + "description": "Conversation" + }, + "recipient": { + "$ref": "#/definitions/ChannelAccount", + "description": "(Outbound to bot only) Bot's address that received the message" + }, + "textFormat": { + "$ref": "#/definitions/TextFormatTypes", + "description": "Format of text fields Default:markdown" + }, + "attachmentLayout": { + "$ref": "#/definitions/AttachmentLayoutTypes", + "description": "Hint for how to deal with multiple attachments. Default:list" + }, + "membersAdded": { + "description": "Members added to the conversation", + "type": "array", + "items": { + "$ref": "#/definitions/ChannelAccount" + } + }, + "membersRemoved": { + "description": "Members removed from the conversation", + "type": "array", + "items": { + "$ref": "#/definitions/ChannelAccount" + } + }, + "reactionsAdded": { + "description": "Reactions added to the activity", + "type": "array", + "items": { + "$ref": "#/definitions/MessageReaction" + } + }, + "reactionsRemoved": { + "description": "Reactions removed from the activity", + "type": "array", + "items": { + "$ref": "#/definitions/MessageReaction" + } + }, + "topicName": { + "description": "The conversation's updated topic name", + "type": "string" + }, + "historyDisclosed": { + "description": "True if prior history of the channel is disclosed", + "type": "boolean" + }, + "locale": { + "description": "The language code of the Text field", + "type": "string" + }, + "text": { + "description": "Content for the message", + "type": "string" + }, + "speak": { + "description": "SSML Speak for TTS audio response", + "type": "string" + }, + "inputHint": { + "$ref": "#/definitions/InputHints", + "description": "Input hint to the channel on what the bot is expecting." + }, + "summary": { + "description": "Text to display if the channel cannot render cards", + "type": "string" + }, + "suggestedActions": { + "$ref": "#/definitions/SuggestedActions", + "description": "SuggestedActions are used to provide keyboard/quickreply like behavior in many clients" + }, + "attachments": { + "description": "Attachments", + "type": "array", + "items": { + "$ref": "#/definitions/Attachment" + } + }, + "entities": { + "description": "Collection of Entity objects, each of which contains metadata about this activity. Each Entity object is typed.", + "type": "array", + "items": { + "$ref": "#/definitions/Entity" + } + }, + "channelData": { + "description": "Channel-specific payload", + "type": "object" + }, + "action": { + "description": "ContactAdded/Removed action", + "type": "string" + }, + "replyToId": { + "description": "The original ID this message is a response to", + "type": "string" + }, + "label": { + "description": "Descriptive label", + "type": "string" + }, + "valueType": { + "description": "Unique string which identifies the shape of the value object", + "type": "string" + }, + "value": { + "description": "Open-ended value", + "type": "object" + }, + "name": { + "description": "Name of the operation to invoke or the name of the event", + "type": "string" + }, + "relatesTo": { + "$ref": "#/definitions/ConversationReference", + "description": "Reference to another conversation or activity" + }, + "code": { + "$ref": "#/definitions/EndOfConversationCodes", + "description": "Code indicating why the conversation has ended" + }, + "expiration": { + "format": "date-time", + "description": "DateTime to expire the activity as ISO 8601 encoded datetime", + "type": "string" + }, + "importance": { + "description": "Importance of this activity \r\n {Low|Normal|High}, null value indicates Normal importance see ActivityImportance)", + "type": "string" + }, + "deliveryMode": { + "description": "Hint to describe how this activity should be delivered. \r\nCurrently: null or \"Default\" = default delivery\r\n\"Notification\" = notification semantics", + "type": "string" + }, + "textHighlights": { + "description": "TextHighlight in the activity represented in the ReplyToId property", + "type": "array", + "items": { + "$ref": "#/definitions/TextHighlight" + } + } + } + }, + "ConversationAccount": { + "description": "Channel account information for a conversation", + "type": "object", + "properties": { + "isGroup": { + "description": "Indicates whether the conversation contains more than two participants at the time the activity was generated", + "type": "boolean" + }, + "conversationType": { + "description": "Indicates the type of the conversation in channels that distinguish between conversation types", + "type": "string" + }, + "id": { + "description": "Channel id for the user or bot on this channel (Example: joe@smith.com, or @joesmith or 123456)", + "type": "string" + }, + "name": { + "description": "Display friendly name", + "type": "string" + }, + "role": { + "$ref": "#/definitions/RoleTypes", + "description": "Role of the entity behind the account (Example: User, Bot, etc.)" + } + } + }, + "MessageReaction": { + "description": "Message reaction object", + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/MessageReactionTypes", + "description": "Message reaction type" + } + } + }, + "SuggestedActions": { + "description": "SuggestedActions that can be performed", + "type": "object", + "properties": { + "to": { + "description": "Ids of the recipients that the actions should be shown to. These Ids are relative to the channelId and a subset of all recipients of the activity", + "type": "array", + "items": { + "type": "string" + } + }, + "actions": { + "description": "Actions that can be shown to the user", + "type": "array", + "items": { + "$ref": "#/definitions/CardAction" + } + } + } + }, + "Attachment": { + "description": "An attachment within an activity", + "type": "object", + "properties": { + "contentType": { + "description": "mimetype/Contenttype for the file", + "type": "string" + }, + "contentUrl": { + "description": "Content Url", + "type": "string" + }, + "content": { + "description": "Embedded content", + "type": "object" + }, + "name": { + "description": "(OPTIONAL) The name of the attachment", + "type": "string" + }, + "thumbnailUrl": { + "description": "(OPTIONAL) Thumbnail associated with attachment", + "type": "string" + } + } + }, + "Entity": { + "description": "Object of schema.org types", + "type": "object", + "properties": { + "type": { + "description": "Entity Type (typically from schema.org types)", + "type": "string" + } + } + }, + "ConversationReference": { + "description": "An object relating to a particular point in a conversation", + "type": "object", + "properties": { + "activityId": { + "description": "(Optional) ID of the activity to refer to", + "type": "string" + }, + "user": { + "$ref": "#/definitions/ChannelAccount", + "description": "(Optional) User participating in this conversation" + }, + "bot": { + "$ref": "#/definitions/ChannelAccount", + "description": "Bot participating in this conversation" + }, + "conversation": { + "$ref": "#/definitions/ConversationAccount", + "description": "Conversation reference" + }, + "channelId": { + "description": "Channel ID", + "type": "string" + }, + "serviceUrl": { + "description": "Service endpoint where operations concerning the referenced conversation may be performed", + "type": "string" + } + } + }, + "TextHighlight": { + "description": "", + "type": "object", + "properties": { + "text": { + "description": "plain text fragment to highlight", + "type": "string" + }, + "occurence": { + "format": "int32", + "description": "index of occurence of the Text (Starting at 1)", + "type": "integer" + } + } + }, + "CardAction": { + "description": "A clickable action", + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/ActionTypes", + "description": "The type of action implemented by this button" + }, + "title": { + "description": "Text description which appears on the button", + "type": "string" + }, + "image": { + "description": "Image URL which will appear on the button, next to text label", + "type": "string" + }, + "text": { + "description": "Text for this action", + "type": "string" + }, + "displayText": { + "description": "(Optional) text to display in the chat feed if the button is clicked", + "type": "string" + }, + "value": { + "description": "Supplementary parameter for action. Content of this property depends on the ActionType", + "type": "object" + } + } + }, + "ConversationResourceResponse": { + "description": "A response containing a resource", + "type": "object", + "properties": { + "activityId": { + "description": "ID of the Activity (if sent)", + "type": "string" + }, + "serviceUrl": { + "description": "Service endpoint where operations concerning the conversation may be performed", + "type": "string" + }, + "id": { + "description": "Id of the resource", + "type": "string" + } + } + }, + "ConversationsResult": { + "description": "Conversations result", + "type": "object", + "properties": { + "continuationToken": { + "description": "Paging token", + "type": "string" + }, + "conversations": { + "description": "List of conversations", + "type": "array", + "items": { + "$ref": "#/definitions/ConversationMembers" + } + } + } + }, + "ConversationMembers": { + "description": "Conversation and its members", + "type": "object", + "properties": { + "id": { + "description": "Conversation ID", + "type": "string" + }, + "members": { + "description": "List of members in this conversation", + "type": "array", + "items": { + "$ref": "#/definitions/ChannelAccount" + } + } + } + }, + "ResourceResponse": { + "description": "A response containing a resource ID", + "type": "object", + "properties": { + "id": { + "description": "Id of the resource", + "type": "string" + } + } + }, + "AttachmentData": { + "description": "Attachment data", + "type": "object", + "properties": { + "type": { + "description": "Content-Type of the attachment", + "type": "string" + }, + "name": { + "description": "Name of the attachment", + "type": "string" + }, + "originalBase64": { + "format": "byte", + "description": "Attachment content", + "type": "string" + }, + "thumbnailBase64": { + "format": "byte", + "description": "Attachment thumbnail", + "type": "string" + } + } + }, + "HeroCard": { + "description": "A Hero card (card with a single, large image)", + "type": "object", + "properties": { + "title": { + "description": "Title of the card", + "type": "string" + }, + "subtitle": { + "description": "Subtitle of the card", + "type": "string" + }, + "text": { + "description": "Text for the card", + "type": "string" + }, + "images": { + "description": "Array of images for the card", + "type": "array", + "items": { + "$ref": "#/definitions/CardImage" + } + }, + "buttons": { + "description": "Set of actions applicable to the current card", + "type": "array", + "items": { + "$ref": "#/definitions/CardAction" + } + }, + "tap": { + "$ref": "#/definitions/CardAction", + "description": "This action will be activated when user taps on the card itself" + } + } + }, + "CardImage": { + "description": "An image on a card", + "type": "object", + "properties": { + "url": { + "description": "URL thumbnail image for major content property", + "type": "string" + }, + "alt": { + "description": "Image description intended for screen readers", + "type": "string" + }, + "tap": { + "$ref": "#/definitions/CardAction", + "description": "Action assigned to specific Attachment" + } + } + }, + "AnimationCard": { + "description": "An animation card (Ex: gif or short video clip)", + "type": "object", + "properties": { + "title": { + "description": "Title of this card", + "type": "string" + }, + "subtitle": { + "description": "Subtitle of this card", + "type": "string" + }, + "text": { + "description": "Text of this card", + "type": "string" + }, + "image": { + "$ref": "#/definitions/ThumbnailUrl", + "description": "Thumbnail placeholder" + }, + "media": { + "description": "Media URLs for this card", + "type": "array", + "items": { + "$ref": "#/definitions/MediaUrl" + } + }, + "buttons": { + "description": "Actions on this card", + "type": "array", + "items": { + "$ref": "#/definitions/CardAction" + } + }, + "shareable": { + "description": "This content may be shared with others (default:true)", + "type": "boolean" + }, + "autoloop": { + "description": "Should the client loop playback at end of content (default:true)", + "type": "boolean" + }, + "autostart": { + "description": "Should the client automatically start playback of media in this card (default:true)", + "type": "boolean" + }, + "aspect": { + "description": "Aspect ratio of thumbnail/media placeholder, allowed values are \"16:9\" and \"4:3\"", + "type": "string" + }, + "value": { + "description": "Supplementary parameter for this card", + "type": "object" + } + } + }, + "ThumbnailUrl": { + "description": "Thumbnail URL", + "type": "object", + "properties": { + "url": { + "description": "URL pointing to the thumbnail to use for media content", + "type": "string" + }, + "alt": { + "description": "HTML alt text to include on this thumbnail image", + "type": "string" + } + } + }, + "MediaUrl": { + "description": "Media URL", + "type": "object", + "properties": { + "url": { + "description": "Url for the media", + "type": "string" + }, + "profile": { + "description": "Optional profile hint to the client to differentiate multiple MediaUrl objects from each other", + "type": "string" + } + } + }, + "AudioCard": { + "description": "Audio card", + "type": "object", + "properties": { + "title": { + "description": "Title of this card", + "type": "string" + }, + "subtitle": { + "description": "Subtitle of this card", + "type": "string" + }, + "text": { + "description": "Text of this card", + "type": "string" + }, + "image": { + "$ref": "#/definitions/ThumbnailUrl", + "description": "Thumbnail placeholder" + }, + "media": { + "description": "Media URLs for this card", + "type": "array", + "items": { + "$ref": "#/definitions/MediaUrl" + } + }, + "buttons": { + "description": "Actions on this card", + "type": "array", + "items": { + "$ref": "#/definitions/CardAction" + } + }, + "shareable": { + "description": "This content may be shared with others (default:true)", + "type": "boolean" + }, + "autoloop": { + "description": "Should the client loop playback at end of content (default:true)", + "type": "boolean" + }, + "autostart": { + "description": "Should the client automatically start playback of media in this card (default:true)", + "type": "boolean" + }, + "aspect": { + "description": "Aspect ratio of thumbnail/media placeholder, allowed values are \"16:9\" and \"4:3\"", + "type": "string" + }, + "value": { + "description": "Supplementary parameter for this card", + "type": "object" + } + } + }, + "BasicCard": { + "description": "A basic card", + "type": "object", + "properties": { + "title": { + "description": "Title of the card", + "type": "string" + }, + "subtitle": { + "description": "Subtitle of the card", + "type": "string" + }, + "text": { + "description": "Text for the card", + "type": "string" + }, + "images": { + "description": "Array of images for the card", + "type": "array", + "items": { + "$ref": "#/definitions/CardImage" + } + }, + "buttons": { + "description": "Set of actions applicable to the current card", + "type": "array", + "items": { + "$ref": "#/definitions/CardAction" + } + }, + "tap": { + "$ref": "#/definitions/CardAction", + "description": "This action will be activated when user taps on the card itself" + } + } + }, + "MediaCard": { + "description": "Media card", + "type": "object", + "properties": { + "title": { + "description": "Title of this card", + "type": "string" + }, + "subtitle": { + "description": "Subtitle of this card", + "type": "string" + }, + "text": { + "description": "Text of this card", + "type": "string" + }, + "image": { + "$ref": "#/definitions/ThumbnailUrl", + "description": "Thumbnail placeholder" + }, + "media": { + "description": "Media URLs for this card", + "type": "array", + "items": { + "$ref": "#/definitions/MediaUrl" + } + }, + "buttons": { + "description": "Actions on this card", + "type": "array", + "items": { + "$ref": "#/definitions/CardAction" + } + }, + "shareable": { + "description": "This content may be shared with others (default:true)", + "type": "boolean" + }, + "autoloop": { + "description": "Should the client loop playback at end of content (default:true)", + "type": "boolean" + }, + "autostart": { + "description": "Should the client automatically start playback of media in this card (default:true)", + "type": "boolean" + }, + "aspect": { + "description": "Aspect ratio of thumbnail/media placeholder, allowed values are \"16:9\" and \"4:3\"", + "type": "string" + }, + "value": { + "description": "Supplementary parameter for this card", + "type": "object" + } + } + }, + "ReceiptCard": { + "description": "A receipt card", + "type": "object", + "properties": { + "title": { + "description": "Title of the card", + "type": "string" + }, + "facts": { + "description": "Array of Fact objects", + "type": "array", + "items": { + "$ref": "#/definitions/Fact" + } + }, + "items": { + "description": "Array of Receipt Items", + "type": "array", + "items": { + "$ref": "#/definitions/ReceiptItem" + } + }, + "tap": { + "$ref": "#/definitions/CardAction", + "description": "This action will be activated when user taps on the card" + }, + "total": { + "description": "Total amount of money paid (or to be paid)", + "type": "string" + }, + "tax": { + "description": "Total amount of tax paid (or to be paid)", + "type": "string" + }, + "vat": { + "description": "Total amount of VAT paid (or to be paid)", + "type": "string" + }, + "buttons": { + "description": "Set of actions applicable to the current card", + "type": "array", + "items": { + "$ref": "#/definitions/CardAction" + } + } + } + }, + "Fact": { + "description": "Set of key-value pairs. Advantage of this section is that key and value properties will be \r\nrendered with default style information with some delimiter between them. So there is no need for developer to specify style information.", + "type": "object", + "properties": { + "key": { + "description": "The key for this Fact", + "type": "string" + }, + "value": { + "description": "The value for this Fact", + "type": "string" + } + } + }, + "ReceiptItem": { + "description": "An item on a receipt card", + "type": "object", + "properties": { + "title": { + "description": "Title of the Card", + "type": "string" + }, + "subtitle": { + "description": "Subtitle appears just below Title field, differs from Title in font styling only", + "type": "string" + }, + "text": { + "description": "Text field appears just below subtitle, differs from Subtitle in font styling only", + "type": "string" + }, + "image": { + "$ref": "#/definitions/CardImage", + "description": "Image" + }, + "price": { + "description": "Amount with currency", + "type": "string" + }, + "quantity": { + "description": "Number of items of given kind", + "type": "string" + }, + "tap": { + "$ref": "#/definitions/CardAction", + "description": "This action will be activated when user taps on the Item bubble." + } + } + }, + "SigninCard": { + "description": "A card representing a request to sign in", + "type": "object", + "properties": { + "text": { + "description": "Text for signin request", + "type": "string" + }, + "buttons": { + "description": "Action to use to perform signin", + "type": "array", + "items": { + "$ref": "#/definitions/CardAction" + } + } + } + }, + "OAuthCard": { + "description": "A card representing a request to peform a sign in via OAuth", + "type": "object", + "properties": { + "text": { + "description": "Text for signin request", + "type": "string" + }, + "connectionName": { + "description": "The name of the registered connection", + "type": "string" + }, + "buttons": { + "description": "Action to use to perform signin", + "type": "array", + "items": { + "$ref": "#/definitions/CardAction" + } + } + } + }, + "ThumbnailCard": { + "description": "A thumbnail card (card with a single, small thumbnail image)", + "type": "object", + "properties": { + "title": { + "description": "Title of the card", + "type": "string" + }, + "subtitle": { + "description": "Subtitle of the card", + "type": "string" + }, + "text": { + "description": "Text for the card", + "type": "string" + }, + "images": { + "description": "Array of images for the card", + "type": "array", + "items": { + "$ref": "#/definitions/CardImage" + } + }, + "buttons": { + "description": "Set of actions applicable to the current card", + "type": "array", + "items": { + "$ref": "#/definitions/CardAction" + } + }, + "tap": { + "$ref": "#/definitions/CardAction", + "description": "This action will be activated when user taps on the card itself" + } + } + }, + "VideoCard": { + "description": "Video card", + "type": "object", + "properties": { + "title": { + "description": "Title of this card", + "type": "string" + }, + "subtitle": { + "description": "Subtitle of this card", + "type": "string" + }, + "text": { + "description": "Text of this card", + "type": "string" + }, + "image": { + "$ref": "#/definitions/ThumbnailUrl", + "description": "Thumbnail placeholder" + }, + "media": { + "description": "Media URLs for this card", + "type": "array", + "items": { + "$ref": "#/definitions/MediaUrl" + } + }, + "buttons": { + "description": "Actions on this card", + "type": "array", + "items": { + "$ref": "#/definitions/CardAction" + } + }, + "shareable": { + "description": "This content may be shared with others (default:true)", + "type": "boolean" + }, + "autoloop": { + "description": "Should the client loop playback at end of content (default:true)", + "type": "boolean" + }, + "autostart": { + "description": "Should the client automatically start playback of media in this card (default:true)", + "type": "boolean" + }, + "aspect": { + "description": "Aspect ratio of thumbnail/media placeholder, allowed values are \"16:9\" and \"4:3\"", + "type": "string" + }, + "value": { + "description": "Supplementary parameter for this card", + "type": "object" + } + } + }, + "GeoCoordinates": { + "description": "GeoCoordinates (entity type: \"https://schema.org/GeoCoordinates\")", + "type": "object", + "properties": { + "elevation": { + "format": "double", + "description": "Elevation of the location [WGS 84](https://en.wikipedia.org/wiki/World_Geodetic_System)", + "type": "number" + }, + "latitude": { + "format": "double", + "description": "Latitude of the location [WGS 84](https://en.wikipedia.org/wiki/World_Geodetic_System)", + "type": "number" + }, + "longitude": { + "format": "double", + "description": "Longitude of the location [WGS 84](https://en.wikipedia.org/wiki/World_Geodetic_System)", + "type": "number" + }, + "type": { + "description": "The type of the thing", + "type": "string" + }, + "name": { + "description": "The name of the thing", + "type": "string" + } + } + }, + "Mention": { + "description": "Mention information (entity type: \"mention\")", + "type": "object", + "properties": { + "mentioned": { + "$ref": "#/definitions/ChannelAccount", + "description": "The mentioned user" + }, + "text": { + "description": "Sub Text which represents the mention (can be null or empty)", + "type": "string" + }, + "type": { + "description": "Entity Type (typically from schema.org types)", + "type": "string" + } + } + }, + "Place": { + "description": "Place (entity type: \"https://schema.org/Place\")", + "type": "object", + "properties": { + "address": { + "description": "Address of the place (may be `string` or complex object of type `PostalAddress`)", + "type": "object" + }, + "geo": { + "description": "Geo coordinates of the place (may be complex object of type `GeoCoordinates` or `GeoShape`)", + "type": "object" + }, + "hasMap": { + "description": "Map to the place (may be `string` (URL) or complex object of type `Map`)", + "type": "object" + }, + "type": { + "description": "The type of the thing", + "type": "string" + }, + "name": { + "description": "The name of the thing", + "type": "string" + } + } + }, + "Thing": { + "description": "Thing (entity type: \"https://schema.org/Thing\")", + "type": "object", + "properties": { + "type": { + "description": "The type of the thing", + "type": "string" + }, + "name": { + "description": "The name of the thing", + "type": "string" + } + } + }, + "MediaEventValue": { + "description": "Supplementary parameter for media events", + "type": "object", + "properties": { + "cardValue": { + "description": "Callback parameter specified in the Value field of the MediaCard that originated this event", + "type": "object" + } + } + }, + "TokenRequest": { + "description": "A request to receive a user token", + "type": "object", + "properties": { + "provider": { + "description": "The provider to request a user token from", + "type": "string" + }, + "settings": { + "description": "A collection of settings for the specific provider for this request", + "type": "object", + "additionalProperties": { + "type": "object" + } + } + } + }, + "TokenResponse": { + "description": "A response that includes a user token", + "type": "object", + "properties": { + "connectionName": { + "description": "The connection name", + "type": "string" + }, + "token": { + "description": "The user token", + "type": "string" + }, + "expiration": { + "description": "Expiration for the token, in ISO 8601 format (e.g. \"2007-04-05T14:30Z\")", + "type": "string" + } + } + }, + "ActivityTypes": { + "description": "Types of Activities", + "enum": [ + "message", + "contactRelationUpdate", + "conversationUpdate", + "typing", + "ping", + "endOfConversation", + "event", + "invoke", + "deleteUserData", + "messageUpdate", + "messageDelete", + "installationUpdate", + "messageReaction", + "suggestion", + "trace" + ], + "type": "string", + "properties": { + + }, + "x-ms-enum": { + "name": "ActivityTypes", + "modelAsString": true + } + }, + "AttachmentLayoutTypes": { + "description": "Attachment layout types", + "enum": [ + "list", + "carousel" + ], + "type": "string", + "properties": { + + }, + "x-ms-enum": { + "name": "AttachmentLayoutTypes", + "modelAsString": true + } + }, + "ActionTypes": { + "description": "Types of actions", + "enum": [ + "openUrl", + "imBack", + "postBack", + "playAudio", + "playVideo", + "showImage", + "downloadFile", + "signin", + "call", + "payment", + "messageBack" + ], + "type": "string", + "properties": { + + }, + "x-ms-enum": { + "name": "ActionTypes", + "modelAsString": true + } + }, + "ContactRelationUpdateActionTypes": { + "description": "Action types valid for ContactRelationUpdate activities", + "enum": [ + "add", + "remove" + ], + "type": "string", + "properties": { + + }, + "x-ms-enum": { + "name": "ContactRelationUpdateActionTypes", + "modelAsString": true + } + }, + "InstallationUpdateActionTypes": { + "description": "Action types valid for InstallationUpdate activities", + "enum": [ + "add", + "remove" + ], + "type": "string", + "properties": { + + }, + "x-ms-enum": { + "name": "InstallationUpdateActionTypes", + "modelAsString": true + } + }, + "MessageReactionTypes": { + "description": "Message reaction types", + "enum": [ + "like", + "plusOne" + ], + "type": "string", + "properties": { + + }, + "x-ms-enum": { + "name": "MessageReactionTypes", + "modelAsString": true + } + }, + "TextFormatTypes": { + "description": "Text format types", + "enum": [ + "markdown", + "plain", + "xml" + ], + "type": "string", + "properties": { + + }, + "x-ms-enum": { + "name": "TextFormatTypes", + "modelAsString": true + } + }, + "InputHints": { + "description": "Indicates whether the bot is accepting, expecting, or ignoring input", + "enum": [ + "acceptingInput", + "ignoringInput", + "expectingInput" + ], + "type": "string", + "properties": { + + }, + "x-ms-enum": { + "name": "InputHints", + "modelAsString": true + } + }, + "EndOfConversationCodes": { + "description": "Codes indicating why a conversation has ended", + "enum": [ + "unknown", + "completedSuccessfully", + "userCancelled", + "botTimedOut", + "botIssuedInvalidMessage", + "channelFailed" + ], + "type": "string", + "properties": { + + }, + "x-ms-enum": { + "name": "EndOfConversationCodes", + "modelAsString": true + } + }, + "ActivityImportance": { + "description": "Defines the importance of an Activity", + "enum": [ + "low", + "normal", + "high" + ], + "type": "string", + "properties": { + + }, + "x-ms-enum": { + "name": "ActivityImportance", + "modelAsString": true + } + }, + "RoleTypes": { + "enum": [ + "user", + "bot" + ], + "type": "string", + "properties": { + + }, + "x-ms-enum": { + "name": "RoleTypes", + "modelAsString": true + } + }, + "MicrosoftPayMethodData": { + "description": "W3C Payment Method Data for Microsoft Pay", + "type": "object", + "properties": { + "mechantId": { + "description": "Microsoft Pay Merchant ID", + "type": "string" + }, + "supportedNetworks": { + "description": "Supported payment networks (e.g., \"visa\" and \"mastercard\")", + "type": "array", + "items": { + "type": "string" + } + }, + "supportedTypes": { + "description": "Supported payment types (e.g., \"credit\")", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "PaymentAddress": { + "description": "Address within a Payment Request", + "type": "object", + "properties": { + "country": { + "description": "This is the CLDR (Common Locale Data Repository) region code. For example, US, GB, CN, or JP", + "type": "string" + }, + "addressLine": { + "description": "This is the most specific part of the address. It can include, for example, a street name, a house number, apartment number, a rural delivery route, descriptive instructions, or a post office box number.", + "type": "array", + "items": { + "type": "string" + } + }, + "region": { + "description": "This is the top level administrative subdivision of the country. For example, this can be a state, a province, an oblast, or a prefecture.", + "type": "string" + }, + "city": { + "description": "This is the city/town portion of the address.", + "type": "string" + }, + "dependentLocality": { + "description": "This is the dependent locality or sublocality within a city. For example, used for neighborhoods, boroughs, districts, or UK dependent localities.", + "type": "string" + }, + "postalCode": { + "description": "This is the postal code or ZIP code, also known as PIN code in India.", + "type": "string" + }, + "sortingCode": { + "description": "This is the sorting code as used in, for example, France.", + "type": "string" + }, + "languageCode": { + "description": "This is the BCP-47 language code for the address. It's used to determine the field separators and the order of fields when formatting the address for display.", + "type": "string" + }, + "organization": { + "description": "This is the organization, firm, company, or institution at this address.", + "type": "string" + }, + "recipient": { + "description": "This is the name of the recipient or contact person.", + "type": "string" + }, + "phone": { + "description": "This is the phone number of the recipient or contact person.", + "type": "string" + } + } + }, + "PaymentCurrencyAmount": { + "description": "Supplies monetary amounts", + "type": "object", + "properties": { + "currency": { + "description": "A currency identifier", + "type": "string" + }, + "value": { + "description": "Decimal monetary value", + "type": "string" + }, + "currencySystem": { + "description": "Currency system", + "type": "string" + } + } + }, + "PaymentDetails": { + "description": "Provides information about the requested transaction", + "type": "object", + "properties": { + "total": { + "$ref": "#/definitions/PaymentItem", + "description": "Contains the total amount of the payment request" + }, + "displayItems": { + "description": "Contains line items for the payment request that the user agent may display", + "type": "array", + "items": { + "$ref": "#/definitions/PaymentItem" + } + }, + "shippingOptions": { + "description": "A sequence containing the different shipping options for the user to choose from", + "type": "array", + "items": { + "$ref": "#/definitions/PaymentShippingOption" + } + }, + "modifiers": { + "description": "Contains modifiers for particular payment method identifiers", + "type": "array", + "items": { + "$ref": "#/definitions/PaymentDetailsModifier" + } + }, + "error": { + "description": "Error description", + "type": "string" + } + } + }, + "PaymentItem": { + "description": "Indicates what the payment request is for and the value asked for", + "type": "object", + "properties": { + "label": { + "description": "Human-readable description of the item", + "type": "string" + }, + "amount": { + "$ref": "#/definitions/PaymentCurrencyAmount", + "description": "Monetary amount for the item" + }, + "pending": { + "description": "When set to true this flag means that the amount field is not final.", + "type": "boolean" + } + } + }, + "PaymentShippingOption": { + "description": "Describes a shipping option", + "type": "object", + "properties": { + "id": { + "description": "String identifier used to reference this PaymentShippingOption", + "type": "string" + }, + "label": { + "description": "Human-readable description of the item", + "type": "string" + }, + "amount": { + "$ref": "#/definitions/PaymentCurrencyAmount", + "description": "Contains the monetary amount for the item" + }, + "selected": { + "description": "Indicates whether this is the default selected PaymentShippingOption", + "type": "boolean" + } + } + }, + "PaymentDetailsModifier": { + "description": "Provides details that modify the PaymentDetails based on payment method identifier", + "type": "object", + "properties": { + "supportedMethods": { + "description": "Contains a sequence of payment method identifiers", + "type": "array", + "items": { + "type": "string" + } + }, + "total": { + "$ref": "#/definitions/PaymentItem", + "description": "This value overrides the total field in the PaymentDetails dictionary for the payment method identifiers in the supportedMethods field" + }, + "additionalDisplayItems": { + "description": "Provides additional display items that are appended to the displayItems field in the PaymentDetails dictionary for the payment method identifiers in the supportedMethods field", + "type": "array", + "items": { + "$ref": "#/definitions/PaymentItem" + } + }, + "data": { + "description": "A JSON-serializable object that provides optional information that might be needed by the supported payment methods", + "type": "object" + } + } + }, + "PaymentMethodData": { + "description": "Indicates a set of supported payment methods and any associated payment method specific data for those methods", + "type": "object", + "properties": { + "supportedMethods": { + "description": "Required sequence of strings containing payment method identifiers for payment methods that the merchant web site accepts", + "type": "array", + "items": { + "type": "string" + } + }, + "data": { + "description": "A JSON-serializable object that provides optional information that might be needed by the supported payment methods", + "type": "object" + } + } + }, + "PaymentOptions": { + "description": "Provides information about the options desired for the payment request", + "type": "object", + "properties": { + "requestPayerName": { + "description": "Indicates whether the user agent should collect and return the payer's name as part of the payment request", + "type": "boolean" + }, + "requestPayerEmail": { + "description": "Indicates whether the user agent should collect and return the payer's email address as part of the payment request", + "type": "boolean" + }, + "requestPayerPhone": { + "description": "Indicates whether the user agent should collect and return the payer's phone number as part of the payment request", + "type": "boolean" + }, + "requestShipping": { + "description": "Indicates whether the user agent should collect and return a shipping address as part of the payment request", + "type": "boolean" + }, + "shippingType": { + "description": "If requestShipping is set to true, then the shippingType field may be used to influence the way the user agent presents the user interface for gathering the shipping address", + "type": "string" + } + } + }, + "PaymentRequest": { + "description": "A request to make a payment", + "type": "object", + "properties": { + "id": { + "description": "ID of this payment request", + "type": "string" + }, + "methodData": { + "description": "Allowed payment methods for this request", + "type": "array", + "items": { + "$ref": "#/definitions/PaymentMethodData" + } + }, + "details": { + "$ref": "#/definitions/PaymentDetails", + "description": "Details for this request" + }, + "options": { + "$ref": "#/definitions/PaymentOptions", + "description": "Provides information about the options desired for the payment request" + }, + "expires": { + "description": "Expiration for this request, in ISO 8601 duration format (e.g., 'P1D')", + "type": "string" + } + } + }, + "PaymentRequestComplete": { + "description": "Payload delivered when completing a payment request", + "type": "object", + "properties": { + "id": { + "description": "Payment request ID", + "type": "string" + }, + "paymentRequest": { + "$ref": "#/definitions/PaymentRequest", + "description": "Initial payment request" + }, + "paymentResponse": { + "$ref": "#/definitions/PaymentResponse", + "description": "Corresponding payment response" + } + } + }, + "PaymentResponse": { + "description": "A PaymentResponse is returned when a user has selected a payment method and approved a payment request", + "type": "object", + "properties": { + "methodName": { + "description": "The payment method identifier for the payment method that the user selected to fulfil the transaction", + "type": "string" + }, + "details": { + "description": "A JSON-serializable object that provides a payment method specific message used by the merchant to process the transaction and determine successful fund transfer", + "type": "object" + }, + "shippingAddress": { + "$ref": "#/definitions/PaymentAddress", + "description": "If the requestShipping flag was set to true in the PaymentOptions passed to the PaymentRequest constructor, then shippingAddress will be the full and final shipping address chosen by the user" + }, + "shippingOption": { + "description": "If the requestShipping flag was set to true in the PaymentOptions passed to the PaymentRequest constructor, then shippingOption will be the id attribute of the selected shipping option", + "type": "string" + }, + "payerEmail": { + "description": "If the requestPayerEmail flag was set to true in the PaymentOptions passed to the PaymentRequest constructor, then payerEmail will be the email address chosen by the user", + "type": "string" + }, + "payerPhone": { + "description": "If the requestPayerPhone flag was set to true in the PaymentOptions passed to the PaymentRequest constructor, then payerPhone will be the phone number chosen by the user", + "type": "string" + } + } + }, + "PaymentRequestCompleteResult": { + "description": "Result from a completed payment request", + "type": "object", + "properties": { + "result": { + "description": "Result of the payment request completion", + "type": "string" + } + } + }, + "PaymentRequestUpdate": { + "description": "An update to a payment request", + "type": "object", + "properties": { + "id": { + "description": "ID for the payment request to update", + "type": "string" + }, + "details": { + "$ref": "#/definitions/PaymentDetails", + "description": "Update payment details" + }, + "shippingAddress": { + "$ref": "#/definitions/PaymentAddress", + "description": "Updated shipping address" + }, + "shippingOption": { + "description": "Updated shipping options", + "type": "string" + } + } + }, + "PaymentRequestUpdateResult": { + "description": "A result object from a Payment Request Update invoke operation", + "type": "object", + "properties": { + "details": { + "$ref": "#/definitions/PaymentDetails", + "description": "Update payment details" + } + } + } + }, + "securityDefinitions": { + "bearer_auth": { + "type": "apiKey", + "description": "Access token to authenticate calls to the Bot Connector Service.", + "name": "Authorization", + "in": "header" + } + } +} \ No newline at end of file diff --git a/libraries/swagger/README.md b/libraries/swagger/README.md index 7a4820309..78ef9ab29 100644 --- a/libraries/swagger/README.md +++ b/libraries/swagger/README.md @@ -3,8 +3,6 @@ > see https://aka.ms/autorest Configuration for generating BotFramework Connector SDK. -NOTE: -The generated files have been modified by hand to overcome limitations. ``` yaml add-credentials: true @@ -37,4 +35,4 @@ directive: if( $['modelAsString'] ) { $['modelAsString'] = false; } -``` +``` \ No newline at end of file diff --git a/libraries/swagger/generateClient.cmd b/libraries/swagger/generateClient.cmd new file mode 100644 index 000000000..e8c960b7d --- /dev/null +++ b/libraries/swagger/generateClient.cmd @@ -0,0 +1,17 @@ +call npm install replace@0.3.0 + + +del /q ..\botbuilder-schema\src\main\java\com\microsoft\bot\schema\models\ + +call autorest .\README.md --java --add-credentials true + +robocopy .\generated\models ..\botbuilder-schema\src\main\java\com\microsoft\bot\schema\models *.* /move /xf *Exception.java + +call .\node_modules\.bin\replace "import com.microsoft.bot.schema.models.ErrorResponseException;" "import com.microsoft.bot.connector.models.ErrorResponseException;" . -r -q --include="*.java" +call .\node_modules\.bin\replace "import com.microsoft.bot.schema.ConnectorClient;" "import com.microsoft.bot.connector.ConnectorClient;" . -r -q --include="*.java" +call .\node_modules\.bin\replace "import com.microsoft.bot.schema.Attachments;" "import com.microsoft.bot.connector.Attachments;" . -r -q --include="*.java" +call .\node_modules\.bin\replace "import com.microsoft.bot.schema.Conversations;" "import com.microsoft.bot.connector.Conversations;" . -r -q --include="*.java" +call .\node_modules\.bin\replace "import com.microsoft.rest.RestException;" "import com.microsoft.rest.RestException;import com.microsoft.bot.schema.models.ErrorResponse;" . -r -q --include="ErrorResponseException.java" +call .\node_modules\.bin\replace "package com.microsoft.bot.schema" "package com.microsoft.bot.connector" . -r -q --include="*.java" + +robocopy .\generated ..\bot-connector\src\main\java\com\microsoft\bot\connector *.* /e /move From 05dd2cc45e18a1808c4f077d0617b6a2dc919717 Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Mon, 12 Aug 2019 08:17:27 -0500 Subject: [PATCH 10/12] Added .editorconfig --- .editorconfig | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..f2a76d595 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +# EditorConfig is awesome: http://EditorConfig.org +# File take from the VSCode repo at: +# https://github.com/Microsoft/vscode/blob/master/.editorconfig + +# top-most EditorConfig file +root = true + +# Tab indentation +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false From 9555b05c8c7d085418e7b4b03d5469480e3a7d9a Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Mon, 12 Aug 2019 09:56:55 -0500 Subject: [PATCH 11/12] Added PMD (as a linter test) to the projects. Botbuilder and Sample are skipped at present. --- .editorconfig | 3 ++ libraries/bot-connector/pom.xml | 3 -- .../microsoft/bot/connector/Attachments.java | 1 - .../bot/connector/Conversations.java | 1 - .../authentication/ChannelValidation.java | 1 - .../CredentialProviderImpl.java | 2 +- .../authentication/EmulatorValidation.java | 1 - .../authentication/JwtTokenExtractor.java | 4 -- .../authentication/JwtTokenValidation.java | 4 -- .../MicrosoftAppCredentials.java | 10 ++-- .../MicrosoftAppCredentialsInterceptor.java | 1 - .../connector/authentication/OAuthClient.java | 4 +- .../authentication/OAuthResponse.java | 3 +- .../implementation/ConnectorClientImpl.java | 2 - libraries/botbuilder-schema/pom.xml | 2 - .../microsoft/bot/schema/ActivityImpl.java | 30 ++++++------ .../com/microsoft/bot/schema/EntityImpl.java | 11 ++--- .../schema/models/ConversationAccount.java | 5 +- .../models/ConversationReferenceHelper.java | 2 +- libraries/botbuilder/pom.xml | 12 ++++- .../com/microsoft/bot/builder/BotAdapter.java | 1 - pom.xml | 49 +++++++++++++++++-- samples/bot-connector-sample/pom.xml | 10 ++++ 23 files changed, 97 insertions(+), 65 deletions(-) diff --git a/.editorconfig b/.editorconfig index f2a76d595..dabcc8d3a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -16,3 +16,6 @@ insert_final_newline = true [*.md] trim_trailing_whitespace = false + +[*.xml] +indent_size = 2 diff --git a/libraries/bot-connector/pom.xml b/libraries/bot-connector/pom.xml index ef7f3678c..c1493caa7 100644 --- a/libraries/bot-connector/pom.xml +++ b/libraries/bot-connector/pom.xml @@ -249,11 +249,8 @@ - - - diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Attachments.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Attachments.java index 7d1d86ecc..7c5cca1e2 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Attachments.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Attachments.java @@ -16,7 +16,6 @@ import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; import java.io.InputStream; -import java.io.IOException; import rx.Observable; /** diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Conversations.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Conversations.java index 3660d1f4f..e637aa7ce 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Conversations.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/Conversations.java @@ -21,7 +21,6 @@ import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; -import java.io.IOException; import java.util.List; import rx.Observable; diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/ChannelValidation.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/ChannelValidation.java index 24c886e79..c05c2949e 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/ChannelValidation.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/ChannelValidation.java @@ -4,7 +4,6 @@ package com.microsoft.bot.connector.authentication; import com.microsoft.aad.adal4j.AuthenticationException; -import com.microsoft.bot.connector.authentication.JwtTokenExtractor; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/CredentialProviderImpl.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/CredentialProviderImpl.java index 2d6eb1e01..779216470 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/CredentialProviderImpl.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/CredentialProviderImpl.java @@ -33,7 +33,7 @@ public CompletableFuture isValidAppIdAsync(String appId) { @Override public CompletableFuture getAppPasswordAsync(String appId) { - return CompletableFuture.completedFuture((this.appId.equals(appId) ? this.appPassword : null)); + return CompletableFuture.completedFuture(this.appId.equals(appId) ? this.appPassword : null); } @Override diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/EmulatorValidation.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/EmulatorValidation.java index 1a9bb9192..5de42af96 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/EmulatorValidation.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/EmulatorValidation.java @@ -6,7 +6,6 @@ import com.auth0.jwt.JWT; import com.auth0.jwt.interfaces.DecodedJWT; import com.microsoft.aad.adal4j.AuthenticationException; -import com.microsoft.bot.connector.authentication.JwtTokenExtractor; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenExtractor.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenExtractor.java index b49f78a7d..3273a846e 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenExtractor.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenExtractor.java @@ -9,9 +9,6 @@ import com.auth0.jwt.interfaces.DecodedJWT; import com.auth0.jwt.interfaces.Verification; import com.microsoft.aad.adal4j.AuthenticationException; -import com.microsoft.bot.connector.authentication.ClaimsIdentity; -import com.microsoft.bot.connector.authentication.ClaimsIdentityImpl; -import com.microsoft.bot.connector.authentication.TokenValidationParameters; import org.apache.commons.lang3.StringUtils; import java.util.HashMap; @@ -20,7 +17,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import java.util.function.Function; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenValidation.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenValidation.java index f19c5c36b..0c5ebd3dd 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenValidation.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/JwtTokenValidation.java @@ -3,11 +3,7 @@ package com.microsoft.bot.connector.authentication; -import com.auth0.jwt.interfaces.Claim; import com.microsoft.aad.adal4j.AuthenticationException; -import com.microsoft.bot.connector.authentication.MicrosoftAppCredentials; -import com.microsoft.bot.connector.authentication.ClaimsIdentityImpl; -import com.microsoft.bot.connector.authentication.EmulatorValidation; import com.microsoft.bot.schema.models.Activity; import java.util.concurrent.CompletableFuture; diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/MicrosoftAppCredentials.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/MicrosoftAppCredentials.java index bfc627315..f4c54e513 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/MicrosoftAppCredentials.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/MicrosoftAppCredentials.java @@ -31,11 +31,11 @@ public class MicrosoftAppCredentials implements ServiceClientCredentials { private String currentToken = null; private long expiredTime = 0; - private static final Object cacheSync = new Object(); + //private static final Object cacheSync = new Object(); protected static final HashMap cache = new HashMap(); - public final String OAuthEndpoint = AuthenticationConstants.ToChannelFromBotLoginUrl; - public final String OAuthScope = AuthenticationConstants.ToChannelFromBotOAuthScope; + public final String OAuthEndpoint = ToChannelFromBotLoginUrl; + public final String OAuthScope = ToChannelFromBotOAuthScope; public String getTokenCacheKey() { @@ -83,7 +83,7 @@ public String getToken(Request request) throws IOException { } - private boolean ShouldSetToken(String url) { + protected boolean ShouldSetToken(String url) { if (isTrustedServiceUrl(url)) { return true; } @@ -121,6 +121,8 @@ public static void trustServiceUrl(String serviceUrl, LocalDateTime expirationTi URL url = new URL(serviceUrl); trustServiceUrl(url, expirationTime); } catch (MalformedURLException e) { + //TODO: What's missing here? + e.printStackTrace(); } } diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/MicrosoftAppCredentialsInterceptor.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/MicrosoftAppCredentialsInterceptor.java index 48d3f0d3e..793ad89b5 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/MicrosoftAppCredentialsInterceptor.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/MicrosoftAppCredentialsInterceptor.java @@ -3,7 +3,6 @@ package com.microsoft.bot.connector.authentication; -import com.microsoft.bot.connector.authentication.MicrosoftAppCredentials; import okhttp3.Interceptor; import okhttp3.Request; import okhttp3.Response; diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/OAuthClient.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/OAuthClient.java index 902a21221..3263c79c8 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/OAuthClient.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/OAuthClient.java @@ -84,7 +84,7 @@ protected URI MakeUri(String uri, HashMap queryStrings) throws U throw new RuntimeException(e); } }) - .collect(joining("&", (uri.endsWith("?") ? uri : uri + "?"), "")); + .collect(joining("&", uri.endsWith("?") ? uri : uri + "?", "")); return new URI(newUri); @@ -177,8 +177,6 @@ public CompletableFuture SignOutUserAsync(String userId, String connect } return CompletableFuture.supplyAsync(() -> { - String invocationId = null; - // Construct URL HashMap qstrings = new HashMap<>(); qstrings.put("userId", userId); diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/OAuthResponse.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/OAuthResponse.java index 7b589f57a..858889d07 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/OAuthResponse.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/OAuthResponse.java @@ -1,7 +1,6 @@ package com.microsoft.bot.connector.authentication; -import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty; import org.joda.time.DateTime; @@ -43,6 +42,6 @@ public OAuthResponse withExpirationTime(DateTime expirationTime) { } @JsonAnySetter - private HashMap properties; + public HashMap properties; } diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/implementation/ConnectorClientImpl.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/implementation/ConnectorClientImpl.java index 042ac1d86..5f9cb7381 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/implementation/ConnectorClientImpl.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/implementation/ConnectorClientImpl.java @@ -11,7 +11,6 @@ import com.microsoft.azure.AzureServiceClient; import com.microsoft.bot.connector.Attachments; import com.microsoft.bot.connector.ConnectorClient; -import com.microsoft.bot.connector.Conversations; import com.microsoft.rest.credentials.ServiceClientCredentials; import com.microsoft.rest.RestClient; import com.microsoft.rest.retry.RetryStrategy; @@ -19,7 +18,6 @@ import java.io.IOException; import java.io.InputStream; import java.util.Properties; -import java.util.stream.Stream; /** * Initializes a new instance of the ConnectorClientImpl class. diff --git a/libraries/botbuilder-schema/pom.xml b/libraries/botbuilder-schema/pom.xml index 8c98f3221..479096fc4 100644 --- a/libraries/botbuilder-schema/pom.xml +++ b/libraries/botbuilder-schema/pom.xml @@ -197,10 +197,8 @@ - - diff --git a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/ActivityImpl.java b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/ActivityImpl.java index 756deb39d..67a8267aa 100644 --- a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/ActivityImpl.java +++ b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/ActivityImpl.java @@ -4,8 +4,6 @@ import com.fasterxml.jackson.core.TreeNode; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.bot.schema.ContactRelationUpdateActivity; -import com.microsoft.bot.schema.TraceActivity; import com.microsoft.bot.schema.models.*; @@ -79,7 +77,7 @@ public ActivityImpl CreateReply(String text, String locale) { * @param value value of the operation * @param valueType valueType if helpful to identify the value schema (default is value.GetType().Name) * @param label descritive label of context. (Default is calling function name) - * @return + * @return */ public TraceActivity CreateTrace(String name) { return CreateTrace(name, null, null, null); @@ -160,7 +158,7 @@ public static MessageActivity CreateMessageActivity() { reply.withType(ActivityTypes.TRACE); reply.withTimestamp(DateTime.now()); reply.withAttachments(new ArrayList()); - reply.withEntities(new ArrayList());; + reply.withEntities(new ArrayList()); return reply; } @@ -624,31 +622,31 @@ public ContactRelationUpdateActivity AsContactRelationUpdateActivity() { /** * Return an IMessageUpdateAcitvity if this is a MessageUpdate activity - * @return + * @return */ //public IMessageUpdateActivity AsMessageUpdateActivity() { return IsActivity(ActivityTypes.MessageUpdate) ? this : null; } /** * Return an IMessageDeleteActivity if this is a MessageDelete activity - * @return + * @return */ //public IMessageDeleteActivity AsMessageDeleteActivity() { return IsActivity(ActivityTypes.MessageDelete) ? this : null; } /** * Return an IMessageReactionActivity if this is a MessageReaction activity - * @return + * @return */ //public IMessageReactionActivity AsMessageReactionActivity() { return IsActivity(ActivityTypes.MessageReaction) ? this : null; } /** * Return an ISuggestionActivity if this is a Suggestion activity - * @return + * @return */ //public ISuggestionActivity AsSuggestionActivity() { return IsActivity(ActivityTypes.Suggestion) ? this : null; } /** * Return an ITraceActivity if this is a Trace activity - * @return + * @return */ //public ITraceActivity AsTraceActivity() { return IsActivity(ActivityTypes.Trace) ? this : null; } @@ -672,7 +670,7 @@ public boolean HasContent() { return false; } - private Mention convertToMention(JsonNode node) { + public Mention convertToMention(JsonNode node) { try { return ActivityImpl.mapper.treeToValue(node, Mention.class); } catch (JsonProcessingException e) { @@ -697,7 +695,7 @@ public ArrayList GetMentions() { /** * Get channeldata as typed structure - * @param activity + * @param activity * @param TypeT type to use * @return typed Object or default(TypeT) */ @@ -706,7 +704,7 @@ public TypeT GetChannelData(Class classType) throws JsonProcessin return null; if (classType.isInstance(this.channelData())) { - return ((TypeT) this.channelData()); + return (TypeT) this.channelData(); } JsonNode node = mapper.valueToTree(this.channelData()); return mapper.treeToValue((TreeNode) node, classType); @@ -714,10 +712,10 @@ public TypeT GetChannelData(Class classType) throws JsonProcessin /** * Get channeldata as typed structure - * @param activity + * @param activity * @param TypeT type to use * @param instance The resulting instance, if possible - * @return + * @return * {@code true} if value of {@linkalso Activity.ChannelData} was coerceable to {@code TypeT}, {@code false} otherwise. */ @@ -734,8 +732,8 @@ public ResultPair TryGetChannelData(Class clsType return new ResultPair(true, instance); } /** - * Clone a activity - * @param activity + * Clone a activity + * @param activity * @return new cloned activity */ public static Activity CloneActity(Activity activity) { diff --git a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/EntityImpl.java b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/EntityImpl.java index 2fa6fc755..e7daf1266 100644 --- a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/EntityImpl.java +++ b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/EntityImpl.java @@ -77,11 +77,11 @@ public void setProperties(String key, JsonNode value) { */ /** - * @param T + * @param T */ /** - * @return + * @return */ public T GetAs(Class type) { @@ -112,8 +112,8 @@ public T GetAs(Class type) { /** * Set internal payload. - * @param T - * @param obj + * @param T + * @param obj */ public boolean SetAs(T obj) { @@ -142,6 +142,5 @@ public boolean SetAs(T obj) { return true; } - -}; +} diff --git a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/models/ConversationAccount.java b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/models/ConversationAccount.java index 46f83368c..d7bfebcb5 100644 --- a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/models/ConversationAccount.java +++ b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/models/ConversationAccount.java @@ -8,9 +8,6 @@ package com.microsoft.bot.schema.models; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.JsonNode; - -import java.util.HashMap; /** * Channel account information for a conversation. @@ -155,7 +152,7 @@ public ConversationAccount withRole(RoleTypes role) { * while maintaining the object. * */ - private HashMap properties = new HashMap(); +// private HashMap properties = new HashMap(); /** * Overflow properties. diff --git a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/models/ConversationReferenceHelper.java b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/models/ConversationReferenceHelper.java index 3d1e0c76d..34c62ff84 100644 --- a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/models/ConversationReferenceHelper.java +++ b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/models/ConversationReferenceHelper.java @@ -18,7 +18,7 @@ public ActivityImpl GetPostToBotMessage() .withType(ActivityTypes.MESSAGE) .withId(UUID.randomUUID().toString()) .withRecipient(new ChannelAccount() - .withId((reference.bot().id())) + .withId(reference.bot().id()) .withName(reference.bot().name())) .withChannelId(reference.channelId()) .withServiceUrl(reference.serviceUrl()) diff --git a/libraries/botbuilder/pom.xml b/libraries/botbuilder/pom.xml index 3bd67b922..6aa0c64c0 100644 --- a/libraries/botbuilder/pom.xml +++ b/libraries/botbuilder/pom.xml @@ -181,6 +181,16 @@ true + + org.apache.maven.plugins + maven-pmd-plugin + + true + + **/** + + + @@ -265,10 +275,8 @@ - - diff --git a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/BotAdapter.java b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/BotAdapter.java index 59f6a5405..609b89356 100644 --- a/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/BotAdapter.java +++ b/libraries/botbuilder/src/main/java/com/microsoft/bot/builder/BotAdapter.java @@ -135,7 +135,6 @@ protected void RunPipeline(TurnContext context, Consumer callback) callback.accept(context); } } - return; } diff --git a/pom.xml b/pom.xml index 8fbc7e672..f29e356fb 100644 --- a/pom.xml +++ b/pom.xml @@ -4,18 +4,31 @@ com.microsoft.bot bot-parent 4.0.0-a0 - + pom - + Microsoft BotBuilder SDK Parent This package contains the parent module of Microsoft BotBuilder SDK. https://github.com/Microsoft/botbuilder-java - + UTF-8 true + + + build + + true + + + + + + + + libraries/botbuilder-schema libraries/botbuilder @@ -66,7 +79,33 @@ true + + + org.apache.maven.plugins + maven-pmd-plugin + 3.12.0 + + true + + + + + check + + + + - - \ No newline at end of file + + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.12.0 + + + + + diff --git a/samples/bot-connector-sample/pom.xml b/samples/bot-connector-sample/pom.xml index 342f7ea28..1eb6aebdf 100644 --- a/samples/bot-connector-sample/pom.xml +++ b/samples/bot-connector-sample/pom.xml @@ -125,6 +125,16 @@ true + + org.apache.maven.plugins + maven-pmd-plugin + + true + + **/** + + + From 37f0b576d8cf8e47263d6e3e6876eb8fa833a484 Mon Sep 17 00:00:00 2001 From: Tracy Boehrer Date: Mon, 12 Aug 2019 10:47:15 -0500 Subject: [PATCH 12/12] Forcing PMD check during validation phase. --- libraries/bot-connector/pom.xml | 14 ++++++++++- .../authentication/ChannelValidation.java | 20 +++++++--------- .../authentication/EmulatorValidation.java | 24 +++++++++---------- libraries/botbuilder-schema/pom.xml | 12 ++++++++++ .../microsoft/bot/schema/ActivityImpl.java | 16 ++++++++++--- pom.xml | 2 ++ 6 files changed, 60 insertions(+), 28 deletions(-) diff --git a/libraries/bot-connector/pom.xml b/libraries/bot-connector/pom.xml index c1493caa7..61d5c4e4f 100644 --- a/libraries/bot-connector/pom.xml +++ b/libraries/bot-connector/pom.xml @@ -164,7 +164,19 @@ true - + + org.apache.maven.plugins + maven-pmd-plugin + + + validate + + check + + + + + diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/ChannelValidation.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/ChannelValidation.java index c05c2949e..0bd10c642 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/ChannelValidation.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/ChannelValidation.java @@ -8,8 +8,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import static com.microsoft.bot.connector.authentication.AuthenticationConstants.*; - public class ChannelValidation { /** * TO BOT FROM CHANNEL: Token validation parameters when connecting to a bot @@ -26,9 +24,9 @@ public class ChannelValidation { */ public static CompletableFuture authenticateToken(String authHeader, CredentialProvider credentials, String channelId) throws ExecutionException, InterruptedException, AuthenticationException { JwtTokenExtractor tokenExtractor = new JwtTokenExtractor( - ToBotFromChannelTokenValidationParameters, - ToBotFromChannelOpenIdMetadataUrl, - AllowedSigningAlgorithms); + ToBotFromChannelTokenValidationParameters, + AuthenticationConstants.ToBotFromChannelOpenIdMetadataUrl, + AuthenticationConstants.AllowedSigningAlgorithms); ClaimsIdentity identity = tokenExtractor.getIdentityAsync(authHeader, channelId).get(); if (identity == null) { @@ -47,13 +45,13 @@ public static CompletableFuture authenticateToken(String authHea // Async validation. // Look for the "aud" claim, but only if issued from the Bot Framework - if (!identity.getIssuer().equalsIgnoreCase(ToBotFromChannelTokenIssuer)) { + if (!identity.getIssuer().equalsIgnoreCase(AuthenticationConstants.ToBotFromChannelTokenIssuer)) { throw new AuthenticationException("Token Not Authenticated"); } // The AppId from the claim in the token must match the AppId specified by the developer. Note that // the Bot Framework uses the Audience claim ("aud") to pass the AppID. - String appIdFromClaim = identity.claims().get(AudienceClaim); + String appIdFromClaim = identity.claims().get(AuthenticationConstants.AudienceClaim); if (appIdFromClaim == null || appIdFromClaim.isEmpty()) { // Claim is present, but doesn't have a value. Not Authorized. throw new AuthenticationException("Token Not Authenticated"); @@ -78,14 +76,14 @@ public static CompletableFuture authenticateToken(String authHea public static CompletableFuture authenticateToken(String authHeader,CredentialProvider credentials, String channelId, String serviceUrl) throws ExecutionException, InterruptedException, AuthenticationException { ClaimsIdentity identity = ChannelValidation.authenticateToken(authHeader, credentials, channelId).get(); - if (!identity.claims().containsKey(ServiceUrlClaim)) { + if (!identity.claims().containsKey(AuthenticationConstants.ServiceUrlClaim)) { // Claim must be present. Not Authorized. - throw new AuthenticationException(String.format("'%s' claim is required on Channel Token.", ServiceUrlClaim)); + throw new AuthenticationException(String.format("'%s' claim is required on Channel Token.", AuthenticationConstants.ServiceUrlClaim)); } - if (!serviceUrl.equalsIgnoreCase(identity.claims().get(ServiceUrlClaim))) { + if (!serviceUrl.equalsIgnoreCase(identity.claims().get(AuthenticationConstants.ServiceUrlClaim))) { // Claim must match. Not Authorized. - throw new AuthenticationException(String.format("'%s' claim does not match service url provided (%s).", ServiceUrlClaim, serviceUrl)); + throw new AuthenticationException(String.format("'%s' claim does not match service url provided (%s).", AuthenticationConstants.ServiceUrlClaim, serviceUrl)); } return CompletableFuture.completedFuture(identity); diff --git a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/EmulatorValidation.java b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/EmulatorValidation.java index 5de42af96..c63842f86 100644 --- a/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/EmulatorValidation.java +++ b/libraries/bot-connector/src/main/java/com/microsoft/bot/connector/authentication/EmulatorValidation.java @@ -10,8 +10,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import static com.microsoft.bot.connector.authentication.AuthenticationConstants.*; - /** * Validates and Examines JWT tokens from the Bot Framework Emulator */ @@ -77,8 +75,8 @@ public static CompletableFuture isTokenFromEmulator(String authHeader) public static CompletableFuture authenticateToken(String authHeader, CredentialProvider credentials, String channelId) throws ExecutionException, InterruptedException, AuthenticationException { JwtTokenExtractor tokenExtractor = new JwtTokenExtractor( ToBotFromEmulatorTokenValidationParameters, - ToBotFromEmulatorOpenIdMetadataUrl, - AllowedSigningAlgorithms); + AuthenticationConstants.ToBotFromEmulatorOpenIdMetadataUrl, + AuthenticationConstants.AllowedSigningAlgorithms); ClaimsIdentity identity = tokenExtractor.getIdentityAsync(authHeader, channelId).get(); if (identity == null) { @@ -95,11 +93,11 @@ public static CompletableFuture authenticateToken(String authHea // what we're looking for. Note that in a multi-tenant bot, this value // comes from developer code that may be reaching out to a service, hence the // Async validation. - if (!identity.claims().containsKey(VersionClaim)) { - throw new AuthenticationException(String.format("'%s' claim is required on Emulator Tokens.", VersionClaim)); + if (!identity.claims().containsKey(AuthenticationConstants.VersionClaim)) { + throw new AuthenticationException(String.format("'%s' claim is required on Emulator Tokens.", AuthenticationConstants.VersionClaim)); } - String tokenVersion = identity.claims().get(VersionClaim); + String tokenVersion = identity.claims().get(AuthenticationConstants.VersionClaim); String appId = ""; // The Emulator, depending on Version, sends the AppId via either the @@ -107,20 +105,20 @@ public static CompletableFuture authenticateToken(String authHea if (tokenVersion.isEmpty() || tokenVersion.equalsIgnoreCase("1.0")) { // either no Version or a version of "1.0" means we should look for // the claim in the "appid" claim. - if (!identity.claims().containsKey(AppIdClaim)) { + if (!identity.claims().containsKey(AuthenticationConstants.AppIdClaim)) { // No claim around AppID. Not Authorized. - throw new AuthenticationException(String.format("'%s' claim is required on Emulator Token version '1.0'.", AppIdClaim)); + throw new AuthenticationException(String.format("'%s' claim is required on Emulator Token version '1.0'.", AuthenticationConstants.AppIdClaim)); } - appId = identity.claims().get(AppIdClaim); + appId = identity.claims().get(AuthenticationConstants.AppIdClaim); } else if (tokenVersion.equalsIgnoreCase("2.0")) { // Emulator, "2.0" puts the AppId in the "azp" claim. - if (!identity.claims().containsKey(AuthorizedParty)) { + if (!identity.claims().containsKey(AuthenticationConstants.AuthorizedParty)) { // No claim around AppID. Not Authorized. - throw new AuthenticationException(String.format("'%s' claim is required on Emulator Token version '2.0'.", AuthorizedParty)); + throw new AuthenticationException(String.format("'%s' claim is required on Emulator Token version '2.0'.", AuthenticationConstants.AuthorizedParty)); } - appId = identity.claims().get(AuthorizedParty); + appId = identity.claims().get(AuthenticationConstants.AuthorizedParty); } else { // Unknown Version. Not Authorized. throw new AuthenticationException(String.format("Unknown Emulator Token version '%s'.", tokenVersion)); diff --git a/libraries/botbuilder-schema/pom.xml b/libraries/botbuilder-schema/pom.xml index 479096fc4..98aa8bc7e 100644 --- a/libraries/botbuilder-schema/pom.xml +++ b/libraries/botbuilder-schema/pom.xml @@ -125,6 +125,18 @@ true + + org.apache.maven.plugins + maven-pmd-plugin + + + validate + + check + + + + diff --git a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/ActivityImpl.java b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/ActivityImpl.java index 67a8267aa..bd22eba9f 100644 --- a/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/ActivityImpl.java +++ b/libraries/botbuilder-schema/src/main/java/com/microsoft/bot/schema/ActivityImpl.java @@ -4,9 +4,19 @@ import com.fasterxml.jackson.core.TreeNode; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.bot.schema.models.*; - - +import com.microsoft.bot.schema.models.Activity; +import com.microsoft.bot.schema.models.ActivityTypes; +import com.microsoft.bot.schema.models.Attachment; +import com.microsoft.bot.schema.models.ChannelAccount; +import com.microsoft.bot.schema.models.ConversationAccount; +import com.microsoft.bot.schema.models.ConversationReference; +import com.microsoft.bot.schema.models.ConversationUpdateActivity; +import com.microsoft.bot.schema.models.EndOfConversationCodes; +import com.microsoft.bot.schema.models.InputHints; +import com.microsoft.bot.schema.models.Mention; +import com.microsoft.bot.schema.models.MessageActivity; +import com.microsoft.bot.schema.models.SuggestedActions; +import com.microsoft.bot.schema.models.TextHighlight; import org.apache.commons.lang3.StringUtils; import org.joda.time.DateTime; diff --git a/pom.xml b/pom.xml index f29e356fb..10d917110 100644 --- a/pom.xml +++ b/pom.xml @@ -85,10 +85,12 @@ maven-pmd-plugin 3.12.0 + true true + validate check