From b6c9c6eff8b01eeb6c595ec75f7508ac9eda4d59 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 23 Apr 2019 16:28:04 +0000 Subject: [PATCH] Generated from 34b054ff34dd17bc17101b78290e66fc160567c1 max len of display text --- .../cognitiveservices-qnamaker/LICENSE.txt | 2 +- .../cognitiveservices-qnamaker/README.md | 3 - .../lib/models/alterationsMappers.ts | 19 + .../lib/models/endpointKeysMappers.ts | 18 + .../lib/models/index.ts | 936 +++++++++++++++ .../lib/models/knowledgebaseMappers.ts | 45 + .../lib/models/mappers.ts | 1061 +++++++++++++++++ .../lib/models/operationsMappers.ts | 19 + .../lib/models/parameters.ts | 68 ++ .../lib/operations/alterations.ts | 121 ++ .../lib/operations/endpointKeys.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 | 7 +- .../cognitiveservices-qnamaker/tsconfig.json | 2 +- 18 files changed, 3023 insertions(+), 9 deletions(-) create mode 100644 sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/alterationsMappers.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/endpointKeysMappers.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/index.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/knowledgebaseMappers.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/mappers.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/operationsMappers.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/parameters.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/alterations.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/endpointKeys.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/index.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/knowledgebase.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/operations.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-qnamaker/lib/qnAMakerClient.ts create mode 100644 sdk/cognitiveservices/cognitiveservices-qnamaker/lib/qnAMakerClientContext.ts diff --git a/sdk/cognitiveservices/cognitiveservices-qnamaker/LICENSE.txt b/sdk/cognitiveservices/cognitiveservices-qnamaker/LICENSE.txt index a70e8cf66038..b73b4a1293c3 100644 --- a/sdk/cognitiveservices/cognitiveservices-qnamaker/LICENSE.txt +++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 Microsoft +Copyright (c) 2019 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 diff --git a/sdk/cognitiveservices/cognitiveservices-qnamaker/README.md b/sdk/cognitiveservices/cognitiveservices-qnamaker/README.md index 00183856a5d4..c2e3ceeaa823 100644 --- a/sdk/cognitiveservices/cognitiveservices-qnamaker/README.md +++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/README.md @@ -92,6 +92,3 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to ## Related projects - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/cognitiveservices/cognitiveservices-qnamaker/README.png) diff --git a/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/alterationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/alterationsMappers.ts new file mode 100644 index 000000000000..a737ed6f2f79 --- /dev/null +++ b/sdk/cognitiveservices/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/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/endpointKeysMappers.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/endpointKeysMappers.ts new file mode 100644 index 000000000000..2dc26823cf5b --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/endpointKeysMappers.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/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/index.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/index.ts new file mode 100644 index 000000000000..6f14f73b645a --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/index.ts @@ -0,0 +1,936 @@ +/* + * 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 "@azure/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 metadata 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 UpdateContextDTO. + * Update Body schema to represent context to be updated + * + */ +export interface UpdateContextDTO { + /** + * @member {number[]} [promptsToDelete] List of prompts associated with qna + * to be deleted + */ + promptsToDelete?: number[]; + /** + * @member {PromptDTO[]} [promptsToAdd] List of prompts to be added to the + * qna. + */ + promptsToAdd?: PromptDTO[]; + /** + * @member {boolean} [isContextOnly] To mark if a prompt is relevant only + * with a previous question or not. + * true - Do not include this QnA as search result for queries without + * context + * false - ignores context and includes this QnA in search result + */ + isContextOnly?: boolean; +} + +/** + * @interface + * An interface representing UpdateQnaDTOContext. + * Context associated with Qna to be updated. + * + * @extends UpdateContextDTO + */ +export interface UpdateQnaDTOContext extends UpdateContextDTO { +} + +/** + * @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; + /** + * @member {UpdateQnaDTOContext} [context] Context associated with Qna to be + * updated. + */ + context?: UpdateQnaDTOContext; +} + +/** + * @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[]; + /** + * @member {QnADTOContext} [context] Context of a QnA + */ + context?: QnADTOContext; +} + +/** + * @interface + * An interface representing PromptDTOQna. + * QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object + * + * @extends QnADTO + */ +export interface PromptDTOQna extends QnADTO { +} + +/** + * @interface + * An interface representing PromptDTO. + * Prompt for an answer. + * + */ +export interface PromptDTO { + /** + * @member {number} [displayOrder] Index of the prompt - used in ordering of + * the prompts + */ + displayOrder?: number; + /** + * @member {number} [qnaId] Qna id corresponding to the prompt - if QnaId is + * present, QnADTO object is ignored. + */ + qnaId?: number; + /** + * @member {PromptDTOQna} [qna] QnADTO - Either QnaId or QnADTO needs to be + * present in a PromptDTO object + */ + qna?: PromptDTOQna; + /** + * @member {string} [displayText] Text displayed to represent a follow up + * question prompt + */ + displayText?: string; +} + +/** + * @interface + * An interface representing ContextDTO. + * Context associated with Qna. + * + */ +export interface ContextDTO { + /** + * @member {boolean} [isContextOnly] To mark if a prompt is relevant only + * with a previous question or not. + * true - Do not include this QnA as search result for queries without + * context + * false - ignores context and includes this QnA in search result + */ + isContextOnly?: boolean; + /** + * @member {PromptDTO[]} [prompts] List of prompts associated with the + * answer. + */ + prompts?: PromptDTO[]; +} + +/** + * @interface + * An interface representing QnADTOContext. + * Context of a QnA + * + * @extends ContextDTO + */ +export interface QnADTOContext extends ContextDTO { +} + +/** + * @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 EndpointKeysGetKeysResponse = 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 EndpointKeysRefreshKeysResponse = 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/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/knowledgebaseMappers.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/knowledgebaseMappers.ts new file mode 100644 index 000000000000..01b939e73df7 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/knowledgebaseMappers.ts @@ -0,0 +1,45 @@ +/* + * 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, + QnADTOContext, + ContextDTO, + PromptDTO, + PromptDTOQna, + UpdateKbOperationDTO, + UpdateKbOperationDTOAdd, + CreateKbInputDTO, + FileDTO, + UpdateKbOperationDTODelete, + DeleteKbContentsDTO, + UpdateKbOperationDTOUpdate, + UpdateKbContentsDTO, + UpdateQnaDTO, + UpdateQnaDTOQuestions, + UpdateQuestionsDTO, + UpdateQnaDTOMetadata, + UpdateMetadataDTO, + UpdateQnaDTOContext, + UpdateContextDTO, + Operation, + KnowledgebaseUpdateHeaders, + CreateKbDTO, + QnADocumentsDTO +} from "../models/mappers"; + diff --git a/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/mappers.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/mappers.ts new file mode 100644 index 000000000000..72af3a77505e --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/mappers.ts @@ -0,0 +1,1061 @@ +/* + * 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 "@azure/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 UpdateContextDTO: msRest.CompositeMapper = { + serializedName: "UpdateContextDTO", + type: { + name: "Composite", + className: "UpdateContextDTO", + modelProperties: { + promptsToDelete: { + serializedName: "promptsToDelete", + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + }, + promptsToAdd: { + serializedName: "promptsToAdd", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PromptDTO" + } + } + } + }, + isContextOnly: { + serializedName: "isContextOnly", + type: { + name: "Boolean" + } + } + } + } +}; + +export const UpdateQnaDTOContext: msRest.CompositeMapper = { + serializedName: "UpdateQnaDTO_context", + type: { + name: "Composite", + className: "UpdateQnaDTOContext", + modelProperties: { + ...UpdateContextDTO.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" + } + }, + context: { + serializedName: "context", + type: { + name: "Composite", + className: "UpdateQnaDTOContext" + } + } + } + } +}; + +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" + } + } + } + }, + context: { + serializedName: "context", + type: { + name: "Composite", + className: "QnADTOContext" + } + } + } + } +}; + +export const PromptDTOQna: msRest.CompositeMapper = { + serializedName: "PromptDTO_qna", + type: { + name: "Composite", + className: "PromptDTOQna", + modelProperties: { + ...QnADTO.type.modelProperties + } + } +}; + +export const PromptDTO: msRest.CompositeMapper = { + serializedName: "PromptDTO", + type: { + name: "Composite", + className: "PromptDTO", + modelProperties: { + displayOrder: { + serializedName: "displayOrder", + type: { + name: "Number" + } + }, + qnaId: { + serializedName: "qnaId", + type: { + name: "Number" + } + }, + qna: { + serializedName: "qna", + type: { + name: "Composite", + className: "PromptDTOQna" + } + }, + displayText: { + serializedName: "displayText", + constraints: { + MaxLength: 200 + }, + type: { + name: "String" + } + } + } + } +}; + +export const ContextDTO: msRest.CompositeMapper = { + serializedName: "ContextDTO", + type: { + name: "Composite", + className: "ContextDTO", + modelProperties: { + isContextOnly: { + serializedName: "isContextOnly", + type: { + name: "Boolean" + } + }, + prompts: { + serializedName: "prompts", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PromptDTO" + } + } + } + } + } + } +}; + +export const QnADTOContext: msRest.CompositeMapper = { + serializedName: "QnADTO_context", + type: { + name: "Composite", + className: "QnADTOContext", + modelProperties: { + ...ContextDTO.type.modelProperties + } + } +}; + +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/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/operationsMappers.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/operationsMappers.ts new file mode 100644 index 000000000000..5effbaebe953 --- /dev/null +++ b/sdk/cognitiveservices/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/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/parameters.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/models/parameters.ts new file mode 100644 index 000000000000..5ad11ee6c076 --- /dev/null +++ b/sdk/cognitiveservices/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 "@azure/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/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/alterations.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/alterations.ts new file mode 100644 index 000000000000..c7a6cef44ae3 --- /dev/null +++ b/sdk/cognitiveservices/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 "@azure/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/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/endpointKeys.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/endpointKeys.ts new file mode 100644 index 000000000000..99dcc6869859 --- /dev/null +++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/endpointKeys.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 "@azure/ms-rest-js"; +import * as Models from "../models"; +import * as Mappers from "../models/endpointKeysMappers"; +import * as Parameters from "../models/parameters"; +import { QnAMakerClientContext } from "../qnAMakerClientContext"; + +/** Class representing a EndpointKeys. */ +export class EndpointKeys { + private readonly client: QnAMakerClientContext; + + /** + * Create a EndpointKeys. + * @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/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/index.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/index.ts new file mode 100644 index 000000000000..e46ec2db7f23 --- /dev/null +++ b/sdk/cognitiveservices/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 "./endpointKeys"; +export * from "./alterations"; +export * from "./knowledgebase"; +export * from "./operations"; diff --git a/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/knowledgebase.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/knowledgebase.ts new file mode 100644 index 000000000000..ede4260bf058 --- /dev/null +++ b/sdk/cognitiveservices/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 "@azure/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/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/operations.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/operations/operations.ts new file mode 100644 index 000000000000..09769c778f8e --- /dev/null +++ b/sdk/cognitiveservices/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 "@azure/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/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/qnAMakerClient.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/qnAMakerClient.ts new file mode 100644 index 000000000000..0ed1d8460426 --- /dev/null +++ b/sdk/cognitiveservices/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 "@azure/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 + endpointKeys: operations.EndpointKeys; + 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.endpointKeys = new operations.EndpointKeys(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/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/qnAMakerClientContext.ts b/sdk/cognitiveservices/cognitiveservices-qnamaker/lib/qnAMakerClientContext.ts new file mode 100644 index 000000000000..9d75ba9f80db --- /dev/null +++ b/sdk/cognitiveservices/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 "@azure/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/sdk/cognitiveservices/cognitiveservices-qnamaker/package.json b/sdk/cognitiveservices/cognitiveservices-qnamaker/package.json index 43dd3914153b..e2e991418259 100644 --- a/sdk/cognitiveservices/cognitiveservices-qnamaker/package.json +++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/package.json @@ -25,7 +25,7 @@ "rollup-plugin-sourcemaps": "^0.4.2", "uglify-js": "^3.4.9" }, - "homepage": "https://github.com/azure/azure-sdk-for-js/tree/master/sdk/cognitiveservices/cognitiveservices-qnamaker", + "homepage": "https://github.com/azure/azure-sdk-for-js", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-js.git" @@ -42,7 +42,7 @@ "esm/**/*.js.map", "esm/**/*.d.ts", "esm/**/*.d.ts.map", - "src/**/*.ts", + "lib/**/*.ts", "rollup.config.js", "tsconfig.json" ], @@ -51,6 +51,5 @@ "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, - "authPublish": true + "sideEffects": false } diff --git a/sdk/cognitiveservices/cognitiveservices-qnamaker/tsconfig.json b/sdk/cognitiveservices/cognitiveservices-qnamaker/tsconfig.json index 87bbf5b5fa49..51ea90961ce5 100644 --- a/sdk/cognitiveservices/cognitiveservices-qnamaker/tsconfig.json +++ b/sdk/cognitiveservices/cognitiveservices-qnamaker/tsconfig.json @@ -14,6 +14,6 @@ "outDir": "./esm", "importHelpers": true }, - "include": ["./src/**/*.ts"], + "include": ["./lib/**/*.ts"], "exclude": ["node_modules"] }