botframework-connector
Version:
Bot Connector is autorest generated connector client.
444 lines • 13.2 kB
JavaScript
"use strict";
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Conversations = void 0;
const Mappers = __importStar(require("../models/conversationsMappers"));
const Parameters = __importStar(require("../models/parameters"));
const core_http_1 = require("@azure/core-http");
const conversationConstants_1 = require("../../conversationConstants");
/** Class representing a Conversations. */
class Conversations {
/**
* Create a Conversations.
* @param {ConnectorClientContext} client Reference to the service client.
*/
constructor(client) {
this.client = client;
}
getConversations(options, callback) {
return this.client.sendOperationRequest({
options
}, getConversationsOperationSpec, callback);
}
createConversation(parameters, options, callback) {
return this.client.sendOperationRequest({
parameters,
options
}, createConversationOperationSpec, callback);
}
sendToConversation(conversationId, activity, options, callback) {
return this.client.sendOperationRequest({
conversationId,
activity,
options
}, sendToConversationOperationSpec, callback);
}
sendConversationHistory(conversationId, history, options, callback) {
return this.client.sendOperationRequest({
conversationId,
history,
options
}, sendConversationHistoryOperationSpec, callback);
}
updateActivity(conversationId, activityId, activity, options, callback) {
return this.client.sendOperationRequest({
conversationId,
activityId,
activity,
options
}, updateActivityOperationSpec, callback);
}
replyToActivity(conversationId, activityId, activity, options, callback) {
return this.client.sendOperationRequest({
conversationId,
activityId,
activity,
options
}, replyToActivityOperationSpec, callback);
}
deleteActivity(conversationId, activityId, options, callback) {
return this.client.sendOperationRequest({
conversationId,
activityId,
options
}, deleteActivityOperationSpec, callback);
}
getConversationMembers(conversationId, options, callback) {
return this.client.sendOperationRequest({
conversationId,
options
}, getConversationMembersOperationSpec, callback);
}
/**
* @param conversationId Conversation ID
* @param memberId MemberId for the user
* @param options The optional parameters
* @param callback The callback
*/
getConversationMember(conversationId, memberId, options, callback) {
return this.client.sendOperationRequest({
conversationId,
memberId,
options
}, getConversationMemberOperationSpec, callback);
}
getConversationPagedMembers(conversationId, options, callback) {
return this.client.sendOperationRequest({
conversationId,
options
}, getConversationPagedMembersOperationSpec, callback);
}
deleteConversationMember(conversationId, memberId, options, callback) {
return this.client.sendOperationRequest({
conversationId,
memberId,
options
}, deleteConversationMemberOperationSpec, callback);
}
getActivityMembers(conversationId, activityId, options, callback) {
return this.client.sendOperationRequest({
conversationId,
activityId,
options
}, getActivityMembersOperationSpec, callback);
}
uploadAttachment(conversationId, attachmentUpload, options, callback) {
return this.client.sendOperationRequest({
conversationId,
attachmentUpload,
options
}, uploadAttachmentOperationSpec, callback);
}
}
exports.Conversations = Conversations;
// Operation Specifications
const serializer = new core_http_1.Serializer(Mappers);
const getConversationsOperationSpec = {
httpMethod: "GET",
path: "v3/conversations",
queryParameters: [
Parameters.continuationToken
],
responses: {
200: {
bodyMapper: Mappers.ConversationsResult
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};
const createConversationOperationSpec = {
httpMethod: "POST",
path: "v3/conversations",
requestBody: {
parameterPath: "parameters",
mapper: Object.assign(Object.assign({}, Mappers.ConversationParameters), { required: true })
},
responses: {
200: {
bodyMapper: Mappers.ConversationResourceResponse
},
201: {
bodyMapper: Mappers.ConversationResourceResponse
},
202: {
bodyMapper: Mappers.ConversationResourceResponse
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};
const sendToConversationOperationSpec = {
httpMethod: "POST",
path: "v3/conversations/{conversationId}/activities",
urlParameters: [
Parameters.conversationId
],
requestBody: {
parameterPath: "activity",
mapper: Object.assign(Object.assign({}, Mappers.Activity), { required: true })
},
responses: {
200: {
bodyMapper: Mappers.ResourceResponse
},
201: {
bodyMapper: Mappers.ResourceResponse
},
202: {
bodyMapper: Mappers.ResourceResponse
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};
const sendConversationHistoryOperationSpec = {
httpMethod: "POST",
path: "v3/conversations/{conversationId}/activities/history",
urlParameters: [
Parameters.conversationId
],
requestBody: {
parameterPath: "history",
mapper: Object.assign(Object.assign({}, Mappers.Transcript), { required: true })
},
responses: {
200: {
bodyMapper: Mappers.ResourceResponse
},
201: {
bodyMapper: Mappers.ResourceResponse
},
202: {
bodyMapper: Mappers.ResourceResponse
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};
const updateActivityOperationSpec = {
httpMethod: "PUT",
path: "v3/conversations/{conversationId}/activities/{activityId}",
urlParameters: [
Parameters.conversationId,
Parameters.activityId
],
requestBody: {
parameterPath: "activity",
mapper: Object.assign(Object.assign({}, Mappers.Activity), { required: true })
},
responses: {
200: {
bodyMapper: Mappers.ResourceResponse
},
201: {
bodyMapper: Mappers.ResourceResponse
},
202: {
bodyMapper: Mappers.ResourceResponse
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};
const replyToActivityOperationSpec = {
httpMethod: "POST",
path: "v3/conversations/{conversationId}/activities/{activityId}",
urlParameters: [
Parameters.conversationId,
Parameters.activityId
],
headerParameters: [{
parameterPath: 'conversationId',
mapper: {
serializedName: conversationConstants_1.ConversationIdHttpHeaderName,
type: {
name: 'String'
}
},
}],
requestBody: {
parameterPath: "activity",
mapper: Object.assign(Object.assign({}, Mappers.Activity), { required: true })
},
responses: {
200: {
bodyMapper: Mappers.ResourceResponse
},
201: {
bodyMapper: Mappers.ResourceResponse
},
202: {
bodyMapper: Mappers.ResourceResponse
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};
const deleteActivityOperationSpec = {
httpMethod: "DELETE",
path: "v3/conversations/{conversationId}/activities/{activityId}",
urlParameters: [
Parameters.conversationId,
Parameters.activityId
],
responses: {
200: {},
202: {},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};
const getConversationMembersOperationSpec = {
httpMethod: "GET",
path: "v3/conversations/{conversationId}/members",
urlParameters: [
Parameters.conversationId
],
responses: {
200: {
bodyMapper: {
serializedName: "parsedResponse",
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className: "ChannelAccount"
}
}
}
}
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};
const getConversationMemberOperationSpec = {
httpMethod: "GET",
path: "v3/conversations/{conversationId}/members/{memberId}",
urlParameters: [
Parameters.conversationId,
Parameters.memberId
],
responses: {
200: {
bodyMapper: Mappers.ChannelAccount,
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};
const getConversationPagedMembersOperationSpec = {
httpMethod: "GET",
path: "v3/conversations/{conversationId}/pagedmembers",
urlParameters: [
Parameters.conversationId
],
queryParameters: [
Parameters.pageSize,
Parameters.continuationToken
],
responses: {
200: {
bodyMapper: Mappers.PagedMembersResult
},
default: {}
},
serializer
};
const deleteConversationMemberOperationSpec = {
httpMethod: "DELETE",
path: "v3/conversations/{conversationId}/members/{memberId}",
urlParameters: [
Parameters.conversationId,
Parameters.memberId
],
responses: {
200: {},
204: {},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};
const getActivityMembersOperationSpec = {
httpMethod: "GET",
path: "v3/conversations/{conversationId}/activities/{activityId}/members",
urlParameters: [
Parameters.conversationId,
Parameters.activityId
],
responses: {
200: {
bodyMapper: {
serializedName: "parsedResponse",
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className: "ChannelAccount"
}
}
}
}
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};
const uploadAttachmentOperationSpec = {
httpMethod: "POST",
path: "v3/conversations/{conversationId}/attachments",
urlParameters: [
Parameters.conversationId
],
requestBody: {
parameterPath: "attachmentUpload",
mapper: Object.assign(Object.assign({}, Mappers.AttachmentData), { required: true })
},
responses: {
200: {
bodyMapper: Mappers.ResourceResponse
},
201: {
bodyMapper: Mappers.ResourceResponse
},
202: {
bodyMapper: Mappers.ResourceResponse
},
default: {
bodyMapper: Mappers.ErrorResponse
}
},
serializer
};
//# sourceMappingURL=conversations.js.map