From 946c7fe9ef02b0cbd601766d29c20557ad68d5ad Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 16 Nov 2018 10:38:28 +0000 Subject: [PATCH] Generated from 74a8aad67a395af739af66dd6550936534b04ca1 Adding md files for other langs --- .../cognitiveservices-qnamaker/LICENSE.txt | 21 + .../cognitiveservices-qnamaker/README.md | 77 ++ .../lib/models/alterationsMappers.ts | 19 + .../lib/models/endpointMappers.ts | 18 + .../lib/models/index.ts | 819 ++++++++++++++++ .../lib/models/knowledgebaseMappers.ts | 39 + .../lib/models/mappers.ts | 909 ++++++++++++++++++ .../lib/models/operationsMappers.ts | 19 + .../lib/models/parameters.ts | 68 ++ .../lib/operations/alterations.ts | 121 +++ .../lib/operations/endpoint.ts | 117 +++ .../lib/operations/index.ts | 14 + .../lib/operations/knowledgebase.ts | 424 ++++++++ .../lib/operations/operations.ts | 77 ++ .../lib/qnAMakerClient.ts | 48 + .../lib/qnAMakerClientContext.ts | 51 + .../cognitiveservices-qnamaker/package.json | 54 ++ .../rollup.config.js | 31 + .../cognitiveservices-qnamaker/tsconfig.json | 19 + 19 files changed, 2945 insertions(+) create mode 100644 packages/@azure/cognitiveservices-qnamaker/LICENSE.txt create mode 100644 packages/@azure/cognitiveservices-qnamaker/README.md create mode 100644 packages/@azure/cognitiveservices-qnamaker/lib/models/alterationsMappers.ts create mode 100644 packages/@azure/cognitiveservices-qnamaker/lib/models/endpointMappers.ts create mode 100644 packages/@azure/cognitiveservices-qnamaker/lib/models/index.ts create mode 100644 packages/@azure/cognitiveservices-qnamaker/lib/models/knowledgebaseMappers.ts create mode 100644 packages/@azure/cognitiveservices-qnamaker/lib/models/mappers.ts create mode 100644 packages/@azure/cognitiveservices-qnamaker/lib/models/operationsMappers.ts create mode 100644 packages/@azure/cognitiveservices-qnamaker/lib/models/parameters.ts create mode 100644 packages/@azure/cognitiveservices-qnamaker/lib/operations/alterations.ts create mode 100644 packages/@azure/cognitiveservices-qnamaker/lib/operations/endpoint.ts create mode 100644 packages/@azure/cognitiveservices-qnamaker/lib/operations/index.ts create mode 100644 packages/@azure/cognitiveservices-qnamaker/lib/operations/knowledgebase.ts create mode 100644 packages/@azure/cognitiveservices-qnamaker/lib/operations/operations.ts create mode 100644 packages/@azure/cognitiveservices-qnamaker/lib/qnAMakerClient.ts create mode 100644 packages/@azure/cognitiveservices-qnamaker/lib/qnAMakerClientContext.ts create mode 100644 packages/@azure/cognitiveservices-qnamaker/package.json create mode 100644 packages/@azure/cognitiveservices-qnamaker/rollup.config.js create mode 100644 packages/@azure/cognitiveservices-qnamaker/tsconfig.json diff --git a/packages/@azure/cognitiveservices-qnamaker/LICENSE.txt b/packages/@azure/cognitiveservices-qnamaker/LICENSE.txt new file mode 100644 index 000000000000..5431ba98b936 --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/@azure/cognitiveservices-qnamaker/README.md b/packages/@azure/cognitiveservices-qnamaker/README.md new file mode 100644 index 000000000000..9852b21a1779 --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/README.md @@ -0,0 +1,77 @@ +# An isomorphic javascript sdk for - QnAMakerClient +This project provides an isomorphic javascript package. Right now it supports: +- node.js version 6.x.x or higher +- browser javascript + +## How to Install + +- nodejs +``` +npm install @azure/cognitiveservices-qnamaker +``` +- browser +```html + +``` + +## How to use + +### nodejs - Authentication, client creation and getKeys endpoint as an example written in TypeScript. + +```ts +import * as msRest from "ms-rest-js"; +import * as msRestNodeAuth from "ms-rest-nodeauth"; +import { QnAMakerClient, QnAMakerModels, QnAMakerMappers } from "@azure/cognitiveservices-qnamaker"; +const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; + +msRestNodeAuth.interactiveLogin().then((creds) => { + const client = new QnAMakerClient(creds, subscriptionId); + client.endpoint.getKeys().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.error(err); +}); +``` + +### browser - Authentication, client creation and getKeys endpoint as an example written in javascript. + +- index.html +```html + + + + @azure/cognitiveservices-qnamaker sample + + + + + + + + +``` + +# Related projects + - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) diff --git a/packages/@azure/cognitiveservices-qnamaker/lib/models/alterationsMappers.ts b/packages/@azure/cognitiveservices-qnamaker/lib/models/alterationsMappers.ts new file mode 100644 index 000000000000..a737ed6f2f79 --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/lib/models/alterationsMappers.ts @@ -0,0 +1,19 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export { + WordAlterationsDTO, + AlterationsDTO, + ErrorResponse, + ErrorResponseError, + ErrorModel, + InnerErrorModel +} from "../models/mappers"; + diff --git a/packages/@azure/cognitiveservices-qnamaker/lib/models/endpointMappers.ts b/packages/@azure/cognitiveservices-qnamaker/lib/models/endpointMappers.ts new file mode 100644 index 000000000000..2dc26823cf5b --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/lib/models/endpointMappers.ts @@ -0,0 +1,18 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export { + EndpointKeysDTO, + ErrorResponse, + ErrorResponseError, + ErrorModel, + InnerErrorModel +} from "../models/mappers"; + diff --git a/packages/@azure/cognitiveservices-qnamaker/lib/models/index.ts b/packages/@azure/cognitiveservices-qnamaker/lib/models/index.ts new file mode 100644 index 000000000000..0c70559dd551 --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/lib/models/index.ts @@ -0,0 +1,819 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "ms-rest-js"; + + +/** + * @interface + * An interface representing CreateKbInputDTO. + * Input to create KB. + * + */ +export interface CreateKbInputDTO { + /** + * @member {QnADTO[]} [qnaList] List of QNA to be added to the index. Ids are + * generated by the service and should be omitted. + */ + qnaList?: QnADTO[]; + /** + * @member {string[]} [urls] List of URLs to be added to knowledgebase. + */ + urls?: string[]; + /** + * @member {FileDTO[]} [files] List of files to be added to knowledgebase. + */ + files?: FileDTO[]; +} + +/** + * @interface + * An interface representing UpdateKbOperationDTOAdd. + * An instance of CreateKbInputDTO for add operation + * + * @extends CreateKbInputDTO + */ +export interface UpdateKbOperationDTOAdd extends CreateKbInputDTO { +} + +/** + * @interface + * An interface representing DeleteKbContentsDTO. + * PATCH body schema of Delete Operation in UpdateKb + * + */ +export interface DeleteKbContentsDTO { + /** + * @member {number[]} [ids] List of Qna Ids to be deleted + */ + ids?: number[]; + /** + * @member {string[]} [sources] List of sources to be deleted from + * knowledgebase. + */ + sources?: string[]; +} + +/** + * @interface + * An interface representing UpdateKbOperationDTODelete. + * An instance of DeleteKbContentsDTO for delete Operation + * + * @extends DeleteKbContentsDTO + */ +export interface UpdateKbOperationDTODelete extends DeleteKbContentsDTO { +} + +/** + * @interface + * An interface representing UpdateKbContentsDTO. + * PATCH body schema for Update operation in Update Kb + * + */ +export interface UpdateKbContentsDTO { + /** + * @member {string} [name] Friendly name for the knowledgebase. + */ + name?: string; + /** + * @member {UpdateQnaDTO[]} [qnaList] List of Q-A (UpdateQnaDTO) to be added + * to the knowledgebase. + */ + qnaList?: UpdateQnaDTO[]; + /** + * @member {string[]} [urls] List of existing URLs to be refreshed. The + * content will be extracted again and re-indexed. + */ + urls?: string[]; +} + +/** + * @interface + * An interface representing UpdateKbOperationDTOUpdate. + * An instance of UpdateKbContentsDTO for Update Operation + * + * @extends UpdateKbContentsDTO + */ +export interface UpdateKbOperationDTOUpdate extends UpdateKbContentsDTO { +} + +/** + * @interface + * An interface representing UpdateKbOperationDTO. + * Contains list of QnAs to be updated + * + */ +export interface UpdateKbOperationDTO { + /** + * @member {UpdateKbOperationDTOAdd} [add] An instance of CreateKbInputDTO + * for add operation + */ + add?: UpdateKbOperationDTOAdd; + /** + * @member {UpdateKbOperationDTODelete} [deleteProperty] An instance of + * DeleteKbContentsDTO for delete Operation + */ + deleteProperty?: UpdateKbOperationDTODelete; + /** + * @member {UpdateKbOperationDTOUpdate} [update] An instance of + * UpdateKbContentsDTO for Update Operation + */ + update?: UpdateKbOperationDTOUpdate; +} + +/** + * @interface + * An interface representing UpdateQuestionsDTO. + * PATCH Body schema for Update Kb which contains list of questions to be added + * and deleted + * + */ +export interface UpdateQuestionsDTO { + /** + * @member {string[]} [add] List of questions to be added + */ + add?: string[]; + /** + * @member {string[]} [deleteProperty] List of questions to be deleted. + */ + deleteProperty?: string[]; +} + +/** + * @interface + * An interface representing UpdateQnaDTOQuestions. + * List of questions associated with the answer. + * + * @extends UpdateQuestionsDTO + */ +export interface UpdateQnaDTOQuestions extends UpdateQuestionsDTO { +} + +/** + * @interface + * An interface representing UpdateMetadataDTO. + * PATCH Body schema to represent list of Metadata to be updated + * + */ +export interface UpdateMetadataDTO { + /** + * @member {MetadataDTO[]} [deleteProperty] List of Metadata associated with + * answer to be deleted + */ + deleteProperty?: MetadataDTO[]; + /** + * @member {MetadataDTO[]} [add] List of Metadat associated with answer to be + * added + */ + add?: MetadataDTO[]; +} + +/** + * @interface + * An interface representing UpdateQnaDTOMetadata. + * List of metadata associated with the answer to be updated + * + * @extends UpdateMetadataDTO + */ +export interface UpdateQnaDTOMetadata extends UpdateMetadataDTO { +} + +/** + * @interface + * An interface representing UpdateQnaDTO. + * PATCH Body schema for Update Qna List + * + */ +export interface UpdateQnaDTO { + /** + * @member {number} [id] Unique id for the Q-A + */ + id?: number; + /** + * @member {string} [answer] Answer text + */ + answer?: string; + /** + * @member {string} [source] Source from which Q-A was indexed. eg. + * https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + */ + source?: string; + /** + * @member {UpdateQnaDTOQuestions} [questions] List of questions associated + * with the answer. + */ + questions?: UpdateQnaDTOQuestions; + /** + * @member {UpdateQnaDTOMetadata} [metadata] List of metadata associated with + * the answer to be updated + */ + metadata?: UpdateQnaDTOMetadata; +} + +/** + * @interface + * An interface representing MetadataDTO. + * Name - value pair of metadata. + * + */ +export interface MetadataDTO { + /** + * @member {string} name Metadata name. + */ + name: string; + /** + * @member {string} value Metadata value. + */ + value: string; +} + +/** + * @interface + * An interface representing QnADTO. + * Q-A object. + * + */ +export interface QnADTO { + /** + * @member {number} [id] Unique id for the Q-A. + */ + id?: number; + /** + * @member {string} answer Answer text + */ + answer: string; + /** + * @member {string} [source] Source from which Q-A was indexed. eg. + * https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + */ + source?: string; + /** + * @member {string[]} questions List of questions associated with the answer. + */ + questions: string[]; + /** + * @member {MetadataDTO[]} [metadata] List of metadata associated with the + * answer. + */ + metadata?: MetadataDTO[]; +} + +/** + * @interface + * An interface representing FileDTO. + * DTO to hold details of uploaded files. + * + */ +export interface FileDTO { + /** + * @member {string} fileName File name. Supported file types are ".tsv", + * ".pdf", ".txt", ".docx", ".xlsx". + */ + fileName: string; + /** + * @member {string} fileUri Public URI of the file. + */ + fileUri: string; +} + +/** + * @interface + * An interface representing QnADocumentsDTO. + * List of QnADTO + * + */ +export interface QnADocumentsDTO { + /** + * @member {QnADTO[]} [qnaDocuments] List of answers. + */ + qnaDocuments?: QnADTO[]; +} + +/** + * @interface + * An interface representing CreateKbDTO. + * Post body schema for CreateKb operation. + * + */ +export interface CreateKbDTO { + /** + * @member {string} name Friendly name for the knowledgebase. + */ + name: string; + /** + * @member {QnADTO[]} [qnaList] List of Q-A (QnADTO) to be added to the + * knowledgebase. Q-A Ids are assigned by the service and should be omitted. + */ + qnaList?: QnADTO[]; + /** + * @member {string[]} [urls] List of URLs to be used for extracting Q-A. + */ + urls?: string[]; + /** + * @member {FileDTO[]} [files] List of files from which to Extract Q-A. + */ + files?: FileDTO[]; +} + +/** + * @interface + * An interface representing ReplaceKbDTO. + * Post body schema for Replace KB operation. + * + */ +export interface ReplaceKbDTO { + /** + * @member {QnADTO[]} qnAList List of Q-A (QnADTO) to be added to the + * knowledgebase. Q-A Ids are assigned by the service and should be omitted. + */ + qnAList: QnADTO[]; +} + +/** + * @interface + * An interface representing ErrorModel. + * The error object. As per Microsoft One API guidelines - + * https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + * + */ +export interface ErrorModel { + /** + * @member {ErrorCodeType} code One of a server-defined set of error codes. + * Possible values include: 'BadArgument', 'Forbidden', 'NotFound', + * 'KbNotFound', 'Unauthorized', 'Unspecified', 'EndpointKeysError', + * 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', + * 'OperationNotFound', 'ServiceError', 'ValidationFailure', + * 'ExtractionFailure' + */ + code: ErrorCodeType; + /** + * @member {string} [message] A human-readable representation of the error. + */ + message?: string; + /** + * @member {string} [target] The target of the error. + */ + target?: string; + /** + * @member {ErrorModel[]} [details] An array of details about specific errors + * that led to this reported error. + */ + details?: ErrorModel[]; + /** + * @member {InnerErrorModel} [innerError] An object containing more specific + * information than the current object about the error. + */ + innerError?: InnerErrorModel; +} + +/** + * @interface + * An interface representing ErrorResponseError. + * The error object. + * + * @extends ErrorModel + */ +export interface ErrorResponseError extends ErrorModel { +} + +/** + * @interface + * An interface representing ErrorResponse. + * Error response. As per Microsoft One API guidelines - + * https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + * + */ +export interface ErrorResponse { + /** + * @member {ErrorResponseError} [error] The error object. + */ + error?: ErrorResponseError; +} + +/** + * @interface + * An interface representing InnerErrorModel. + * An object containing more specific information about the error. As per + * Microsoft One API guidelines - + * https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + * + */ +export interface InnerErrorModel { + /** + * @member {string} [code] A more specific error code than was provided by + * the containing error. + */ + code?: string; + /** + * @member {InnerErrorModel} [innerError] An object containing more specific + * information than the current object about the error. + */ + innerError?: InnerErrorModel; +} + +/** + * @interface + * An interface representing Operation. + * Record to track long running operation. + * + */ +export interface Operation { + /** + * @member {OperationStateType} [operationState] Operation state. Possible + * values include: 'Failed', 'NotStarted', 'Running', 'Succeeded' + */ + operationState?: OperationStateType; + /** + * @member {string} [createdTimestamp] Timestamp when the operation was + * created. + */ + createdTimestamp?: string; + /** + * @member {string} [lastActionTimestamp] Timestamp when the current state + * was entered. + */ + lastActionTimestamp?: string; + /** + * @member {string} [resourceLocation] Relative URI to the target resource + * location for completed resources. + */ + resourceLocation?: string; + /** + * @member {string} [userId] User Id + */ + userId?: string; + /** + * @member {string} [operationId] Operation Id. + */ + operationId?: string; + /** + * @member {ErrorResponse} [errorResponse] Error details in case of failures. + */ + errorResponse?: ErrorResponse; +} + +/** + * @interface + * An interface representing KnowledgebaseDTO. + * Response schema for CreateKb operation. + * + */ +export interface KnowledgebaseDTO { + /** + * @member {string} [id] Unique id that identifies a knowledgebase. + */ + id?: string; + /** + * @member {string} [hostName] URL host name at which the knowledgebase is + * hosted. + */ + hostName?: string; + /** + * @member {string} [lastAccessedTimestamp] Time stamp at which the + * knowledgebase was last accessed (UTC). + */ + lastAccessedTimestamp?: string; + /** + * @member {string} [lastChangedTimestamp] Time stamp at which the + * knowledgebase was last modified (UTC). + */ + lastChangedTimestamp?: string; + /** + * @member {string} [lastPublishedTimestamp] Time stamp at which the + * knowledgebase was last published (UTC). + */ + lastPublishedTimestamp?: string; + /** + * @member {string} [name] Friendly name of the knowledgebase. + */ + name?: string; + /** + * @member {string} [userId] User who created / owns the knowledgebase. + */ + userId?: string; + /** + * @member {string[]} [urls] URL sources from which Q-A were extracted and + * added to the knowledgebase. + */ + urls?: string[]; + /** + * @member {string[]} [sources] Custom sources from which Q-A were extracted + * or explicitly added to the knowledgebase. + */ + sources?: string[]; +} + +/** + * @interface + * An interface representing KnowledgebasesDTO. + * Collection of knowledgebases owned by a user. + * + */ +export interface KnowledgebasesDTO { + /** + * @member {KnowledgebaseDTO[]} [knowledgebases] Collection of knowledgebase + * records. + */ + knowledgebases?: KnowledgebaseDTO[]; +} + +/** + * @interface + * An interface representing AlterationsDTO. + * Collection of words that are synonyms. + * + */ +export interface AlterationsDTO { + /** + * @member {string[]} alterations Words that are synonymous with each other. + */ + alterations: string[]; +} + +/** + * @interface + * An interface representing WordAlterationsDTO. + * Collection of word alterations. + * + */ +export interface WordAlterationsDTO { + /** + * @member {AlterationsDTO[]} wordAlterations Collection of word alterations. + */ + wordAlterations: AlterationsDTO[]; +} + +/** + * @interface + * An interface representing EndpointKeysDTO. + * Schema for EndpointKeys generate/refresh operations. + * + */ +export interface EndpointKeysDTO { + /** + * @member {string} [primaryEndpointKey] Primary Access Key. + */ + primaryEndpointKey?: string; + /** + * @member {string} [secondaryEndpointKey] Secondary Access Key. + */ + secondaryEndpointKey?: string; + /** + * @member {string} [installedVersion] Current version of runtime. + */ + installedVersion?: string; + /** + * @member {string} [lastStableVersion] Latest version of runtime. + */ + lastStableVersion?: string; +} + +/** + * @interface + * An interface representing OperationsGetDetailsHeaders. + * Defines headers for GetDetails operation. + * + */ +export interface OperationsGetDetailsHeaders { + /** + * @member {number} [retryAfter] Indicates how long the client should wait + * before sending a follow up request. The header will be present only if the + * operation is running or has not started yet. + */ + retryAfter: number; +} + +/** + * @interface + * An interface representing KnowledgebaseUpdateHeaders. + * Defines headers for Update operation. + * + */ +export interface KnowledgebaseUpdateHeaders { + /** + * @member {string} [location] Relative URI to the target location of the + * asynchronous operation. Client should poll this resource to get status of + * the operation. + */ + location: string; +} + +/** + * Defines values for KnowledgebaseEnvironmentType. + * Possible values include: 'Prod', 'Test' + * @readonly + * @enum {string} + */ +export type KnowledgebaseEnvironmentType = 'Prod' | 'Test'; + +/** + * Defines values for ErrorCodeType. + * Possible values include: 'BadArgument', 'Forbidden', 'NotFound', 'KbNotFound', 'Unauthorized', + * 'Unspecified', 'EndpointKeysError', 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', + * 'OperationNotFound', 'ServiceError', 'ValidationFailure', 'ExtractionFailure' + * @readonly + * @enum {string} + */ +export type ErrorCodeType = 'BadArgument' | 'Forbidden' | 'NotFound' | 'KbNotFound' | 'Unauthorized' | 'Unspecified' | 'EndpointKeysError' | 'QuotaExceeded' | 'QnaRuntimeError' | 'SKULimitExceeded' | 'OperationNotFound' | 'ServiceError' | 'ValidationFailure' | 'ExtractionFailure'; + +/** + * Defines values for OperationStateType. + * Possible values include: 'Failed', 'NotStarted', 'Running', 'Succeeded' + * @readonly + * @enum {string} + */ +export type OperationStateType = 'Failed' | 'NotStarted' | 'Running' | 'Succeeded'; + +/** + * Defines values for EnvironmentType. + * Possible values include: 'Prod', 'Test' + * @readonly + * @enum {string} + */ +export type EnvironmentType = 'Prod' | 'Test'; + +/** + * Contains response data for the getKeys operation. + */ +export type EndpointGetKeysResponse = EndpointKeysDTO & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: EndpointKeysDTO; + }; +}; + +/** + * Contains response data for the refreshKeys operation. + */ +export type EndpointRefreshKeysResponse = EndpointKeysDTO & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: EndpointKeysDTO; + }; +}; + +/** + * Contains response data for the get operation. + */ +export type AlterationsGetResponse = WordAlterationsDTO & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: WordAlterationsDTO; + }; +}; + +/** + * Contains response data for the listAll operation. + */ +export type KnowledgebaseListAllResponse = KnowledgebasesDTO & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: KnowledgebasesDTO; + }; +}; + +/** + * Contains response data for the getDetails operation. + */ +export type KnowledgebaseGetDetailsResponse = KnowledgebaseDTO & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: KnowledgebaseDTO; + }; +}; + +/** + * Contains response data for the update operation. + */ +export type KnowledgebaseUpdateResponse = Operation & KnowledgebaseUpdateHeaders & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The parsed HTTP response headers. + */ + parsedHeaders: KnowledgebaseUpdateHeaders; + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: Operation; + }; +}; + +/** + * Contains response data for the create operation. + */ +export type KnowledgebaseCreateResponse = Operation & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: Operation; + }; +}; + +/** + * Contains response data for the download operation. + */ +export type KnowledgebaseDownloadResponse = QnADocumentsDTO & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: QnADocumentsDTO; + }; +}; + +/** + * Contains response data for the getDetails operation. + */ +export type OperationsGetDetailsResponse = Operation & OperationsGetDetailsHeaders & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The parsed HTTP response headers. + */ + parsedHeaders: OperationsGetDetailsHeaders; + /** + * The response body as text (string format) + */ + bodyAsText: string; + /** + * The response body as parsed JSON or XML + */ + parsedBody: Operation; + }; +}; diff --git a/packages/@azure/cognitiveservices-qnamaker/lib/models/knowledgebaseMappers.ts b/packages/@azure/cognitiveservices-qnamaker/lib/models/knowledgebaseMappers.ts new file mode 100644 index 000000000000..8684e026ee8e --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/lib/models/knowledgebaseMappers.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export { + KnowledgebasesDTO, + KnowledgebaseDTO, + ErrorResponse, + ErrorResponseError, + ErrorModel, + InnerErrorModel, + ReplaceKbDTO, + QnADTO, + MetadataDTO, + UpdateKbOperationDTO, + UpdateKbOperationDTOAdd, + CreateKbInputDTO, + FileDTO, + UpdateKbOperationDTODelete, + DeleteKbContentsDTO, + UpdateKbOperationDTOUpdate, + UpdateKbContentsDTO, + UpdateQnaDTO, + UpdateQnaDTOQuestions, + UpdateQuestionsDTO, + UpdateQnaDTOMetadata, + UpdateMetadataDTO, + Operation, + KnowledgebaseUpdateHeaders, + CreateKbDTO, + QnADocumentsDTO +} from "../models/mappers"; + diff --git a/packages/@azure/cognitiveservices-qnamaker/lib/models/mappers.ts b/packages/@azure/cognitiveservices-qnamaker/lib/models/mappers.ts new file mode 100644 index 000000000000..45fa0fd58e27 --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/lib/models/mappers.ts @@ -0,0 +1,909 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "ms-rest-js"; + + +export const CreateKbInputDTO: msRest.CompositeMapper = { + serializedName: "CreateKbInputDTO", + type: { + name: "Composite", + className: "CreateKbInputDTO", + modelProperties: { + qnaList: { + serializedName: "qnaList", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "QnADTO" + } + } + } + }, + urls: { + serializedName: "urls", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + files: { + serializedName: "files", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "FileDTO" + } + } + } + } + } + } +}; + +export const UpdateKbOperationDTOAdd: msRest.CompositeMapper = { + serializedName: "UpdateKbOperationDTO_add", + type: { + name: "Composite", + className: "UpdateKbOperationDTOAdd", + modelProperties: { + ...CreateKbInputDTO.type.modelProperties + } + } +}; + +export const DeleteKbContentsDTO: msRest.CompositeMapper = { + serializedName: "DeleteKbContentsDTO", + type: { + name: "Composite", + className: "DeleteKbContentsDTO", + modelProperties: { + ids: { + serializedName: "ids", + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + }, + sources: { + serializedName: "sources", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const UpdateKbOperationDTODelete: msRest.CompositeMapper = { + serializedName: "UpdateKbOperationDTO_delete", + type: { + name: "Composite", + className: "UpdateKbOperationDTODelete", + modelProperties: { + ...DeleteKbContentsDTO.type.modelProperties + } + } +}; + +export const UpdateKbContentsDTO: msRest.CompositeMapper = { + serializedName: "UpdateKbContentsDTO", + type: { + name: "Composite", + className: "UpdateKbContentsDTO", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + qnaList: { + serializedName: "qnaList", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "UpdateQnaDTO" + } + } + } + }, + urls: { + serializedName: "urls", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const UpdateKbOperationDTOUpdate: msRest.CompositeMapper = { + serializedName: "UpdateKbOperationDTO_update", + type: { + name: "Composite", + className: "UpdateKbOperationDTOUpdate", + modelProperties: { + ...UpdateKbContentsDTO.type.modelProperties + } + } +}; + +export const UpdateKbOperationDTO: msRest.CompositeMapper = { + serializedName: "UpdateKbOperationDTO", + type: { + name: "Composite", + className: "UpdateKbOperationDTO", + modelProperties: { + add: { + serializedName: "add", + type: { + name: "Composite", + className: "UpdateKbOperationDTOAdd" + } + }, + deleteProperty: { + serializedName: "delete", + type: { + name: "Composite", + className: "UpdateKbOperationDTODelete" + } + }, + update: { + serializedName: "update", + type: { + name: "Composite", + className: "UpdateKbOperationDTOUpdate" + } + } + } + } +}; + +export const UpdateQuestionsDTO: msRest.CompositeMapper = { + serializedName: "UpdateQuestionsDTO", + type: { + name: "Composite", + className: "UpdateQuestionsDTO", + modelProperties: { + add: { + serializedName: "add", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + deleteProperty: { + serializedName: "delete", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const UpdateQnaDTOQuestions: msRest.CompositeMapper = { + serializedName: "UpdateQnaDTO_questions", + type: { + name: "Composite", + className: "UpdateQnaDTOQuestions", + modelProperties: { + ...UpdateQuestionsDTO.type.modelProperties + } + } +}; + +export const UpdateMetadataDTO: msRest.CompositeMapper = { + serializedName: "UpdateMetadataDTO", + type: { + name: "Composite", + className: "UpdateMetadataDTO", + modelProperties: { + deleteProperty: { + serializedName: "delete", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataDTO" + } + } + } + }, + add: { + serializedName: "add", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataDTO" + } + } + } + } + } + } +}; + +export const UpdateQnaDTOMetadata: msRest.CompositeMapper = { + serializedName: "UpdateQnaDTO_metadata", + type: { + name: "Composite", + className: "UpdateQnaDTOMetadata", + modelProperties: { + ...UpdateMetadataDTO.type.modelProperties + } + } +}; + +export const UpdateQnaDTO: msRest.CompositeMapper = { + serializedName: "UpdateQnaDTO", + type: { + name: "Composite", + className: "UpdateQnaDTO", + modelProperties: { + id: { + serializedName: "id", + constraints: { + InclusiveMaximum: 2147483647, + InclusiveMinimum: 0 + }, + type: { + name: "Number" + } + }, + answer: { + serializedName: "answer", + type: { + name: "String" + } + }, + source: { + serializedName: "source", + constraints: { + MaxLength: 300 + }, + type: { + name: "String" + } + }, + questions: { + serializedName: "questions", + type: { + name: "Composite", + className: "UpdateQnaDTOQuestions" + } + }, + metadata: { + serializedName: "metadata", + type: { + name: "Composite", + className: "UpdateQnaDTOMetadata" + } + } + } + } +}; + +export const MetadataDTO: msRest.CompositeMapper = { + serializedName: "MetadataDTO", + type: { + name: "Composite", + className: "MetadataDTO", + modelProperties: { + name: { + required: true, + serializedName: "name", + constraints: { + MaxLength: 100, + MinLength: 1 + }, + type: { + name: "String" + } + }, + value: { + required: true, + serializedName: "value", + constraints: { + MaxLength: 500, + MinLength: 1 + }, + type: { + name: "String" + } + } + } + } +}; + +export const QnADTO: msRest.CompositeMapper = { + serializedName: "QnADTO", + type: { + name: "Composite", + className: "QnADTO", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "Number" + } + }, + answer: { + required: true, + serializedName: "answer", + constraints: { + MaxLength: 25000, + MinLength: 1 + }, + type: { + name: "String" + } + }, + source: { + serializedName: "source", + constraints: { + MaxLength: 300 + }, + type: { + name: "String" + } + }, + questions: { + required: true, + serializedName: "questions", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + metadata: { + serializedName: "metadata", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataDTO" + } + } + } + } + } + } +}; + +export const FileDTO: msRest.CompositeMapper = { + serializedName: "FileDTO", + type: { + name: "Composite", + className: "FileDTO", + modelProperties: { + fileName: { + required: true, + serializedName: "fileName", + constraints: { + MaxLength: 200, + MinLength: 1 + }, + type: { + name: "String" + } + }, + fileUri: { + required: true, + serializedName: "fileUri", + type: { + name: "String" + } + } + } + } +}; + +export const QnADocumentsDTO: msRest.CompositeMapper = { + serializedName: "QnADocumentsDTO", + type: { + name: "Composite", + className: "QnADocumentsDTO", + modelProperties: { + qnaDocuments: { + serializedName: "qnaDocuments", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "QnADTO" + } + } + } + } + } + } +}; + +export const CreateKbDTO: msRest.CompositeMapper = { + serializedName: "CreateKbDTO", + type: { + name: "Composite", + className: "CreateKbDTO", + modelProperties: { + name: { + required: true, + serializedName: "name", + constraints: { + MaxLength: 100, + MinLength: 1 + }, + type: { + name: "String" + } + }, + qnaList: { + serializedName: "qnaList", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "QnADTO" + } + } + } + }, + urls: { + serializedName: "urls", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + files: { + serializedName: "files", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "FileDTO" + } + } + } + } + } + } +}; + +export const ReplaceKbDTO: msRest.CompositeMapper = { + serializedName: "ReplaceKbDTO", + type: { + name: "Composite", + className: "ReplaceKbDTO", + modelProperties: { + qnAList: { + required: true, + serializedName: "qnAList", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "QnADTO" + } + } + } + } + } + } +}; + +export const ErrorModel: msRest.CompositeMapper = { + serializedName: "Error", + type: { + name: "Composite", + className: "ErrorModel", + modelProperties: { + code: { + required: true, + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + target: { + serializedName: "target", + type: { + name: "String" + } + }, + details: { + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorModel" + } + } + } + }, + innerError: { + serializedName: "innerError", + type: { + name: "Composite", + className: "InnerErrorModel" + } + } + } + } +}; + +export const ErrorResponseError: msRest.CompositeMapper = { + serializedName: "ErrorResponse_error", + type: { + name: "Composite", + className: "ErrorResponseError", + modelProperties: { + ...ErrorModel.type.modelProperties + } + } +}; + +export const ErrorResponse: msRest.CompositeMapper = { + serializedName: "ErrorResponse", + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorResponseError" + } + } + } + } +}; + +export const InnerErrorModel: msRest.CompositeMapper = { + serializedName: "InnerErrorModel", + type: { + name: "Composite", + className: "InnerErrorModel", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + innerError: { + serializedName: "innerError", + type: { + name: "Composite", + className: "InnerErrorModel" + } + } + } + } +}; + +export const Operation: msRest.CompositeMapper = { + serializedName: "Operation", + type: { + name: "Composite", + className: "Operation", + modelProperties: { + operationState: { + serializedName: "operationState", + type: { + name: "String" + } + }, + createdTimestamp: { + serializedName: "createdTimestamp", + type: { + name: "String" + } + }, + lastActionTimestamp: { + serializedName: "lastActionTimestamp", + type: { + name: "String" + } + }, + resourceLocation: { + serializedName: "resourceLocation", + type: { + name: "String" + } + }, + userId: { + serializedName: "userId", + type: { + name: "String" + } + }, + operationId: { + serializedName: "operationId", + type: { + name: "String" + } + }, + errorResponse: { + serializedName: "errorResponse", + type: { + name: "Composite", + className: "ErrorResponse" + } + } + } + } +}; + +export const KnowledgebaseDTO: msRest.CompositeMapper = { + serializedName: "KnowledgebaseDTO", + type: { + name: "Composite", + className: "KnowledgebaseDTO", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + hostName: { + serializedName: "hostName", + type: { + name: "String" + } + }, + lastAccessedTimestamp: { + serializedName: "lastAccessedTimestamp", + type: { + name: "String" + } + }, + lastChangedTimestamp: { + serializedName: "lastChangedTimestamp", + type: { + name: "String" + } + }, + lastPublishedTimestamp: { + serializedName: "lastPublishedTimestamp", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + userId: { + serializedName: "userId", + type: { + name: "String" + } + }, + urls: { + serializedName: "urls", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + sources: { + serializedName: "sources", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const KnowledgebasesDTO: msRest.CompositeMapper = { + serializedName: "KnowledgebasesDTO", + type: { + name: "Composite", + className: "KnowledgebasesDTO", + modelProperties: { + knowledgebases: { + serializedName: "knowledgebases", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "KnowledgebaseDTO" + } + } + } + } + } + } +}; + +export const AlterationsDTO: msRest.CompositeMapper = { + serializedName: "AlterationsDTO", + type: { + name: "Composite", + className: "AlterationsDTO", + modelProperties: { + alterations: { + required: true, + serializedName: "alterations", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const WordAlterationsDTO: msRest.CompositeMapper = { + serializedName: "WordAlterationsDTO", + type: { + name: "Composite", + className: "WordAlterationsDTO", + modelProperties: { + wordAlterations: { + required: true, + serializedName: "wordAlterations", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AlterationsDTO" + } + } + } + } + } + } +}; + +export const EndpointKeysDTO: msRest.CompositeMapper = { + serializedName: "EndpointKeysDTO", + type: { + name: "Composite", + className: "EndpointKeysDTO", + modelProperties: { + primaryEndpointKey: { + serializedName: "primaryEndpointKey", + type: { + name: "String" + } + }, + secondaryEndpointKey: { + serializedName: "secondaryEndpointKey", + type: { + name: "String" + } + }, + installedVersion: { + serializedName: "installedVersion", + type: { + name: "String" + } + }, + lastStableVersion: { + serializedName: "lastStableVersion", + type: { + name: "String" + } + } + } + } +}; + +export const OperationsGetDetailsHeaders: msRest.CompositeMapper = { + serializedName: "operations-getdetails-headers", + type: { + name: "Composite", + className: "OperationsGetDetailsHeaders", + modelProperties: { + retryAfter: { + serializedName: "retryafter", + type: { + name: "Number" + } + } + } + } +}; + +export const KnowledgebaseUpdateHeaders: msRest.CompositeMapper = { + serializedName: "knowledgebase-update-headers", + type: { + name: "Composite", + className: "KnowledgebaseUpdateHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; diff --git a/packages/@azure/cognitiveservices-qnamaker/lib/models/operationsMappers.ts b/packages/@azure/cognitiveservices-qnamaker/lib/models/operationsMappers.ts new file mode 100644 index 000000000000..5effbaebe953 --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/lib/models/operationsMappers.ts @@ -0,0 +1,19 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export { + Operation, + ErrorResponse, + ErrorResponseError, + ErrorModel, + InnerErrorModel, + OperationsGetDetailsHeaders +} from "../models/mappers"; + diff --git a/packages/@azure/cognitiveservices-qnamaker/lib/models/parameters.ts b/packages/@azure/cognitiveservices-qnamaker/lib/models/parameters.ts new file mode 100644 index 000000000000..5fc9037b79b1 --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/lib/models/parameters.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "ms-rest-js"; + +export const endpoint: msRest.OperationURLParameter = { + parameterPath: "endpoint", + mapper: { + required: true, + serializedName: "Endpoint", + defaultValue: '', + type: { + name: "String" + } + }, + skipEncoding: true +}; +export const environment: msRest.OperationURLParameter = { + parameterPath: "environment", + mapper: { + required: true, + nullable: false, + serializedName: "environment", + type: { + name: "String" + } + } +}; +export const kbId: msRest.OperationURLParameter = { + parameterPath: "kbId", + mapper: { + required: true, + nullable: false, + serializedName: "kbId", + type: { + name: "String" + } + } +}; +export const keyType: msRest.OperationURLParameter = { + parameterPath: "keyType", + mapper: { + required: true, + nullable: false, + serializedName: "keyType", + type: { + name: "String" + } + } +}; +export const operationId: msRest.OperationURLParameter = { + parameterPath: "operationId", + mapper: { + required: true, + nullable: false, + serializedName: "operationId", + type: { + name: "String" + } + } +}; diff --git a/packages/@azure/cognitiveservices-qnamaker/lib/operations/alterations.ts b/packages/@azure/cognitiveservices-qnamaker/lib/operations/alterations.ts new file mode 100644 index 000000000000..037f1d83fb4a --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/lib/operations/alterations.ts @@ -0,0 +1,121 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/alterationsMappers"; +import * as Parameters from "../models/parameters"; +import { QnAMakerClientContext } from "../qnAMakerClientContext"; + +/** Class representing a Alterations. */ +export class Alterations { + private readonly client: QnAMakerClientContext; + + /** + * Create a Alterations. + * @param {QnAMakerClientContext} client Reference to the service client. + */ + constructor(client: QnAMakerClientContext) { + this.client = client; + } + + /** + * @summary Download alterations from runtime. + * @param [options] The optional parameters + * @returns Promise + */ + get(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + get(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + get(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + get(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + getOperationSpec, + callback) as Promise; + } + + /** + * @summary Replace alterations data. + * @param wordAlterations New alterations data. + * @param [options] The optional parameters + * @returns Promise + */ + replace(wordAlterations: Models.WordAlterationsDTO, options?: msRest.RequestOptionsBase): Promise; + /** + * @param wordAlterations New alterations data. + * @param callback The callback + */ + replace(wordAlterations: Models.WordAlterationsDTO, callback: msRest.ServiceCallback): void; + /** + * @param wordAlterations New alterations data. + * @param options The optional parameters + * @param callback The callback + */ + replace(wordAlterations: Models.WordAlterationsDTO, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + replace(wordAlterations: Models.WordAlterationsDTO, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + wordAlterations, + options + }, + replaceOperationSpec, + callback); + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "alterations", + urlParameters: [ + Parameters.endpoint + ], + responses: { + 200: { + bodyMapper: Mappers.WordAlterationsDTO + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const replaceOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "alterations", + urlParameters: [ + Parameters.endpoint + ], + requestBody: { + parameterPath: "wordAlterations", + mapper: { + ...Mappers.WordAlterationsDTO, + required: true + } + }, + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/packages/@azure/cognitiveservices-qnamaker/lib/operations/endpoint.ts b/packages/@azure/cognitiveservices-qnamaker/lib/operations/endpoint.ts new file mode 100644 index 000000000000..ca894e4b43a2 --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/lib/operations/endpoint.ts @@ -0,0 +1,117 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/endpointMappers"; +import * as Parameters from "../models/parameters"; +import { QnAMakerClientContext } from "../qnAMakerClientContext"; + +/** Class representing a Endpoint. */ +export class Endpoint { + private readonly client: QnAMakerClientContext; + + /** + * Create a Endpoint. + * @param {QnAMakerClientContext} client Reference to the service client. + */ + constructor(client: QnAMakerClientContext) { + this.client = client; + } + + /** + * @summary Gets endpoint keys for an endpoint + * @param [options] The optional parameters + * @returns Promise + */ + getKeys(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + getKeys(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + getKeys(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getKeys(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + getKeysOperationSpec, + callback) as Promise; + } + + /** + * @summary Re-generates an endpoint key. + * @param keyType Type of Key + * @param [options] The optional parameters + * @returns Promise + */ + refreshKeys(keyType: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param keyType Type of Key + * @param callback The callback + */ + refreshKeys(keyType: string, callback: msRest.ServiceCallback): void; + /** + * @param keyType Type of Key + * @param options The optional parameters + * @param callback The callback + */ + refreshKeys(keyType: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + refreshKeys(keyType: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + keyType, + options + }, + refreshKeysOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getKeysOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "endpointkeys", + urlParameters: [ + Parameters.endpoint + ], + responses: { + 200: { + bodyMapper: Mappers.EndpointKeysDTO + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const refreshKeysOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "endpointkeys/{keyType}", + urlParameters: [ + Parameters.endpoint, + Parameters.keyType + ], + responses: { + 200: { + bodyMapper: Mappers.EndpointKeysDTO + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/packages/@azure/cognitiveservices-qnamaker/lib/operations/index.ts b/packages/@azure/cognitiveservices-qnamaker/lib/operations/index.ts new file mode 100644 index 000000000000..0fcd629017be --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/lib/operations/index.ts @@ -0,0 +1,14 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +export * from "./endpoint"; +export * from "./alterations"; +export * from "./knowledgebase"; +export * from "./operations"; diff --git a/packages/@azure/cognitiveservices-qnamaker/lib/operations/knowledgebase.ts b/packages/@azure/cognitiveservices-qnamaker/lib/operations/knowledgebase.ts new file mode 100644 index 000000000000..88f319e765e4 --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/lib/operations/knowledgebase.ts @@ -0,0 +1,424 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/knowledgebaseMappers"; +import * as Parameters from "../models/parameters"; +import { QnAMakerClientContext } from "../qnAMakerClientContext"; + +/** Class representing a Knowledgebase. */ +export class Knowledgebase { + private readonly client: QnAMakerClientContext; + + /** + * Create a Knowledgebase. + * @param {QnAMakerClientContext} client Reference to the service client. + */ + constructor(client: QnAMakerClientContext) { + this.client = client; + } + + /** + * @summary Gets all knowledgebases for a user. + * @param [options] The optional parameters + * @returns Promise + */ + listAll(options?: msRest.RequestOptionsBase): Promise; + /** + * @param callback The callback + */ + listAll(callback: msRest.ServiceCallback): void; + /** + * @param options The optional parameters + * @param callback The callback + */ + listAll(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + listAll(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + options + }, + listAllOperationSpec, + callback) as Promise; + } + + /** + * @summary Gets details of a specific knowledgebase. + * @param kbId Knowledgebase id. + * @param [options] The optional parameters + * @returns Promise + */ + getDetails(kbId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param kbId Knowledgebase id. + * @param callback The callback + */ + getDetails(kbId: string, callback: msRest.ServiceCallback): void; + /** + * @param kbId Knowledgebase id. + * @param options The optional parameters + * @param callback The callback + */ + getDetails(kbId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getDetails(kbId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + kbId, + options + }, + getDetailsOperationSpec, + callback) as Promise; + } + + /** + * @summary Deletes the knowledgebase and all its data. + * @param kbId Knowledgebase id. + * @param [options] The optional parameters + * @returns Promise + */ + deleteMethod(kbId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param kbId Knowledgebase id. + * @param callback The callback + */ + deleteMethod(kbId: string, callback: msRest.ServiceCallback): void; + /** + * @param kbId Knowledgebase id. + * @param options The optional parameters + * @param callback The callback + */ + deleteMethod(kbId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + deleteMethod(kbId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + kbId, + options + }, + deleteMethodOperationSpec, + callback); + } + + /** + * @summary Publishes all changes in test index of a knowledgebase to its prod index. + * @param kbId Knowledgebase id. + * @param [options] The optional parameters + * @returns Promise + */ + publish(kbId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param kbId Knowledgebase id. + * @param callback The callback + */ + publish(kbId: string, callback: msRest.ServiceCallback): void; + /** + * @param kbId Knowledgebase id. + * @param options The optional parameters + * @param callback The callback + */ + publish(kbId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + publish(kbId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + kbId, + options + }, + publishOperationSpec, + callback); + } + + /** + * @summary Replace knowledgebase contents. + * @param kbId Knowledgebase id. + * @param replaceKb An instance of ReplaceKbDTO which contains list of qnas to be uploaded + * @param [options] The optional parameters + * @returns Promise + */ + replace(kbId: string, replaceKb: Models.ReplaceKbDTO, options?: msRest.RequestOptionsBase): Promise; + /** + * @param kbId Knowledgebase id. + * @param replaceKb An instance of ReplaceKbDTO which contains list of qnas to be uploaded + * @param callback The callback + */ + replace(kbId: string, replaceKb: Models.ReplaceKbDTO, callback: msRest.ServiceCallback): void; + /** + * @param kbId Knowledgebase id. + * @param replaceKb An instance of ReplaceKbDTO which contains list of qnas to be uploaded + * @param options The optional parameters + * @param callback The callback + */ + replace(kbId: string, replaceKb: Models.ReplaceKbDTO, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + replace(kbId: string, replaceKb: Models.ReplaceKbDTO, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + kbId, + replaceKb, + options + }, + replaceOperationSpec, + callback); + } + + /** + * @summary Asynchronous operation to modify a knowledgebase. + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @param [options] The optional parameters + * @returns Promise + */ + update(kbId: string, updateKb: Models.UpdateKbOperationDTO, options?: msRest.RequestOptionsBase): Promise; + /** + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @param callback The callback + */ + update(kbId: string, updateKb: Models.UpdateKbOperationDTO, callback: msRest.ServiceCallback): void; + /** + * @param kbId Knowledgebase id. + * @param updateKb Post body of the request. + * @param options The optional parameters + * @param callback The callback + */ + update(kbId: string, updateKb: Models.UpdateKbOperationDTO, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + update(kbId: string, updateKb: Models.UpdateKbOperationDTO, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + kbId, + updateKb, + options + }, + updateOperationSpec, + callback) as Promise; + } + + /** + * @summary Asynchronous operation to create a new knowledgebase. + * @param createKbPayload Post body of the request. + * @param [options] The optional parameters + * @returns Promise + */ + create(createKbPayload: Models.CreateKbDTO, options?: msRest.RequestOptionsBase): Promise; + /** + * @param createKbPayload Post body of the request. + * @param callback The callback + */ + create(createKbPayload: Models.CreateKbDTO, callback: msRest.ServiceCallback): void; + /** + * @param createKbPayload Post body of the request. + * @param options The optional parameters + * @param callback The callback + */ + create(createKbPayload: Models.CreateKbDTO, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + create(createKbPayload: Models.CreateKbDTO, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + createKbPayload, + options + }, + createOperationSpec, + callback) as Promise; + } + + /** + * @summary Download the knowledgebase. + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: + * 'Prod', 'Test' + * @param [options] The optional parameters + * @returns Promise + */ + download(kbId: string, environment: Models.EnvironmentType, options?: msRest.RequestOptionsBase): Promise; + /** + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: + * 'Prod', 'Test' + * @param callback The callback + */ + download(kbId: string, environment: Models.EnvironmentType, callback: msRest.ServiceCallback): void; + /** + * @param kbId Knowledgebase id. + * @param environment Specifies whether environment is Test or Prod. Possible values include: + * 'Prod', 'Test' + * @param options The optional parameters + * @param callback The callback + */ + download(kbId: string, environment: Models.EnvironmentType, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + download(kbId: string, environment: Models.EnvironmentType, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + kbId, + environment, + options + }, + downloadOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const listAllOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "knowledgebases", + urlParameters: [ + Parameters.endpoint + ], + responses: { + 200: { + bodyMapper: Mappers.KnowledgebasesDTO + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const getDetailsOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "knowledgebases/{kbId}", + urlParameters: [ + Parameters.endpoint, + Parameters.kbId + ], + responses: { + 200: { + bodyMapper: Mappers.KnowledgebaseDTO + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const deleteMethodOperationSpec: msRest.OperationSpec = { + httpMethod: "DELETE", + path: "knowledgebases/{kbId}", + urlParameters: [ + Parameters.endpoint, + Parameters.kbId + ], + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const publishOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "knowledgebases/{kbId}", + urlParameters: [ + Parameters.endpoint, + Parameters.kbId + ], + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const replaceOperationSpec: msRest.OperationSpec = { + httpMethod: "PUT", + path: "knowledgebases/{kbId}", + urlParameters: [ + Parameters.endpoint, + Parameters.kbId + ], + requestBody: { + parameterPath: "replaceKb", + mapper: { + ...Mappers.ReplaceKbDTO, + required: true + } + }, + responses: { + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const updateOperationSpec: msRest.OperationSpec = { + httpMethod: "PATCH", + path: "knowledgebases/{kbId}", + urlParameters: [ + Parameters.endpoint, + Parameters.kbId + ], + requestBody: { + parameterPath: "updateKb", + mapper: { + ...Mappers.UpdateKbOperationDTO, + required: true + } + }, + responses: { + 202: { + bodyMapper: Mappers.Operation, + headersMapper: Mappers.KnowledgebaseUpdateHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const createOperationSpec: msRest.OperationSpec = { + httpMethod: "POST", + path: "knowledgebases/create", + urlParameters: [ + Parameters.endpoint + ], + requestBody: { + parameterPath: "createKbPayload", + mapper: { + ...Mappers.CreateKbDTO, + required: true + } + }, + responses: { + 202: { + bodyMapper: Mappers.Operation + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const downloadOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "knowledgebases/{kbId}/{environment}/qna", + urlParameters: [ + Parameters.endpoint, + Parameters.kbId, + Parameters.environment + ], + responses: { + 200: { + bodyMapper: Mappers.QnADocumentsDTO + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/packages/@azure/cognitiveservices-qnamaker/lib/operations/operations.ts b/packages/@azure/cognitiveservices-qnamaker/lib/operations/operations.ts new file mode 100644 index 000000000000..9ac43516035d --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/lib/operations/operations.ts @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/operationsMappers"; +import * as Parameters from "../models/parameters"; +import { QnAMakerClientContext } from "../qnAMakerClientContext"; + +/** Class representing a Operations. */ +export class Operations { + private readonly client: QnAMakerClientContext; + + /** + * Create a Operations. + * @param {QnAMakerClientContext} client Reference to the service client. + */ + constructor(client: QnAMakerClientContext) { + this.client = client; + } + + /** + * @summary Gets details of a specific long running operation. + * @param operationId Operation id. + * @param [options] The optional parameters + * @returns Promise + */ + getDetails(operationId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param operationId Operation id. + * @param callback The callback + */ + getDetails(operationId: string, callback: msRest.ServiceCallback): void; + /** + * @param operationId Operation id. + * @param options The optional parameters + * @param callback The callback + */ + getDetails(operationId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getDetails(operationId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + operationId, + options + }, + getDetailsOperationSpec, + callback) as Promise; + } +} + +// Operation Specifications +const serializer = new msRest.Serializer(Mappers); +const getDetailsOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "operations/{operationId}", + urlParameters: [ + Parameters.endpoint, + Parameters.operationId + ], + responses: { + 200: { + bodyMapper: Mappers.Operation, + headersMapper: Mappers.OperationsGetDetailsHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; diff --git a/packages/@azure/cognitiveservices-qnamaker/lib/qnAMakerClient.ts b/packages/@azure/cognitiveservices-qnamaker/lib/qnAMakerClient.ts new file mode 100644 index 000000000000..3a69815f61fc --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/lib/qnAMakerClient.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "ms-rest-js"; +import * as Models from "./models"; +import * as Mappers from "./models/mappers"; +import * as operations from "./operations"; +import { QnAMakerClientContext } from "./qnAMakerClientContext"; + +class QnAMakerClient extends QnAMakerClientContext { + // Operation groups + endpoint: operations.Endpoint; + alterations: operations.Alterations; + knowledgebase: operations.Knowledgebase; + operations: operations.Operations; + + /** + * Initializes a new instance of the QnAMakerClient class. + * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param [options] The parameter options + */ + constructor(endpoint: string, credentials: msRest.ServiceClientCredentials, options?: msRest.ServiceClientOptions) { + super(endpoint, credentials, options); + this.endpoint = new operations.Endpoint(this); + this.alterations = new operations.Alterations(this); + this.knowledgebase = new operations.Knowledgebase(this); + this.operations = new operations.Operations(this); + } +} + +// Operation Specifications + +export { + QnAMakerClient, + QnAMakerClientContext, + Models as QnAMakerModels, + Mappers as QnAMakerMappers +}; +export * from "./operations"; diff --git a/packages/@azure/cognitiveservices-qnamaker/lib/qnAMakerClientContext.ts b/packages/@azure/cognitiveservices-qnamaker/lib/qnAMakerClientContext.ts new file mode 100644 index 000000000000..8da157104289 --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/lib/qnAMakerClientContext.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import * as msRest from "ms-rest-js"; + +const packageName = "@azure/cognitiveservices-qnamaker"; +const packageVersion = "1.0.0"; + +export class QnAMakerClientContext extends msRest.ServiceClient { + endpoint: string; + credentials: msRest.ServiceClientCredentials; + + /** + * Initializes a new instance of the QnAMakerClientContext class. + * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example: + * https://westus.api.cognitive.microsoft.com). + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param [options] The parameter options + */ + constructor(endpoint: string, credentials: msRest.ServiceClientCredentials, options?: msRest.ServiceClientOptions) { + if (endpoint === null || endpoint === undefined) { + throw new Error('\'endpoint\' cannot be null.'); + } + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + + if (!options) { + options = {}; + } + if(!options.userAgent) { + const defaultUserAgent = msRest.getDefaultUserAgentValue(); + options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; + } + + super(credentials, options); + + this.baseUri = "{Endpoint}"; + this.requestContentType = "application/json; charset=utf-8"; + this.endpoint = endpoint; + this.credentials = credentials; + + } +} diff --git a/packages/@azure/cognitiveservices-qnamaker/package.json b/packages/@azure/cognitiveservices-qnamaker/package.json new file mode 100644 index 000000000000..7b8c4d3a2398 --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/package.json @@ -0,0 +1,54 @@ +{ + "name": "@azure/cognitiveservices-qnamaker", + "author": "Microsoft Corporation", + "description": "QnAMakerClient Library with typescript type definitions for node.js and browser.", + "version": "1.0.0", + "dependencies": { + "ms-rest-js": "^1.0.460", + "tslib": "^1.9.3" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/cognitiveservices-qnamaker.js", + "module": "./esm/qnAMakerClient.js", + "types": "./esm/qnAMakerClient.d.ts", + "devDependencies": { + "typescript": "^3.1.1", + "rollup": "^0.66.2", + "rollup-plugin-node-resolve": "^3.4.0", + "uglify-js": "^3.4.9" + }, + "homepage": "https://github.com/azure/azure-sdk-for-js/tree/master/packages/@azure/cognitiveservices-qnamaker", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "esm/**/*.js", + "esm/**/*.js.map", + "esm/**/*.d.ts", + "esm/**/*.d.ts.map", + "lib/**/*.ts", + "rollup.config.js", + "tsconfig.json" + ], + "scripts": { + "build": "tsc && rollup -c rollup.config.js && npm run minify", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/cognitiveservices-qnamaker.js.map'\" -o ./dist/cognitiveservices-qnamaker.min.js ./dist/cognitiveservices-qnamaker.js", + "prepack": "npm install && npm run build" + }, + "sideEffects": false +} diff --git a/packages/@azure/cognitiveservices-qnamaker/rollup.config.js b/packages/@azure/cognitiveservices-qnamaker/rollup.config.js new file mode 100644 index 000000000000..54786695b8d6 --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/rollup.config.js @@ -0,0 +1,31 @@ +import nodeResolve from "rollup-plugin-node-resolve"; +/** + * @type {import('rollup').RollupFileOptions} + */ +const config = { + input: './esm/qnAMakerClient.js', + external: ["ms-rest-js", "ms-rest-azure-js"], + output: { + file: "./dist/cognitiveservices-qnamaker.js", + format: "umd", + name: "Azure.CognitiveservicesQnamaker", + sourcemap: true, + globals: { + "ms-rest-js": "msRest", + "ms-rest-azure-js": "msRestAzure" + }, + banner: `/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */` + }, + plugins: [ + nodeResolve({ module: true }) + ] +}; +export default config; diff --git a/packages/@azure/cognitiveservices-qnamaker/tsconfig.json b/packages/@azure/cognitiveservices-qnamaker/tsconfig.json new file mode 100644 index 000000000000..f32d1664f320 --- /dev/null +++ b/packages/@azure/cognitiveservices-qnamaker/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es5", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es6"], + "declaration": true, + "outDir": "./esm", + "importHelpers": true + }, + "include": ["./lib/**/*"], + "exclude": ["node_modules"] +}