Regenerate azure-cognitiveservices-spellcheck
This commit is contained in:
Родитель
838b38346f
Коммит
086c4751f1
|
@ -17,22 +17,22 @@
|
|||
class ErrorModel {
|
||||
/**
|
||||
* Create a ErrorModel.
|
||||
* @member {string} code The error code that identifies the category of
|
||||
* @property {string} code The error code that identifies the category of
|
||||
* error. Possible values include: 'None', 'ServerError', 'InvalidRequest',
|
||||
* 'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization'.
|
||||
* Default value: 'None' .
|
||||
* @member {string} [subCode] The error code that further helps to identify
|
||||
* @property {string} [subCode] The error code that further helps to identify
|
||||
* the error. Possible values include: 'UnexpectedError', 'ResourceError',
|
||||
* 'NotImplemented', 'ParameterMissing', 'ParameterInvalidValue',
|
||||
* 'HttpNotAllowed', 'Blocked', 'AuthorizationMissing',
|
||||
* 'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired'
|
||||
* @member {string} message A description of the error.
|
||||
* @member {string} [moreDetails] A description that provides additional
|
||||
* @property {string} message A description of the error.
|
||||
* @property {string} [moreDetails] A description that provides additional
|
||||
* information about the error.
|
||||
* @member {string} [parameter] The parameter in the request that caused the
|
||||
* error.
|
||||
* @member {string} [value] The parameter's value in the request that was not
|
||||
* valid.
|
||||
* @property {string} [parameter] The parameter in the request that caused
|
||||
* the error.
|
||||
* @property {string} [value] The parameter's value in the request that was
|
||||
* not valid.
|
||||
*/
|
||||
constructor() {
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ const models = require('./index');
|
|||
class ErrorResponse extends models['Response'] {
|
||||
/**
|
||||
* Create a ErrorResponse.
|
||||
* @member {array} errors A list of errors that describe the reasons why the
|
||||
* request failed.
|
||||
* @property {array} errors A list of errors that describe the reasons why
|
||||
* the request failed.
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
|
|
@ -20,7 +20,7 @@ const models = require('./index');
|
|||
class Identifiable extends models['ResponseBase'] {
|
||||
/**
|
||||
* Create a Identifiable.
|
||||
* @member {string} [id] A String identifier.
|
||||
* @property {string} [id] A String identifier.
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
|
|
@ -1,141 +1,102 @@
|
|||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for
|
||||
* license information.
|
||||
* 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.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
||||
*/
|
||||
|
||||
import * as moment from "moment";
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the SpellingTokenSuggestion class.
|
||||
* @constructor
|
||||
* @member {string} suggestion
|
||||
* @member {number} [score]
|
||||
* @member {string} [pingUrlSuffix]
|
||||
*/
|
||||
export interface SpellingTokenSuggestion {
|
||||
suggestion: string;
|
||||
readonly score?: number;
|
||||
readonly pingUrlSuffix?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the SpellingFlaggedToken class.
|
||||
* @constructor
|
||||
* @member {number} offset
|
||||
* @member {string} token
|
||||
* @member {string} type Possible values include: 'UnknownToken',
|
||||
* 'RepeatedToken'. Default value: 'UnknownToken' .
|
||||
* @member {array} [suggestions]
|
||||
* @member {string} [pingUrlSuffix]
|
||||
*/
|
||||
export interface SpellingFlaggedToken {
|
||||
offset: number;
|
||||
token: string;
|
||||
/**
|
||||
* Possible values include: 'UnknownToken', 'RepeatedToken'
|
||||
*/
|
||||
type: string;
|
||||
readonly suggestions?: SpellingTokenSuggestion[];
|
||||
readonly pingUrlSuffix?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the ResponseBase class.
|
||||
* @constructor
|
||||
* @member {string} _type Polymorphic Discriminator
|
||||
*/
|
||||
export interface ResponseBase {
|
||||
/**
|
||||
* Polymorphic Discriminator
|
||||
*/
|
||||
_type: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the Identifiable class.
|
||||
* @constructor
|
||||
* Defines the identity of a resource.
|
||||
*
|
||||
* @member {string} [id] A String identifier.
|
||||
*/
|
||||
*/
|
||||
export interface Identifiable extends ResponseBase {
|
||||
/**
|
||||
* A String identifier.
|
||||
*/
|
||||
readonly id?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the Response class.
|
||||
* @constructor
|
||||
* Defines a response. All schemas that could be returned at the root of a
|
||||
* response should inherit from this
|
||||
*
|
||||
*/
|
||||
* Defines a response. All schemas that could be returned at the root of a response should inherit
|
||||
* from this
|
||||
*/
|
||||
export interface Response extends Identifiable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the Answer class.
|
||||
* @constructor
|
||||
*/
|
||||
export interface Answer extends Response {
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the SpellCheck class.
|
||||
* @constructor
|
||||
* @member {array} flaggedTokens
|
||||
*/
|
||||
export interface SpellCheck extends Answer {
|
||||
flaggedTokens: SpellingFlaggedToken[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the ErrorModel class.
|
||||
* @constructor
|
||||
* Defines the error that occurred.
|
||||
*
|
||||
* @member {string} code The error code that identifies the category of error.
|
||||
* Possible values include: 'None', 'ServerError', 'InvalidRequest',
|
||||
* 'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization'.
|
||||
* Default value: 'None' .
|
||||
* @member {string} [subCode] The error code that further helps to identify the
|
||||
* error. Possible values include: 'UnexpectedError', 'ResourceError',
|
||||
* 'NotImplemented', 'ParameterMissing', 'ParameterInvalidValue',
|
||||
* 'HttpNotAllowed', 'Blocked', 'AuthorizationMissing',
|
||||
* 'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired'
|
||||
* @member {string} message A description of the error.
|
||||
* @member {string} [moreDetails] A description that provides additional
|
||||
* information about the error.
|
||||
* @member {string} [parameter] The parameter in the request that caused the
|
||||
* error.
|
||||
* @member {string} [value] The parameter's value in the request that was not
|
||||
* valid.
|
||||
*/
|
||||
*/
|
||||
export interface ErrorModel {
|
||||
/**
|
||||
* The error code that identifies the category of error. Possible values include: 'None',
|
||||
* 'ServerError', 'InvalidRequest', 'RateLimitExceeded', 'InvalidAuthorization',
|
||||
* 'InsufficientAuthorization'
|
||||
*/
|
||||
code: string;
|
||||
/**
|
||||
* The error code that further helps to identify the error. Possible values include:
|
||||
* 'UnexpectedError', 'ResourceError', 'NotImplemented', 'ParameterMissing',
|
||||
* 'ParameterInvalidValue', 'HttpNotAllowed', 'Blocked', 'AuthorizationMissing',
|
||||
* 'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired'
|
||||
*/
|
||||
readonly subCode?: string;
|
||||
/**
|
||||
* A description of the error.
|
||||
*/
|
||||
message: string;
|
||||
/**
|
||||
* A description that provides additional information about the error.
|
||||
*/
|
||||
readonly moreDetails?: string;
|
||||
/**
|
||||
* The parameter in the request that caused the error.
|
||||
*/
|
||||
readonly parameter?: string;
|
||||
/**
|
||||
* The parameter's value in the request that was not valid.
|
||||
*/
|
||||
readonly value?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the ErrorResponse class.
|
||||
* @constructor
|
||||
* The top-level response that represents a failed request.
|
||||
*
|
||||
* @member {array} errors A list of errors that describe the reasons why the
|
||||
* request failed.
|
||||
*/
|
||||
*/
|
||||
export interface ErrorResponse extends Response {
|
||||
/**
|
||||
* A list of errors that describe the reasons why the request failed.
|
||||
*/
|
||||
errors: ErrorModel[];
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
class ResponseBase {
|
||||
/**
|
||||
* Create a ResponseBase.
|
||||
* @member {string} _type Polymorphic Discriminator
|
||||
* @property {string} _type Polymorphic Discriminator
|
||||
*/
|
||||
constructor() {
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ const models = require('./index');
|
|||
class SpellCheck extends models['Answer'] {
|
||||
/**
|
||||
* Create a SpellCheck.
|
||||
* @member {array} flaggedTokens
|
||||
* @property {array} flaggedTokens
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
|
|
@ -10,20 +10,18 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const models = require('./index');
|
||||
|
||||
/**
|
||||
* Class representing a SpellingFlaggedToken.
|
||||
*/
|
||||
class SpellingFlaggedToken {
|
||||
/**
|
||||
* Create a SpellingFlaggedToken.
|
||||
* @member {number} offset
|
||||
* @member {string} token
|
||||
* @member {string} type Possible values include: 'UnknownToken',
|
||||
* @property {number} offset
|
||||
* @property {string} token
|
||||
* @property {string} type Possible values include: 'UnknownToken',
|
||||
* 'RepeatedToken'. Default value: 'UnknownToken' .
|
||||
* @member {array} [suggestions]
|
||||
* @member {string} [pingUrlSuffix]
|
||||
* @property {array} [suggestions]
|
||||
* @property {string} [pingUrlSuffix]
|
||||
*/
|
||||
constructor() {
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
class SpellingTokenSuggestion {
|
||||
/**
|
||||
* Create a SpellingTokenSuggestion.
|
||||
* @member {string} suggestion
|
||||
* @member {number} [score]
|
||||
* @member {string} [pingUrlSuffix]
|
||||
* @property {string} suggestion
|
||||
* @property {number} [score]
|
||||
* @property {string} [pingUrlSuffix]
|
||||
*/
|
||||
constructor() {
|
||||
}
|
||||
|
|
|
@ -11,16 +11,24 @@
|
|||
import { ServiceClient, ServiceClientOptions, ServiceCallback, HttpOperationResponse, ServiceClientCredentials } from 'ms-rest';
|
||||
import * as models from "./models";
|
||||
|
||||
export default class SpellCheckAPIClient extends ServiceClient {
|
||||
/**
|
||||
* SpellCheckClientOptions for SpellCheckClient.
|
||||
*/
|
||||
declare interface SpellCheckClientOptions extends ServiceClientOptions {
|
||||
/**
|
||||
* @property {string} [endpoint] - Supported Cognitive Services endpoints (protocol and hostname, for example: "https://westus.api.cognitive.microsoft.com", "https://api.cognitive.microsoft.com").
|
||||
*/
|
||||
endpoint?: string;
|
||||
}
|
||||
|
||||
export default class SpellCheckClient extends ServiceClient {
|
||||
/**
|
||||
* @class
|
||||
* Initializes a new instance of the SpellCheckAPIClient class.
|
||||
* Initializes a new instance of the SpellCheckClient class.
|
||||
* @constructor
|
||||
*
|
||||
* @param {credentials} credentials - Subscription credentials which uniquely identify client subscription.
|
||||
*
|
||||
* @param {string} [baseUri] - The base URI of the service.
|
||||
*
|
||||
* @param {object} [options] - The parameter options
|
||||
*
|
||||
* @param {Array} [options.filters] - Filters to be added to the request pipeline
|
||||
|
@ -30,11 +38,15 @@ export default class SpellCheckAPIClient extends ServiceClient {
|
|||
*
|
||||
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
|
||||
*
|
||||
* @param {string} [options.endpoint] - Supported Cognitive Services endpoints (protocol and hostname, for example: "https://westus.api.cognitive.microsoft.com", "https://api.cognitive.microsoft.com").
|
||||
*
|
||||
*/
|
||||
constructor(credentials: ServiceClientCredentials, baseUri?: string, options?: ServiceClientOptions);
|
||||
constructor(credentials: ServiceClientCredentials, options?: SpellCheckClientOptions);
|
||||
|
||||
credentials: ServiceClientCredentials;
|
||||
|
||||
endpoint: string;
|
||||
|
||||
|
||||
/**
|
||||
* @summary The Bing Spell Check API lets you perform contextual grammar and
|
||||
|
@ -499,4 +511,4 @@ export default class SpellCheckAPIClient extends ServiceClient {
|
|||
spellChecker(text: string, options: { acceptLanguage? : string, pragma? : string, userAgent? : string, clientId? : string, clientIp? : string, location? : string, actionType? : string, appName? : string, countryCode? : string, clientMachineName? : string, docId? : string, market? : string, sessionId? : string, setLang? : string, userId? : string, mode? : string, preContextText? : string, postContextText? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.SpellCheck>): void;
|
||||
}
|
||||
|
||||
export { SpellCheckAPIClient, models as SpellCheckAPIModels };
|
||||
export { SpellCheckClient, models as SpellCheckModels };
|
|
@ -279,6 +279,9 @@ function _spellChecker(text, options, callback) {
|
|||
let xBingApisSDK = 'true';
|
||||
// Validate
|
||||
try {
|
||||
if (this.endpoint === null || this.endpoint === undefined || typeof this.endpoint.valueOf() !== 'string') {
|
||||
throw new Error('this.endpoint cannot be null or undefined and it must be of type string.');
|
||||
}
|
||||
if (acceptLanguage !== null && acceptLanguage !== undefined && typeof acceptLanguage.valueOf() !== 'string') {
|
||||
throw new Error('acceptLanguage must be of type string.');
|
||||
}
|
||||
|
@ -343,6 +346,7 @@ function _spellChecker(text, options, callback) {
|
|||
// Construct URL
|
||||
let baseUrl = this.baseUri;
|
||||
let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'spellcheck';
|
||||
requestUrl = requestUrl.replace('{Endpoint}', this.endpoint);
|
||||
let queryParameters = [];
|
||||
if (actionType !== null && actionType !== undefined) {
|
||||
queryParameters.push('ActionType=' + encodeURIComponent(actionType));
|
||||
|
@ -482,19 +486,19 @@ function _spellChecker(text, options, callback) {
|
|||
});
|
||||
}
|
||||
|
||||
/** Class representing a SpellCheckAPIClient. */
|
||||
class SpellCheckAPIClient extends ServiceClient {
|
||||
/** Class representing a SpellCheckClient. */
|
||||
class SpellCheckClient extends ServiceClient {
|
||||
/**
|
||||
* Create a SpellCheckAPIClient.
|
||||
* Create a SpellCheckClient.
|
||||
* @param {credentials} credentials - Subscription credentials which uniquely identify client subscription.
|
||||
* @param {string} [baseUri] - The base URI of the service.
|
||||
* @param {object} [options] - The parameter options
|
||||
* @param {Array} [options.filters] - Filters to be added to the request pipeline
|
||||
* @param {object} [options.requestOptions] - Options for the underlying request object
|
||||
* {@link https://github.com/request/request#requestoptions-callback Options doc}
|
||||
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
|
||||
* @param {string} [options.endpoint] - Supported Cognitive Services endpoints (protocol and hostname, for example: "https://westus.api.cognitive.microsoft.com", "https://api.cognitive.microsoft.com").
|
||||
*/
|
||||
constructor(credentials, baseUri, options) {
|
||||
constructor(credentials, options) {
|
||||
if (credentials === null || credentials === undefined) {
|
||||
throw new Error('\'credentials\' cannot be null.');
|
||||
}
|
||||
|
@ -503,14 +507,15 @@ class SpellCheckAPIClient extends ServiceClient {
|
|||
|
||||
super(credentials, options);
|
||||
|
||||
this.baseUri = baseUri;
|
||||
if (!this.baseUri) {
|
||||
this.baseUri = 'https://api.cognitive.microsoft.com/bing/v7.0';
|
||||
}
|
||||
this.endpoint = 'https://api.cognitive.microsoft.com';
|
||||
this.baseUri = '{Endpoint}/bing/v7.0';
|
||||
this.credentials = credentials;
|
||||
|
||||
let packageInfo = this.getPackageJsonInfo(__dirname);
|
||||
this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`);
|
||||
if(options.endpoint !== null && options.endpoint !== undefined) {
|
||||
this.endpoint = options.endpoint;
|
||||
}
|
||||
this.models = models;
|
||||
this._spellChecker = _spellChecker;
|
||||
msRest.addSerializationMixin(this);
|
||||
|
@ -1008,7 +1013,7 @@ class SpellCheckAPIClient extends ServiceClient {
|
|||
|
||||
}
|
||||
|
||||
module.exports = SpellCheckAPIClient;
|
||||
module.exports['default'] = SpellCheckAPIClient;
|
||||
module.exports.SpellCheckAPIClient = SpellCheckAPIClient;
|
||||
module.exports.SpellCheckAPIModels = models;
|
||||
module.exports = SpellCheckClient;
|
||||
module.exports['default'] = SpellCheckClient;
|
||||
module.exports.SpellCheckClient = SpellCheckClient;
|
||||
module.exports.SpellCheckModels = models;
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"name": "azure-cognitiveservices-spellcheck",
|
||||
"author": "Microsoft Corporation",
|
||||
"description": "SpellCheckAPIClient Library with typescript type definitions for node",
|
||||
"version": "1.1.0",
|
||||
"description": "SpellCheckClient Library with typescript type definitions for node",
|
||||
"version": "2.0.0",
|
||||
"dependencies": {
|
||||
"ms-rest": "^2.3.3"
|
||||
},
|
||||
|
@ -11,9 +11,9 @@
|
|||
"azure"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/spellCheckAPIClient.js",
|
||||
"types": "./lib/spellCheckAPIClient.d.ts",
|
||||
"homepage": "https://github.com/azure/azure-sdk-for-node/lib/services/spellCheck",
|
||||
"main": "./lib/spellCheckClient.js",
|
||||
"types": "./lib/spellCheckClient.d.ts",
|
||||
"homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/spellCheck",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/azure/azure-sdk-for-node.git"
|
||||
|
@ -21,4 +21,4 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/azure/azure-sdk-for-node/issues"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче