From f332608e5907ebb6b260710d135296cd2ebf25d7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Sun, 15 Apr 2018 20:23:01 +0000 Subject: [PATCH] Generated from 3252d4551fb2ddd26ae4814540c518b0f878fdd4 Issues -> Issue --- .../lib/apiManagementClient.d.ts | 5 - .../apimanagement/lib/apiManagementClient.js | 5 - .../apimanagement/lib/operations/apiIssue.js | 559 ++++++++ .../lib/operations/apiIssueAttachment.js | 1208 +++++++++++++--- .../lib/operations/apiIssueComment.js | 1216 ++++++++++++++--- .../apimanagement/lib/operations/index.d.ts | 403 +++--- .../apimanagement/lib/operations/index.js | 5 - 7 files changed, 2846 insertions(+), 555 deletions(-) diff --git a/lib/services/apimanagement/lib/apiManagementClient.d.ts b/lib/services/apimanagement/lib/apiManagementClient.d.ts index 1bd5a82d4f..26d482185f 100644 --- a/lib/services/apimanagement/lib/apiManagementClient.d.ts +++ b/lib/services/apimanagement/lib/apiManagementClient.d.ts @@ -69,13 +69,8 @@ export default class ApiManagementClient extends AzureServiceClient { apiSchema: operations.ApiSchema; apiDiagnostic: operations.ApiDiagnostic; apiDiagnosticLogger: operations.ApiDiagnosticLogger; - apiIssues: operations.ApiIssues; apiIssue: operations.ApiIssue; - apiIssueComments: operations.ApiIssueComments; - apiIssuComment: operations.ApiIssuComment; apiIssueComment: operations.ApiIssueComment; - apiIssueAttachments: operations.ApiIssueAttachments; - apiIssuAttachment: operations.ApiIssuAttachment; apiIssueAttachment: operations.ApiIssueAttachment; authorizationServer: operations.AuthorizationServer; backend: operations.Backend; diff --git a/lib/services/apimanagement/lib/apiManagementClient.js b/lib/services/apimanagement/lib/apiManagementClient.js index b764c25f9c..c403e04db5 100644 --- a/lib/services/apimanagement/lib/apiManagementClient.js +++ b/lib/services/apimanagement/lib/apiManagementClient.js @@ -85,13 +85,8 @@ class ApiManagementClient extends ServiceClient { this.apiSchema = new operations.ApiSchema(this); this.apiDiagnostic = new operations.ApiDiagnostic(this); this.apiDiagnosticLogger = new operations.ApiDiagnosticLogger(this); - this.apiIssues = new operations.ApiIssues(this); this.apiIssue = new operations.ApiIssue(this); - this.apiIssueComments = new operations.ApiIssueComments(this); - this.apiIssuComment = new operations.ApiIssuComment(this); this.apiIssueComment = new operations.ApiIssueComment(this); - this.apiIssueAttachments = new operations.ApiIssueAttachments(this); - this.apiIssuAttachment = new operations.ApiIssuAttachment(this); this.apiIssueAttachment = new operations.ApiIssueAttachment(this); this.authorizationServer = new operations.AuthorizationServer(this); this.backend = new operations.Backend(this); diff --git a/lib/services/apimanagement/lib/operations/apiIssue.js b/lib/services/apimanagement/lib/operations/apiIssue.js index 4ac8c1d9b3..359db683c4 100644 --- a/lib/services/apimanagement/lib/operations/apiIssue.js +++ b/lib/services/apimanagement/lib/operations/apiIssue.js @@ -14,6 +14,233 @@ const msRest = require('ms-rest'); const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; +/** + * Lists all issues assosiated with the specified API. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | state | eq | + * | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCollection} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByService(resourceGroupName, serviceName, apiId, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skip = (options && options.skip !== undefined) ? options.skip : undefined; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serviceName === null || serviceName === undefined || typeof serviceName.valueOf() !== 'string') { + throw new Error('serviceName cannot be null or undefined and it must be of type string.'); + } + if (serviceName !== null && serviceName !== undefined) { + if (serviceName.length > 50) + { + throw new Error('"serviceName" should satisfy the constraint - "MaxLength": 50'); + } + if (serviceName.length < 1) + { + throw new Error('"serviceName" should satisfy the constraint - "MinLength": 1'); + } + if (serviceName.match(/^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/) === null) + { + throw new Error('"serviceName" should satisfy the constraint - "Pattern": /^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/'); + } + } + if (apiId === null || apiId === undefined || typeof apiId.valueOf() !== 'string') { + throw new Error('apiId cannot be null or undefined and it must be of type string.'); + } + if (apiId !== null && apiId !== undefined) { + if (apiId.length > 80) + { + throw new Error('"apiId" should satisfy the constraint - "MaxLength": 80'); + } + if (apiId.length < 1) + { + throw new Error('"apiId" should satisfy the constraint - "MinLength": 1'); + } + if (apiId.match(/(^[\w]+$)|(^[\w][\w\-]+[\w]$)/) === null) + { + throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (top !== null && top !== undefined) { + if (top < 1) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (skip !== null && skip !== undefined && typeof skip !== 'number') { + throw new Error('skip must be of type number.'); + } + if (skip !== null && skip !== undefined) { + if (skip < 0) + { + throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0'); + } + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); + requestUrl = requestUrl.replace('{apiId}', encodeURIComponent(apiId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skip !== null && skip !== undefined) { + queryParameters.push('$skip=' + encodeURIComponent(skip.toString())); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IssueCollection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + /** * Gets the entity state (Etag) version of the Issue for an API specified by * its identifier. @@ -860,6 +1087,134 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, ifMatch, }); } +/** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCollection} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByServiceNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IssueCollection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + /** Class representing a ApiIssue. */ class ApiIssue { /** @@ -868,10 +1223,130 @@ class ApiIssue { */ constructor(client) { this.client = client; + this._listByService = _listByService; this._head = _head; this._get = _get; this._createOrUpdate = _createOrUpdate; this._deleteMethod = _deleteMethod; + this._listByServiceNext = _listByServiceNext; + } + + /** + * Lists all issues assosiated with the specified API. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | state | eq | + * | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByServiceWithHttpOperationResponse(resourceGroupName, serviceName, apiId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByService(resourceGroupName, serviceName, apiId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all issues assosiated with the specified API. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | state | eq | + * | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IssueCollection} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCollection} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByService(resourceGroupName, serviceName, apiId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByService(resourceGroupName, serviceName, apiId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByService(resourceGroupName, serviceName, apiId, options, optionalCallback); + } } /** @@ -1318,6 +1793,90 @@ class ApiIssue { } } + /** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IssueCollection} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCollection} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByServiceNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServiceNext(nextPageLink, options, optionalCallback); + } + } + } module.exports = ApiIssue; diff --git a/lib/services/apimanagement/lib/operations/apiIssueAttachment.js b/lib/services/apimanagement/lib/operations/apiIssueAttachment.js index 7f5c6560de..f24510df3f 100644 --- a/lib/services/apimanagement/lib/operations/apiIssueAttachment.js +++ b/lib/services/apimanagement/lib/operations/apiIssueAttachment.js @@ -15,8 +15,7 @@ const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; /** - * Gets the details of the issue Attachment for an API specified by its - * identifier. + * Lists all comments for the Issue assosiated with the specified API. * * @param {string} resourceGroupName The name of the resource group. * @@ -28,11 +27,19 @@ const WebResource = msRest.WebResource; * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * - * @param {string} attachmentId Attachment identifier within an Issue. Must be - * unique in the current Issue. - * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -43,14 +50,14 @@ const WebResource = msRest.WebResource; * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link IssueAttachmentContract} for more + * See {@link IssueAttachmentCollection} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, callback) { +function _listByService(resourceGroupName, serviceName, apiId, issueId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -60,6 +67,9 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti if (!callback) { throw new Error('callback cannot be null.'); } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skip = (options && options.skip !== undefined) ? options.skip : undefined; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -99,6 +109,9 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } if (issueId === null || issueId === undefined || typeof issueId.valueOf() !== 'string') { throw new Error('issueId cannot be null or undefined and it must be of type string.'); } @@ -116,28 +129,29 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti throw new Error('"issueId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); } } - if (attachmentId === null || attachmentId === undefined || typeof attachmentId.valueOf() !== 'string') { - throw new Error('attachmentId cannot be null or undefined and it must be of type string.'); + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } - if (attachmentId !== null && attachmentId !== undefined) { - if (attachmentId.length > 256) - { - throw new Error('"attachmentId" should satisfy the constraint - "MaxLength": 256'); - } - if (attachmentId.length < 1) - { - throw new Error('"attachmentId" should satisfy the constraint - "MinLength": 1'); - } - if (attachmentId.match(/^[^*#&+:<>?]+$/) === null) + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (top !== null && top !== undefined) { + if (top < 1) { - throw new Error('"attachmentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1'); } } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + if (skip !== null && skip !== undefined && typeof skip !== 'number') { + throw new Error('skip must be of type number.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + if (skip !== null && skip !== undefined) { + if (skip < 0) + { + throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0'); + } } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); @@ -148,15 +162,23 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); requestUrl = requestUrl.replace('{apiId}', encodeURIComponent(apiId)); requestUrl = requestUrl.replace('{issueId}', encodeURIComponent(issueId)); - requestUrl = requestUrl.replace('{attachmentId}', encodeURIComponent(attachmentId)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skip !== null && skip !== undefined) { + queryParameters.push('$skip=' + encodeURIComponent(skip.toString())); + } if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -224,7 +246,7 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['IssueAttachmentContract']().mapper(); + let resultMapper = new client.models['IssueAttachmentCollection']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -240,7 +262,8 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti } /** - * Creates a new Attachment for the Issue in an API or updates an existing one. + * Gets the entity state (Etag) version of the issue Attachment for an API + * specified by its identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -255,24 +278,8 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti * @param {string} attachmentId Attachment identifier within an Issue. Must be * unique in the current Issue. * - * @param {object} parameters Create parameters. - * - * @param {string} parameters.title Filename by which the binary data will be - * saved. - * - * @param {string} parameters.contentFormat Either 'link' if content is - * provided via an HTTP link or the MIME type of the Base64-encoded binary data - * provided in the 'content' property. - * - * @param {string} parameters.content An HTTP link or Base64-encoded binary - * data. - * * @param {object} [options] Optional Parameters. * - * @param {string} [options.ifMatch] ETag of the Issue Entity. ETag should - * match the current entity state from the header response of the GET request - * or it should be * for unconditional update. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -282,15 +289,13 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link IssueAttachmentContract} for more - * information. + * {null} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachmentId, parameters, options, callback) { +function _head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -300,7 +305,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm if (!callback) { throw new Error('callback cannot be null.'); } - let ifMatch = (options && options.ifMatch !== undefined) ? options.ifMatch : undefined; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -374,12 +378,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm throw new Error('"attachmentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); } } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (ifMatch !== null && ifMatch !== undefined && typeof ifMatch.valueOf() !== 'string') { - throw new Error('ifMatch must be of type string.'); - } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } @@ -410,7 +408,7 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'PUT'; + httpRequest.method = 'HEAD'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -418,9 +416,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } - if (ifMatch !== undefined && ifMatch !== null) { - httpRequest.headers['If-Match'] = ifMatch; - } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -431,28 +426,14 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm } } } - // Serialize Request - let requestContent = null; - let requestModel = null; - try { - if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['IssueAttachmentContract']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; + httpRequest.body = null; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 201) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -481,47 +462,14 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm // Create Result let result = null; if (responseBody === '') responseBody = null; - // Deserialize Response - if (statusCode === 200) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['IssueAttachmentContract']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError.request = msRest.stripRequest(httpRequest); - deserializationError.response = msRest.stripResponse(response); - return callback(deserializationError); - } - } - // Deserialize Response - if (statusCode === 201) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['IssueAttachmentContract']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError1.request = msRest.stripRequest(httpRequest); - deserializationError1.response = msRest.stripResponse(response); - return callback(deserializationError1); - } - } return callback(null, result, httpRequest, response); }); } /** - * Deletes the specified comment from an Issue. + * Gets the details of the issue Attachment for an API specified by its + * identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -536,10 +484,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm * @param {string} attachmentId Attachment identifier within an Issue. Must be * unique in the current Issue. * - * @param {string} ifMatch ETag of the Issue Entity. ETag should match the - * current entity state from the header response of the GET request or it - * should be * for unconditional update. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -551,13 +495,15 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentContract} for more + * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmentId, ifMatch, options, callback) { +function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -640,9 +586,6 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmen throw new Error('"attachmentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); } } - if (ifMatch === null || ifMatch === undefined || typeof ifMatch.valueOf() !== 'string') { - throw new Error('ifMatch cannot be null or undefined and it must be of type string.'); - } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } @@ -673,7 +616,7 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmen // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'DELETE'; + httpRequest.method = 'GET'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -681,9 +624,6 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmen if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } - if (ifMatch !== undefined && ifMatch !== null) { - httpRequest.headers['If-Match'] = ifMatch; - } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -701,7 +641,7 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmen return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 204) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -730,44 +670,915 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmen // Create Result let result = null; if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IssueAttachmentContract']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } return callback(null, result, httpRequest, response); }); } -/** Class representing a ApiIssueAttachment. */ -class ApiIssueAttachment { - /** - * Create a ApiIssueAttachment. - * @param {ApiManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._createOrUpdate = _createOrUpdate; - this._deleteMethod = _deleteMethod; +/** + * Creates a new Attachment for the Issue in an API or updates an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {object} parameters Create parameters. + * + * @param {string} parameters.title Filename by which the binary data will be + * saved. + * + * @param {string} parameters.contentFormat Either 'link' if content is + * provided via an HTTP link or the MIME type of the Base64-encoded binary data + * provided in the 'content' property. + * + * @param {string} parameters.content An HTTP link or Base64-encoded binary + * data. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] ETag of the Issue Entity. ETag should + * match the current entity state from the header response of the GET request + * or it should be * for unconditional update. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentContract} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachmentId, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; } - - /** - * Gets the details of the issue Attachment for an API specified by its - * identifier. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. - * - * @param {string} issueId Issue identifier. Must be unique in the current API - * Management service instance. - * - * @param {string} attachmentId Attachment identifier within an Issue. Must be - * unique in the current Issue. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the + if (!callback) { + throw new Error('callback cannot be null.'); + } + let ifMatch = (options && options.ifMatch !== undefined) ? options.ifMatch : undefined; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serviceName === null || serviceName === undefined || typeof serviceName.valueOf() !== 'string') { + throw new Error('serviceName cannot be null or undefined and it must be of type string.'); + } + if (serviceName !== null && serviceName !== undefined) { + if (serviceName.length > 50) + { + throw new Error('"serviceName" should satisfy the constraint - "MaxLength": 50'); + } + if (serviceName.length < 1) + { + throw new Error('"serviceName" should satisfy the constraint - "MinLength": 1'); + } + if (serviceName.match(/^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/) === null) + { + throw new Error('"serviceName" should satisfy the constraint - "Pattern": /^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/'); + } + } + if (apiId === null || apiId === undefined || typeof apiId.valueOf() !== 'string') { + throw new Error('apiId cannot be null or undefined and it must be of type string.'); + } + if (apiId !== null && apiId !== undefined) { + if (apiId.length > 80) + { + throw new Error('"apiId" should satisfy the constraint - "MaxLength": 80'); + } + if (apiId.length < 1) + { + throw new Error('"apiId" should satisfy the constraint - "MinLength": 1'); + } + if (apiId.match(/(^[\w]+$)|(^[\w][\w\-]+[\w]$)/) === null) + { + throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/'); + } + } + if (issueId === null || issueId === undefined || typeof issueId.valueOf() !== 'string') { + throw new Error('issueId cannot be null or undefined and it must be of type string.'); + } + if (issueId !== null && issueId !== undefined) { + if (issueId.length > 256) + { + throw new Error('"issueId" should satisfy the constraint - "MaxLength": 256'); + } + if (issueId.length < 1) + { + throw new Error('"issueId" should satisfy the constraint - "MinLength": 1'); + } + if (issueId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"issueId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + if (attachmentId === null || attachmentId === undefined || typeof attachmentId.valueOf() !== 'string') { + throw new Error('attachmentId cannot be null or undefined and it must be of type string.'); + } + if (attachmentId !== null && attachmentId !== undefined) { + if (attachmentId.length > 256) + { + throw new Error('"attachmentId" should satisfy the constraint - "MaxLength": 256'); + } + if (attachmentId.length < 1) + { + throw new Error('"attachmentId" should satisfy the constraint - "MinLength": 1'); + } + if (attachmentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"attachmentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (ifMatch !== null && ifMatch !== undefined && typeof ifMatch.valueOf() !== 'string') { + throw new Error('ifMatch must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); + requestUrl = requestUrl.replace('{apiId}', encodeURIComponent(apiId)); + requestUrl = requestUrl.replace('{issueId}', encodeURIComponent(issueId)); + requestUrl = requestUrl.replace('{attachmentId}', encodeURIComponent(attachmentId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (ifMatch !== undefined && ifMatch !== null) { + httpRequest.headers['If-Match'] = ifMatch; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['IssueAttachmentContract']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IssueAttachmentContract']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IssueAttachmentContract']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes the specified comment from an Issue. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {string} ifMatch ETag of the Issue Entity. ETag should match the + * current entity state from the header response of the GET request or it + * should be * for unconditional update. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmentId, ifMatch, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serviceName === null || serviceName === undefined || typeof serviceName.valueOf() !== 'string') { + throw new Error('serviceName cannot be null or undefined and it must be of type string.'); + } + if (serviceName !== null && serviceName !== undefined) { + if (serviceName.length > 50) + { + throw new Error('"serviceName" should satisfy the constraint - "MaxLength": 50'); + } + if (serviceName.length < 1) + { + throw new Error('"serviceName" should satisfy the constraint - "MinLength": 1'); + } + if (serviceName.match(/^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/) === null) + { + throw new Error('"serviceName" should satisfy the constraint - "Pattern": /^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/'); + } + } + if (apiId === null || apiId === undefined || typeof apiId.valueOf() !== 'string') { + throw new Error('apiId cannot be null or undefined and it must be of type string.'); + } + if (apiId !== null && apiId !== undefined) { + if (apiId.length > 80) + { + throw new Error('"apiId" should satisfy the constraint - "MaxLength": 80'); + } + if (apiId.length < 1) + { + throw new Error('"apiId" should satisfy the constraint - "MinLength": 1'); + } + if (apiId.match(/(^[\w]+$)|(^[\w][\w\-]+[\w]$)/) === null) + { + throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/'); + } + } + if (issueId === null || issueId === undefined || typeof issueId.valueOf() !== 'string') { + throw new Error('issueId cannot be null or undefined and it must be of type string.'); + } + if (issueId !== null && issueId !== undefined) { + if (issueId.length > 256) + { + throw new Error('"issueId" should satisfy the constraint - "MaxLength": 256'); + } + if (issueId.length < 1) + { + throw new Error('"issueId" should satisfy the constraint - "MinLength": 1'); + } + if (issueId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"issueId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + if (attachmentId === null || attachmentId === undefined || typeof attachmentId.valueOf() !== 'string') { + throw new Error('attachmentId cannot be null or undefined and it must be of type string.'); + } + if (attachmentId !== null && attachmentId !== undefined) { + if (attachmentId.length > 256) + { + throw new Error('"attachmentId" should satisfy the constraint - "MaxLength": 256'); + } + if (attachmentId.length < 1) + { + throw new Error('"attachmentId" should satisfy the constraint - "MinLength": 1'); + } + if (attachmentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"attachmentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + if (ifMatch === null || ifMatch === undefined || typeof ifMatch.valueOf() !== 'string') { + throw new Error('ifMatch cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments/{attachmentId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); + requestUrl = requestUrl.replace('{apiId}', encodeURIComponent(apiId)); + requestUrl = requestUrl.replace('{issueId}', encodeURIComponent(issueId)); + requestUrl = requestUrl.replace('{attachmentId}', encodeURIComponent(attachmentId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (ifMatch !== undefined && ifMatch !== null) { + httpRequest.headers['If-Match'] = ifMatch; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByServiceNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IssueAttachmentCollection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ApiIssueAttachment. */ +class ApiIssueAttachment { + /** + * Create a ApiIssueAttachment. + * @param {ApiManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByService = _listByService; + this._head = _head; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._listByServiceNext = _listByServiceNext; + } + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByServiceWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByService(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IssueAttachmentCollection} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByService(resourceGroupName, serviceName, apiId, issueId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByService(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByService(resourceGroupName, serviceName, apiId, issueId, options, optionalCallback); + } + } + + /** + * Gets the entity state (Etag) version of the issue Attachment for an API + * specified by its identifier. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + headWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, attachmentId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the entity state (Etag) version of the issue Attachment for an API + * specified by its identifier. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, optionalCallback); + } + } + + /** + * Gets the details of the issue Attachment for an API specified by its + * identifier. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned @@ -1103,6 +1914,91 @@ class ApiIssueAttachment { } } + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IssueAttachmentCollection} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByServiceNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServiceNext(nextPageLink, options, optionalCallback); + } + } + } module.exports = ApiIssueAttachment; diff --git a/lib/services/apimanagement/lib/operations/apiIssueComment.js b/lib/services/apimanagement/lib/operations/apiIssueComment.js index f6de9c5b41..4029236dbf 100644 --- a/lib/services/apimanagement/lib/operations/apiIssueComment.js +++ b/lib/services/apimanagement/lib/operations/apiIssueComment.js @@ -15,8 +15,7 @@ const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; /** - * Gets the details of the issue Comment for an API specified by its - * identifier. + * Lists all comments for the Issue assosiated with the specified API. * * @param {string} resourceGroupName The name of the resource group. * @@ -28,11 +27,19 @@ const WebResource = msRest.WebResource; * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * - * @param {string} commentId Comment identifier within an Issue. Must be unique - * in the current Issue. - * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -43,13 +50,14 @@ const WebResource = msRest.WebResource; * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link IssueCommentContract} for more information. + * See {@link IssueCommentCollection} for more + * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options, callback) { +function _listByService(resourceGroupName, serviceName, apiId, issueId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -59,6 +67,9 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options if (!callback) { throw new Error('callback cannot be null.'); } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skip = (options && options.skip !== undefined) ? options.skip : undefined; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -98,6 +109,9 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } if (issueId === null || issueId === undefined || typeof issueId.valueOf() !== 'string') { throw new Error('issueId cannot be null or undefined and it must be of type string.'); } @@ -115,28 +129,29 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options throw new Error('"issueId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); } } - if (commentId === null || commentId === undefined || typeof commentId.valueOf() !== 'string') { - throw new Error('commentId cannot be null or undefined and it must be of type string.'); + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } - if (commentId !== null && commentId !== undefined) { - if (commentId.length > 256) - { - throw new Error('"commentId" should satisfy the constraint - "MaxLength": 256'); - } - if (commentId.length < 1) - { - throw new Error('"commentId" should satisfy the constraint - "MinLength": 1'); - } - if (commentId.match(/^[^*#&+:<>?]+$/) === null) + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (top !== null && top !== undefined) { + if (top < 1) { - throw new Error('"commentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1'); } } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + if (skip !== null && skip !== undefined && typeof skip !== 'number') { + throw new Error('skip must be of type number.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + if (skip !== null && skip !== undefined) { + if (skip < 0) + { + throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0'); + } } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); @@ -147,15 +162,23 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); requestUrl = requestUrl.replace('{apiId}', encodeURIComponent(apiId)); requestUrl = requestUrl.replace('{issueId}', encodeURIComponent(issueId)); - requestUrl = requestUrl.replace('{commentId}', encodeURIComponent(commentId)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skip !== null && skip !== undefined) { + queryParameters.push('$skip=' + encodeURIComponent(skip.toString())); + } if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -223,7 +246,7 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['IssueCommentContract']().mapper(); + let resultMapper = new client.models['IssueCommentCollection']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -239,7 +262,8 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options } /** - * Creates a new Comment for the Issue in an API or updates an existing one. + * Gets the entity state (Etag) version of the issue Comment for an API + * specified by its identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -254,22 +278,8 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options * @param {string} commentId Comment identifier within an Issue. Must be unique * in the current Issue. * - * @param {object} parameters Create parameters. - * - * @param {string} parameters.text Comment text. - * - * @param {date} [parameters.createdDate] Date and time when the comment was - * created. - * - * @param {string} parameters.userId A resource identifier for the user who - * left the comment. - * * @param {object} [options] Optional Parameters. * - * @param {string} [options.ifMatch] ETag of the Issue Entity. ETag should - * match the current entity state from the header response of the GET request - * or it should be * for unconditional update. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -279,14 +289,13 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link IssueCommentContract} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, commentId, parameters, options, callback) { +function _head(resourceGroupName, serviceName, apiId, issueId, commentId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -296,7 +305,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment if (!callback) { throw new Error('callback cannot be null.'); } - let ifMatch = (options && options.ifMatch !== undefined) ? options.ifMatch : undefined; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -370,12 +378,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment throw new Error('"commentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); } } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (ifMatch !== null && ifMatch !== undefined && typeof ifMatch.valueOf() !== 'string') { - throw new Error('ifMatch must be of type string.'); - } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } @@ -406,7 +408,7 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'PUT'; + httpRequest.method = 'HEAD'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -414,9 +416,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } - if (ifMatch !== undefined && ifMatch !== null) { - httpRequest.headers['If-Match'] = ifMatch; - } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -427,28 +426,14 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment } } } - // Serialize Request - let requestContent = null; - let requestModel = null; - try { - if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['IssueCommentContract']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; + httpRequest.body = null; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 201) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -477,47 +462,14 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment // Create Result let result = null; if (responseBody === '') responseBody = null; - // Deserialize Response - if (statusCode === 200) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['IssueCommentContract']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError.request = msRest.stripRequest(httpRequest); - deserializationError.response = msRest.stripResponse(response); - return callback(deserializationError); - } - } - // Deserialize Response - if (statusCode === 201) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['IssueCommentContract']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError1.request = msRest.stripRequest(httpRequest); - deserializationError1.response = msRest.stripResponse(response); - return callback(deserializationError1); - } - } return callback(null, result, httpRequest, response); }); } /** - * Deletes the specified comment from an Issue. + * Gets the details of the issue Comment for an API specified by its + * identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -532,10 +484,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment * @param {string} commentId Comment identifier within an Issue. Must be unique * in the current Issue. * - * @param {string} ifMatch ETag of the Issue Entity. ETag should match the - * current entity state from the header response of the GET request or it - * should be * for unconditional update. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -547,13 +495,14 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentContract} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId, ifMatch, options, callback) { +function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -636,9 +585,6 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId throw new Error('"commentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); } } - if (ifMatch === null || ifMatch === undefined || typeof ifMatch.valueOf() !== 'string') { - throw new Error('ifMatch cannot be null or undefined and it must be of type string.'); - } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } @@ -669,7 +615,7 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'DELETE'; + httpRequest.method = 'GET'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -677,9 +623,6 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } - if (ifMatch !== undefined && ifMatch !== null) { - httpRequest.headers['If-Match'] = ifMatch; - } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -697,7 +640,7 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 204) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -726,51 +669,919 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId // Create Result let result = null; if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IssueCommentContract']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } return callback(null, result, httpRequest, response); }); } -/** Class representing a ApiIssueComment. */ -class ApiIssueComment { - /** - * Create a ApiIssueComment. - * @param {ApiManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._createOrUpdate = _createOrUpdate; - this._deleteMethod = _deleteMethod; +/** + * Creates a new Comment for the Issue in an API or updates an existing one. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {object} parameters Create parameters. + * + * @param {string} parameters.text Comment text. + * + * @param {date} [parameters.createdDate] Date and time when the comment was + * created. + * + * @param {string} parameters.userId A resource identifier for the user who + * left the comment. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] ETag of the Issue Entity. ETag should + * match the current entity state from the header response of the GET request + * or it should be * for unconditional update. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentContract} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, commentId, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; } - - /** - * Gets the details of the issue Comment for an API specified by its - * identifier. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. - * - * @param {string} issueId Issue identifier. Must be unique in the current API - * Management service instance. - * - * @param {string} commentId Comment identifier within an Issue. Must be unique - * in the current Issue. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error} - The error object. + if (!callback) { + throw new Error('callback cannot be null.'); + } + let ifMatch = (options && options.ifMatch !== undefined) ? options.ifMatch : undefined; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serviceName === null || serviceName === undefined || typeof serviceName.valueOf() !== 'string') { + throw new Error('serviceName cannot be null or undefined and it must be of type string.'); + } + if (serviceName !== null && serviceName !== undefined) { + if (serviceName.length > 50) + { + throw new Error('"serviceName" should satisfy the constraint - "MaxLength": 50'); + } + if (serviceName.length < 1) + { + throw new Error('"serviceName" should satisfy the constraint - "MinLength": 1'); + } + if (serviceName.match(/^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/) === null) + { + throw new Error('"serviceName" should satisfy the constraint - "Pattern": /^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/'); + } + } + if (apiId === null || apiId === undefined || typeof apiId.valueOf() !== 'string') { + throw new Error('apiId cannot be null or undefined and it must be of type string.'); + } + if (apiId !== null && apiId !== undefined) { + if (apiId.length > 80) + { + throw new Error('"apiId" should satisfy the constraint - "MaxLength": 80'); + } + if (apiId.length < 1) + { + throw new Error('"apiId" should satisfy the constraint - "MinLength": 1'); + } + if (apiId.match(/(^[\w]+$)|(^[\w][\w\-]+[\w]$)/) === null) + { + throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/'); + } + } + if (issueId === null || issueId === undefined || typeof issueId.valueOf() !== 'string') { + throw new Error('issueId cannot be null or undefined and it must be of type string.'); + } + if (issueId !== null && issueId !== undefined) { + if (issueId.length > 256) + { + throw new Error('"issueId" should satisfy the constraint - "MaxLength": 256'); + } + if (issueId.length < 1) + { + throw new Error('"issueId" should satisfy the constraint - "MinLength": 1'); + } + if (issueId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"issueId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + if (commentId === null || commentId === undefined || typeof commentId.valueOf() !== 'string') { + throw new Error('commentId cannot be null or undefined and it must be of type string.'); + } + if (commentId !== null && commentId !== undefined) { + if (commentId.length > 256) + { + throw new Error('"commentId" should satisfy the constraint - "MaxLength": 256'); + } + if (commentId.length < 1) + { + throw new Error('"commentId" should satisfy the constraint - "MinLength": 1'); + } + if (commentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"commentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (ifMatch !== null && ifMatch !== undefined && typeof ifMatch.valueOf() !== 'string') { + throw new Error('ifMatch must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); + requestUrl = requestUrl.replace('{apiId}', encodeURIComponent(apiId)); + requestUrl = requestUrl.replace('{issueId}', encodeURIComponent(issueId)); + requestUrl = requestUrl.replace('{commentId}', encodeURIComponent(commentId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (ifMatch !== undefined && ifMatch !== null) { + httpRequest.headers['If-Match'] = ifMatch; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['IssueCommentContract']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IssueCommentContract']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IssueCommentContract']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes the specified comment from an Issue. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {string} ifMatch ETag of the Issue Entity. ETag should match the + * current entity state from the header response of the GET request or it + * should be * for unconditional update. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId, ifMatch, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serviceName === null || serviceName === undefined || typeof serviceName.valueOf() !== 'string') { + throw new Error('serviceName cannot be null or undefined and it must be of type string.'); + } + if (serviceName !== null && serviceName !== undefined) { + if (serviceName.length > 50) + { + throw new Error('"serviceName" should satisfy the constraint - "MaxLength": 50'); + } + if (serviceName.length < 1) + { + throw new Error('"serviceName" should satisfy the constraint - "MinLength": 1'); + } + if (serviceName.match(/^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/) === null) + { + throw new Error('"serviceName" should satisfy the constraint - "Pattern": /^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/'); + } + } + if (apiId === null || apiId === undefined || typeof apiId.valueOf() !== 'string') { + throw new Error('apiId cannot be null or undefined and it must be of type string.'); + } + if (apiId !== null && apiId !== undefined) { + if (apiId.length > 80) + { + throw new Error('"apiId" should satisfy the constraint - "MaxLength": 80'); + } + if (apiId.length < 1) + { + throw new Error('"apiId" should satisfy the constraint - "MinLength": 1'); + } + if (apiId.match(/(^[\w]+$)|(^[\w][\w\-]+[\w]$)/) === null) + { + throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/'); + } + } + if (issueId === null || issueId === undefined || typeof issueId.valueOf() !== 'string') { + throw new Error('issueId cannot be null or undefined and it must be of type string.'); + } + if (issueId !== null && issueId !== undefined) { + if (issueId.length > 256) + { + throw new Error('"issueId" should satisfy the constraint - "MaxLength": 256'); + } + if (issueId.length < 1) + { + throw new Error('"issueId" should satisfy the constraint - "MinLength": 1'); + } + if (issueId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"issueId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + if (commentId === null || commentId === undefined || typeof commentId.valueOf() !== 'string') { + throw new Error('commentId cannot be null or undefined and it must be of type string.'); + } + if (commentId !== null && commentId !== undefined) { + if (commentId.length > 256) + { + throw new Error('"commentId" should satisfy the constraint - "MaxLength": 256'); + } + if (commentId.length < 1) + { + throw new Error('"commentId" should satisfy the constraint - "MinLength": 1'); + } + if (commentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"commentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + if (ifMatch === null || ifMatch === undefined || typeof ifMatch.valueOf() !== 'string') { + throw new Error('ifMatch cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments/{commentId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); + requestUrl = requestUrl.replace('{apiId}', encodeURIComponent(apiId)); + requestUrl = requestUrl.replace('{issueId}', encodeURIComponent(issueId)); + requestUrl = requestUrl.replace('{commentId}', encodeURIComponent(commentId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (ifMatch !== undefined && ifMatch !== null) { + httpRequest.headers['If-Match'] = ifMatch; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByServiceNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IssueCommentCollection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ApiIssueComment. */ +class ApiIssueComment { + /** + * Create a ApiIssueComment. + * @param {ApiManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByService = _listByService; + this._head = _head; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._listByServiceNext = _listByServiceNext; + } + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByServiceWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByService(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IssueCommentCollection} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByService(resourceGroupName, serviceName, apiId, issueId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByService(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByService(resourceGroupName, serviceName, apiId, issueId, options, optionalCallback); + } + } + + /** + * Gets the entity state (Etag) version of the issue Comment for an API + * specified by its identifier. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + headWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, commentId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._head(resourceGroupName, serviceName, apiId, issueId, commentId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the entity state (Etag) version of the issue Comment for an API + * specified by its identifier. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + head(resourceGroupName, serviceName, apiId, issueId, commentId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._head(resourceGroupName, serviceName, apiId, issueId, commentId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._head(resourceGroupName, serviceName, apiId, issueId, commentId, options, optionalCallback); + } + } + + /** + * Gets the details of the issue Comment for an API specified by its + * identifier. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. */ getWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, commentId, options) { let client = this.client; @@ -1093,6 +1904,91 @@ class ApiIssueComment { } } + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IssueCommentCollection} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentCollection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByServiceNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServiceNext(nextPageLink, options, optionalCallback); + } + } + } module.exports = ApiIssueComment; diff --git a/lib/services/apimanagement/lib/operations/index.d.ts b/lib/services/apimanagement/lib/operations/index.d.ts index 7f11d49aae..bdfecfea76 100644 --- a/lib/services/apimanagement/lib/operations/index.d.ts +++ b/lib/services/apimanagement/lib/operations/index.d.ts @@ -5242,11 +5242,11 @@ export interface ApiDiagnosticLogger { /** * @class - * ApiIssues + * ApiIssue * __NOTE__: An instance of this class is automatically created for an * instance of the ApiManagementClient. */ -export interface ApiIssues { +export interface ApiIssue { /** @@ -5340,72 +5340,6 @@ export interface ApiIssues { listByService(resourceGroupName: string, serviceName: string, apiId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - /** - * Lists all issues assosiated with the specified API. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - */ - listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists all issues assosiated with the specified API. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {IssueCollection} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - * - * {ServiceCallback} optionalCallback(err, result, request, response) - * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. - * - * {IssueCollection} [result] - The deserialized result object if an error did not occur. - * See {@link IssueCollection} for more information. - * - * {WebResource} [request] - The HTTP Request object if an error did not occur. - * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; - listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ApiIssue - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApiManagementClient. - */ -export interface ApiIssue { - - /** * Gets the entity state (Etag) version of the Issue for an API specified by * its identifier. @@ -5740,15 +5674,72 @@ export interface ApiIssue { deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, callback: ServiceCallback): void; deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {IssueCollection} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {IssueCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCollection} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * ApiIssueComments + * ApiIssueComment * __NOTE__: An instance of this class is automatically created for an * instance of the ApiManagementClient. */ -export interface ApiIssueComments { +export interface ApiIssueComment { /** @@ -5845,73 +5836,6 @@ export interface ApiIssueComments { listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - /** - * Lists all comments for the Issue assosiated with the specified API. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - */ - listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists all comments for the Issue assosiated with the specified API. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {IssueCommentCollection} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - * - * {ServiceCallback} optionalCallback(err, result, request, response) - * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. - * - * {IssueCommentCollection} [result] - The deserialized result object if an error did not occur. - * See {@link IssueCommentCollection} for more - * information. - * - * {WebResource} [request] - The HTTP Request object if an error did not occur. - * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; - listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ApiIssuComment - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApiManagementClient. - */ -export interface ApiIssuComment { - - /** * Gets the entity state (Etag) version of the issue Comment for an API * specified by its identifier. @@ -5988,15 +5912,6 @@ export interface ApiIssuComment { head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, callback: ServiceCallback): void; head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ApiIssueComment - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApiManagementClient. - */ -export interface ApiIssueComment { /** @@ -6265,15 +6180,73 @@ export interface ApiIssueComment { deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, callback: ServiceCallback): void; deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {IssueCommentCollection} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {IssueCommentCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentCollection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * ApiIssueAttachments + * ApiIssueAttachment * __NOTE__: An instance of this class is automatically created for an * instance of the ApiManagementClient. */ -export interface ApiIssueAttachments { +export interface ApiIssueAttachment { /** @@ -6370,73 +6343,6 @@ export interface ApiIssueAttachments { listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - /** - * Lists all comments for the Issue assosiated with the specified API. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - */ - listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists all comments for the Issue assosiated with the specified API. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {IssueAttachmentCollection} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - * - * {ServiceCallback} optionalCallback(err, result, request, response) - * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. - * - * {IssueAttachmentCollection} [result] - The deserialized result object if an error did not occur. - * See {@link IssueAttachmentCollection} for more - * information. - * - * {WebResource} [request] - The HTTP Request object if an error did not occur. - * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; - listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ApiIssuAttachment - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApiManagementClient. - */ -export interface ApiIssuAttachment { - - /** * Gets the entity state (Etag) version of the issue Attachment for an API * specified by its identifier. @@ -6513,15 +6419,6 @@ export interface ApiIssuAttachment { head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, callback: ServiceCallback): void; head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ApiIssueAttachment - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApiManagementClient. - */ -export interface ApiIssueAttachment { /** @@ -6796,6 +6693,64 @@ export interface ApiIssueAttachment { deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, callback: ServiceCallback): void; deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {IssueAttachmentCollection} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {IssueAttachmentCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentCollection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** diff --git a/lib/services/apimanagement/lib/operations/index.js b/lib/services/apimanagement/lib/operations/index.js index 98ca92a21b..e5955aa5a7 100644 --- a/lib/services/apimanagement/lib/operations/index.js +++ b/lib/services/apimanagement/lib/operations/index.js @@ -27,13 +27,8 @@ exports.ApiPolicy = require('./apiPolicy'); exports.ApiSchema = require('./apiSchema'); exports.ApiDiagnostic = require('./apiDiagnostic'); exports.ApiDiagnosticLogger = require('./apiDiagnosticLogger'); -exports.ApiIssues = require('./apiIssues'); exports.ApiIssue = require('./apiIssue'); -exports.ApiIssueComments = require('./apiIssueComments'); -exports.ApiIssuComment = require('./apiIssuComment'); exports.ApiIssueComment = require('./apiIssueComment'); -exports.ApiIssueAttachments = require('./apiIssueAttachments'); -exports.ApiIssuAttachment = require('./apiIssuAttachment'); exports.ApiIssueAttachment = require('./apiIssueAttachment'); exports.AuthorizationServer = require('./authorizationServer'); exports.Backend = require('./backend');