microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
lib/app-center-node-client/src/crash/operations/crashes.js
3514lines · modecode
| 1 | /* |
| 2 | * Code generated by Microsoft (R) AutoRest Code Generator. |
| 3 | * Changes may cause incorrect behavior and will be lost if the code is |
| 4 | * regenerated. |
| 5 | */ |
| 6 | |
| 7 | 'use strict'; |
| 8 | |
| 9 | const msRest = require('ms-rest'); |
| 10 | const WebResource = msRest.WebResource; |
| 11 | |
| 12 | /** |
| 13 | * Gets all crashes of a group |
| 14 | * |
| 15 | * @param {string} appName The name of the application |
| 16 | * |
| 17 | * @param {string} crashGroupId id of a specific group |
| 18 | * |
| 19 | * @param {string} ownerName The name of the owner |
| 20 | * |
| 21 | * @param {object} [options] Optional Parameters. |
| 22 | * |
| 23 | * @param {string} [options.appVersion] version |
| 24 | * |
| 25 | * @param {date} [options.dateFrom] |
| 26 | * |
| 27 | * @param {date} [options.dateTo] |
| 28 | * |
| 29 | * @param {string} [options.errorType] Possible values include: |
| 30 | * 'CrashingErrors', 'HandledErrors' |
| 31 | * |
| 32 | * @param {boolean} [options.includeLog] true if the crash should include the |
| 33 | * custom log report. Default is false |
| 34 | * |
| 35 | * @param {boolean} [options.includeReport] true if the crash should include |
| 36 | * the raw crash report. Default is false |
| 37 | * |
| 38 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 39 | * request |
| 40 | * |
| 41 | * @param {function} callback - The callback. |
| 42 | * |
| 43 | * @returns {function} callback(err, result, request, response) |
| 44 | * |
| 45 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 46 | * |
| 47 | * {array} [result] - The deserialized result object if an error did not occur. |
| 48 | * |
| 49 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 50 | * |
| 51 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 52 | */ |
| 53 | function _list(appName, crashGroupId, ownerName, options, callback) { |
| 54 | /* jshint validthis: true */ |
| 55 | let client = this.client; |
| 56 | if(!callback && typeof options === 'function') { |
| 57 | callback = options; |
| 58 | options = null; |
| 59 | } |
| 60 | if (!callback) { |
| 61 | throw new Error('callback cannot be null.'); |
| 62 | } |
| 63 | let appVersion = (options && options.appVersion !== undefined) ? options.appVersion : undefined; |
| 64 | let dateFrom = (options && options.dateFrom !== undefined) ? options.dateFrom : undefined; |
| 65 | let dateTo = (options && options.dateTo !== undefined) ? options.dateTo : undefined; |
| 66 | let errorType = (options && options.errorType !== undefined) ? options.errorType : undefined; |
| 67 | let includeLog = (options && options.includeLog !== undefined) ? options.includeLog : false; |
| 68 | let includeReport = (options && options.includeReport !== undefined) ? options.includeReport : false; |
| 69 | // Validate |
| 70 | try { |
| 71 | if (appName === null || appName === undefined || typeof appName.valueOf() !== 'string') { |
| 72 | throw new Error('appName cannot be null or undefined and it must be of type string.'); |
| 73 | } |
| 74 | if (appVersion !== null && appVersion !== undefined && typeof appVersion.valueOf() !== 'string') { |
| 75 | throw new Error('appVersion must be of type string.'); |
| 76 | } |
| 77 | if (crashGroupId === null || crashGroupId === undefined || typeof crashGroupId.valueOf() !== 'string') { |
| 78 | throw new Error('crashGroupId cannot be null or undefined and it must be of type string.'); |
| 79 | } |
| 80 | if (dateFrom && !(dateFrom instanceof Date || |
| 81 | (typeof dateFrom.valueOf() === 'string' && !isNaN(Date.parse(dateFrom))))) { |
| 82 | throw new Error('dateFrom must be of type date.'); |
| 83 | } |
| 84 | if (dateTo && !(dateTo instanceof Date || |
| 85 | (typeof dateTo.valueOf() === 'string' && !isNaN(Date.parse(dateTo))))) { |
| 86 | throw new Error('dateTo must be of type date.'); |
| 87 | } |
| 88 | if (errorType !== null && errorType !== undefined && typeof errorType.valueOf() !== 'string') { |
| 89 | throw new Error('errorType must be of type string.'); |
| 90 | } |
| 91 | if (includeLog !== null && includeLog !== undefined && typeof includeLog !== 'boolean') { |
| 92 | throw new Error('includeLog must be of type boolean.'); |
| 93 | } |
| 94 | if (includeReport !== null && includeReport !== undefined && typeof includeReport !== 'boolean') { |
| 95 | throw new Error('includeReport must be of type boolean.'); |
| 96 | } |
| 97 | if (ownerName === null || ownerName === undefined || typeof ownerName.valueOf() !== 'string') { |
| 98 | throw new Error('ownerName cannot be null or undefined and it must be of type string.'); |
| 99 | } |
| 100 | } catch (error) { |
| 101 | return callback(error); |
| 102 | } |
| 103 | |
| 104 | // Construct URL |
| 105 | let baseUrl = this.client.baseUri; |
| 106 | let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/apps/{owner_name}/{app_name}/crash_groups/{crash_group_id}/crashes'; |
| 107 | requestUrl = requestUrl.replace('{app_name}', encodeURIComponent(appName)); |
| 108 | requestUrl = requestUrl.replace('{crash_group_id}', encodeURIComponent(crashGroupId)); |
| 109 | requestUrl = requestUrl.replace('{owner_name}', encodeURIComponent(ownerName)); |
| 110 | let queryParameters = []; |
| 111 | if (appVersion !== null && appVersion !== undefined) { |
| 112 | queryParameters.push('app_version=' + encodeURIComponent(appVersion)); |
| 113 | } |
| 114 | if (dateFrom !== null && dateFrom !== undefined) { |
| 115 | queryParameters.push('date_from=' + encodeURIComponent(client.serializeObject(dateFrom))); |
| 116 | } |
| 117 | if (dateTo !== null && dateTo !== undefined) { |
| 118 | queryParameters.push('date_to=' + encodeURIComponent(client.serializeObject(dateTo))); |
| 119 | } |
| 120 | if (errorType !== null && errorType !== undefined) { |
| 121 | queryParameters.push('error_type=' + encodeURIComponent(errorType)); |
| 122 | } |
| 123 | if (includeLog !== null && includeLog !== undefined) { |
| 124 | queryParameters.push('include_log=' + encodeURIComponent(includeLog.toString())); |
| 125 | } |
| 126 | if (includeReport !== null && includeReport !== undefined) { |
| 127 | queryParameters.push('include_report=' + encodeURIComponent(includeReport.toString())); |
| 128 | } |
| 129 | if (queryParameters.length > 0) { |
| 130 | requestUrl += '?' + queryParameters.join('&'); |
| 131 | } |
| 132 | |
| 133 | // Create HTTP transport objects |
| 134 | let httpRequest = new WebResource(); |
| 135 | httpRequest.method = 'GET'; |
| 136 | httpRequest.url = requestUrl; |
| 137 | httpRequest.headers = {}; |
| 138 | // Set Headers |
| 139 | httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; |
| 140 | if(options) { |
| 141 | for(let headerName in options['customHeaders']) { |
| 142 | if (options['customHeaders'].hasOwnProperty(headerName)) { |
| 143 | httpRequest.headers[headerName] = options['customHeaders'][headerName]; |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | httpRequest.body = null; |
| 148 | // Send Request |
| 149 | return client.pipeline(httpRequest, (err, response, responseBody) => { |
| 150 | if (err) { |
| 151 | return callback(err); |
| 152 | } |
| 153 | let statusCode = response.statusCode; |
| 154 | if (statusCode !== 200) { |
| 155 | let error = new Error(responseBody); |
| 156 | error.statusCode = response.statusCode; |
| 157 | error.request = msRest.stripRequest(httpRequest); |
| 158 | error.response = msRest.stripResponse(response); |
| 159 | if (responseBody === '') responseBody = null; |
| 160 | let parsedErrorResponse; |
| 161 | try { |
| 162 | parsedErrorResponse = JSON.parse(responseBody); |
| 163 | if (parsedErrorResponse) { |
| 164 | let internalError = null; |
| 165 | if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; |
| 166 | error.code = internalError ? internalError.code : parsedErrorResponse.code; |
| 167 | error.message = internalError ? internalError.message : parsedErrorResponse.message; |
| 168 | } |
| 169 | } catch (defaultError) { |
| 170 | error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + |
| 171 | `- "${responseBody}" for the default response.`; |
| 172 | return callback(error); |
| 173 | } |
| 174 | return callback(error); |
| 175 | } |
| 176 | // Create Result |
| 177 | let result = null; |
| 178 | if (responseBody === '') responseBody = null; |
| 179 | // Deserialize Response |
| 180 | if (statusCode === 200) { |
| 181 | let parsedResponse = null; |
| 182 | try { |
| 183 | parsedResponse = JSON.parse(responseBody); |
| 184 | result = JSON.parse(responseBody); |
| 185 | if (parsedResponse !== null && parsedResponse !== undefined) { |
| 186 | let resultMapper = { |
| 187 | required: false, |
| 188 | serializedName: 'parsedResponse', |
| 189 | type: { |
| 190 | name: 'Sequence', |
| 191 | element: { |
| 192 | required: false, |
| 193 | serializedName: 'CrashElementType', |
| 194 | type: { |
| 195 | name: 'Composite', |
| 196 | className: 'Crash' |
| 197 | } |
| 198 | } |
| 199 | } |
| 200 | }; |
| 201 | result = client.deserialize(resultMapper, parsedResponse, 'result'); |
| 202 | } |
| 203 | } catch (error) { |
| 204 | let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); |
| 205 | deserializationError.request = msRest.stripRequest(httpRequest); |
| 206 | deserializationError.response = msRest.stripResponse(response); |
| 207 | return callback(deserializationError); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | return callback(null, result, httpRequest, response); |
| 212 | }); |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * Gets a specific crash for an app |
| 217 | * |
| 218 | * @param {string} appName The name of the application |
| 219 | * |
| 220 | * @param {string} crashGroupId id of a specific group |
| 221 | * |
| 222 | * @param {string} crashId id of a specific crash |
| 223 | * |
| 224 | * @param {string} ownerName The name of the owner |
| 225 | * |
| 226 | * @param {object} [options] Optional Parameters. |
| 227 | * |
| 228 | * @param {boolean} [options.groupingOnly] true if the stacktrace should be |
| 229 | * only the relevant thread / exception. Default is false |
| 230 | * |
| 231 | * @param {boolean} [options.includeDetails] true if the crash should include |
| 232 | * in depth crash details |
| 233 | * |
| 234 | * @param {boolean} [options.includeLog] true if the crash should include the |
| 235 | * custom log report. Default is false |
| 236 | * |
| 237 | * @param {boolean} [options.includeReport] true if the crash should include |
| 238 | * the raw crash report. Default is false |
| 239 | * |
| 240 | * @param {boolean} [options.includeStacktrace] true if the crash should |
| 241 | * include the stacktrace information |
| 242 | * |
| 243 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 244 | * request |
| 245 | * |
| 246 | * @param {function} callback - The callback. |
| 247 | * |
| 248 | * @returns {function} callback(err, result, request, response) |
| 249 | * |
| 250 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 251 | * |
| 252 | * {object} [result] - The deserialized result object if an error did not occur. |
| 253 | * See {@link Crash} for more information. |
| 254 | * |
| 255 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 256 | * |
| 257 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 258 | */ |
| 259 | function _get(appName, crashGroupId, crashId, ownerName, options, callback) { |
| 260 | /* jshint validthis: true */ |
| 261 | let client = this.client; |
| 262 | if(!callback && typeof options === 'function') { |
| 263 | callback = options; |
| 264 | options = null; |
| 265 | } |
| 266 | if (!callback) { |
| 267 | throw new Error('callback cannot be null.'); |
| 268 | } |
| 269 | let groupingOnly = (options && options.groupingOnly !== undefined) ? options.groupingOnly : false; |
| 270 | let includeDetails = (options && options.includeDetails !== undefined) ? options.includeDetails : false; |
| 271 | let includeLog = (options && options.includeLog !== undefined) ? options.includeLog : false; |
| 272 | let includeReport = (options && options.includeReport !== undefined) ? options.includeReport : false; |
| 273 | let includeStacktrace = (options && options.includeStacktrace !== undefined) ? options.includeStacktrace : false; |
| 274 | // Validate |
| 275 | try { |
| 276 | if (appName === null || appName === undefined || typeof appName.valueOf() !== 'string') { |
| 277 | throw new Error('appName cannot be null or undefined and it must be of type string.'); |
| 278 | } |
| 279 | if (crashGroupId === null || crashGroupId === undefined || typeof crashGroupId.valueOf() !== 'string') { |
| 280 | throw new Error('crashGroupId cannot be null or undefined and it must be of type string.'); |
| 281 | } |
| 282 | if (crashId === null || crashId === undefined || typeof crashId.valueOf() !== 'string') { |
| 283 | throw new Error('crashId cannot be null or undefined and it must be of type string.'); |
| 284 | } |
| 285 | if (groupingOnly !== null && groupingOnly !== undefined && typeof groupingOnly !== 'boolean') { |
| 286 | throw new Error('groupingOnly must be of type boolean.'); |
| 287 | } |
| 288 | if (includeDetails !== null && includeDetails !== undefined && typeof includeDetails !== 'boolean') { |
| 289 | throw new Error('includeDetails must be of type boolean.'); |
| 290 | } |
| 291 | if (includeLog !== null && includeLog !== undefined && typeof includeLog !== 'boolean') { |
| 292 | throw new Error('includeLog must be of type boolean.'); |
| 293 | } |
| 294 | if (includeReport !== null && includeReport !== undefined && typeof includeReport !== 'boolean') { |
| 295 | throw new Error('includeReport must be of type boolean.'); |
| 296 | } |
| 297 | if (includeStacktrace !== null && includeStacktrace !== undefined && typeof includeStacktrace !== 'boolean') { |
| 298 | throw new Error('includeStacktrace must be of type boolean.'); |
| 299 | } |
| 300 | if (ownerName === null || ownerName === undefined || typeof ownerName.valueOf() !== 'string') { |
| 301 | throw new Error('ownerName cannot be null or undefined and it must be of type string.'); |
| 302 | } |
| 303 | } catch (error) { |
| 304 | return callback(error); |
| 305 | } |
| 306 | |
| 307 | // Construct URL |
| 308 | let baseUrl = this.client.baseUri; |
| 309 | let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/apps/{owner_name}/{app_name}/crash_groups/{crash_group_id}/crashes/{crash_id}'; |
| 310 | requestUrl = requestUrl.replace('{app_name}', encodeURIComponent(appName)); |
| 311 | requestUrl = requestUrl.replace('{crash_group_id}', encodeURIComponent(crashGroupId)); |
| 312 | requestUrl = requestUrl.replace('{crash_id}', encodeURIComponent(crashId)); |
| 313 | requestUrl = requestUrl.replace('{owner_name}', encodeURIComponent(ownerName)); |
| 314 | let queryParameters = []; |
| 315 | if (groupingOnly !== null && groupingOnly !== undefined) { |
| 316 | queryParameters.push('grouping_only=' + encodeURIComponent(groupingOnly.toString())); |
| 317 | } |
| 318 | if (includeDetails !== null && includeDetails !== undefined) { |
| 319 | queryParameters.push('include_details=' + encodeURIComponent(includeDetails.toString())); |
| 320 | } |
| 321 | if (includeLog !== null && includeLog !== undefined) { |
| 322 | queryParameters.push('include_log=' + encodeURIComponent(includeLog.toString())); |
| 323 | } |
| 324 | if (includeReport !== null && includeReport !== undefined) { |
| 325 | queryParameters.push('include_report=' + encodeURIComponent(includeReport.toString())); |
| 326 | } |
| 327 | if (includeStacktrace !== null && includeStacktrace !== undefined) { |
| 328 | queryParameters.push('include_stacktrace=' + encodeURIComponent(includeStacktrace.toString())); |
| 329 | } |
| 330 | if (queryParameters.length > 0) { |
| 331 | requestUrl += '?' + queryParameters.join('&'); |
| 332 | } |
| 333 | |
| 334 | // Create HTTP transport objects |
| 335 | let httpRequest = new WebResource(); |
| 336 | httpRequest.method = 'GET'; |
| 337 | httpRequest.url = requestUrl; |
| 338 | httpRequest.headers = {}; |
| 339 | // Set Headers |
| 340 | httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; |
| 341 | if(options) { |
| 342 | for(let headerName in options['customHeaders']) { |
| 343 | if (options['customHeaders'].hasOwnProperty(headerName)) { |
| 344 | httpRequest.headers[headerName] = options['customHeaders'][headerName]; |
| 345 | } |
| 346 | } |
| 347 | } |
| 348 | httpRequest.body = null; |
| 349 | // Send Request |
| 350 | return client.pipeline(httpRequest, (err, response, responseBody) => { |
| 351 | if (err) { |
| 352 | return callback(err); |
| 353 | } |
| 354 | let statusCode = response.statusCode; |
| 355 | if (statusCode !== 201) { |
| 356 | let error = new Error(responseBody); |
| 357 | error.statusCode = response.statusCode; |
| 358 | error.request = msRest.stripRequest(httpRequest); |
| 359 | error.response = msRest.stripResponse(response); |
| 360 | if (responseBody === '') responseBody = null; |
| 361 | let parsedErrorResponse; |
| 362 | try { |
| 363 | parsedErrorResponse = JSON.parse(responseBody); |
| 364 | if (parsedErrorResponse) { |
| 365 | let internalError = null; |
| 366 | if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; |
| 367 | error.code = internalError ? internalError.code : parsedErrorResponse.code; |
| 368 | error.message = internalError ? internalError.message : parsedErrorResponse.message; |
| 369 | } |
| 370 | } catch (defaultError) { |
| 371 | error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + |
| 372 | `- "${responseBody}" for the default response.`; |
| 373 | return callback(error); |
| 374 | } |
| 375 | return callback(error); |
| 376 | } |
| 377 | // Create Result |
| 378 | let result = null; |
| 379 | if (responseBody === '') responseBody = null; |
| 380 | // Deserialize Response |
| 381 | if (statusCode === 201) { |
| 382 | let parsedResponse = null; |
| 383 | try { |
| 384 | parsedResponse = JSON.parse(responseBody); |
| 385 | result = JSON.parse(responseBody); |
| 386 | if (parsedResponse !== null && parsedResponse !== undefined) { |
| 387 | let resultMapper = new client.models['Crash']().mapper(); |
| 388 | result = client.deserialize(resultMapper, parsedResponse, 'result'); |
| 389 | } |
| 390 | } catch (error) { |
| 391 | let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); |
| 392 | deserializationError.request = msRest.stripRequest(httpRequest); |
| 393 | deserializationError.response = msRest.stripResponse(response); |
| 394 | return callback(deserializationError); |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | return callback(null, result, httpRequest, response); |
| 399 | }); |
| 400 | } |
| 401 | |
| 402 | /** |
| 403 | * @summary Gets the native log of a specific crash |
| 404 | * |
| 405 | * Gets the native log of a specific crash |
| 406 | * |
| 407 | * @param {string} appName The name of the application |
| 408 | * |
| 409 | * @param {string} crashGroupId id of a specific group |
| 410 | * |
| 411 | * @param {string} crashId id of a specific crash |
| 412 | * |
| 413 | * @param {string} ownerName The name of the owner |
| 414 | * |
| 415 | * @param {object} [options] Optional Parameters. |
| 416 | * |
| 417 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 418 | * request |
| 419 | * |
| 420 | * @param {function} callback - The callback. |
| 421 | * |
| 422 | * @returns {function} callback(err, result, request, response) |
| 423 | * |
| 424 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 425 | * |
| 426 | * {string} [result] - The deserialized result object if an error did not occur. |
| 427 | * |
| 428 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 429 | * |
| 430 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 431 | */ |
| 432 | function _getNativeCrash(appName, crashGroupId, crashId, ownerName, options, callback) { |
| 433 | /* jshint validthis: true */ |
| 434 | let client = this.client; |
| 435 | if(!callback && typeof options === 'function') { |
| 436 | callback = options; |
| 437 | options = null; |
| 438 | } |
| 439 | if (!callback) { |
| 440 | throw new Error('callback cannot be null.'); |
| 441 | } |
| 442 | // Validate |
| 443 | try { |
| 444 | if (appName === null || appName === undefined || typeof appName.valueOf() !== 'string') { |
| 445 | throw new Error('appName cannot be null or undefined and it must be of type string.'); |
| 446 | } |
| 447 | if (crashGroupId === null || crashGroupId === undefined || typeof crashGroupId.valueOf() !== 'string') { |
| 448 | throw new Error('crashGroupId cannot be null or undefined and it must be of type string.'); |
| 449 | } |
| 450 | if (crashId === null || crashId === undefined || typeof crashId.valueOf() !== 'string') { |
| 451 | throw new Error('crashId cannot be null or undefined and it must be of type string.'); |
| 452 | } |
| 453 | if (ownerName === null || ownerName === undefined || typeof ownerName.valueOf() !== 'string') { |
| 454 | throw new Error('ownerName cannot be null or undefined and it must be of type string.'); |
| 455 | } |
| 456 | } catch (error) { |
| 457 | return callback(error); |
| 458 | } |
| 459 | |
| 460 | // Construct URL |
| 461 | let baseUrl = this.client.baseUri; |
| 462 | let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/apps/{owner_name}/{app_name}/crash_groups/{crash_group_id}/crashes/{crash_id}/native'; |
| 463 | requestUrl = requestUrl.replace('{app_name}', encodeURIComponent(appName)); |
| 464 | requestUrl = requestUrl.replace('{crash_group_id}', encodeURIComponent(crashGroupId)); |
| 465 | requestUrl = requestUrl.replace('{crash_id}', encodeURIComponent(crashId)); |
| 466 | requestUrl = requestUrl.replace('{owner_name}', encodeURIComponent(ownerName)); |
| 467 | |
| 468 | // Create HTTP transport objects |
| 469 | let httpRequest = new WebResource(); |
| 470 | httpRequest.method = 'GET'; |
| 471 | httpRequest.url = requestUrl; |
| 472 | httpRequest.headers = {}; |
| 473 | // Set Headers |
| 474 | httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; |
| 475 | if(options) { |
| 476 | for(let headerName in options['customHeaders']) { |
| 477 | if (options['customHeaders'].hasOwnProperty(headerName)) { |
| 478 | httpRequest.headers[headerName] = options['customHeaders'][headerName]; |
| 479 | } |
| 480 | } |
| 481 | } |
| 482 | httpRequest.body = null; |
| 483 | // Send Request |
| 484 | return client.pipeline(httpRequest, (err, response, responseBody) => { |
| 485 | if (err) { |
| 486 | return callback(err); |
| 487 | } |
| 488 | let statusCode = response.statusCode; |
| 489 | if (statusCode !== 200) { |
| 490 | let error = new Error(responseBody); |
| 491 | error.statusCode = response.statusCode; |
| 492 | error.request = msRest.stripRequest(httpRequest); |
| 493 | error.response = msRest.stripResponse(response); |
| 494 | if (responseBody === '') responseBody = null; |
| 495 | let parsedErrorResponse; |
| 496 | try { |
| 497 | parsedErrorResponse = JSON.parse(responseBody); |
| 498 | if (parsedErrorResponse) { |
| 499 | let internalError = null; |
| 500 | if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; |
| 501 | error.code = internalError ? internalError.code : parsedErrorResponse.code; |
| 502 | error.message = internalError ? internalError.message : parsedErrorResponse.message; |
| 503 | } |
| 504 | } catch (defaultError) { |
| 505 | error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + |
| 506 | `- "${responseBody}" for the default response.`; |
| 507 | return callback(error); |
| 508 | } |
| 509 | return callback(error); |
| 510 | } |
| 511 | // Create Result |
| 512 | let result = null; |
| 513 | if (responseBody === '') responseBody = null; |
| 514 | // Deserialize Response |
| 515 | if (statusCode === 200) { |
| 516 | let parsedResponse = null; |
| 517 | try { |
| 518 | parsedResponse = JSON.parse(responseBody); |
| 519 | result = JSON.parse(responseBody); |
| 520 | if (parsedResponse !== null && parsedResponse !== undefined) { |
| 521 | let resultMapper = { |
| 522 | required: false, |
| 523 | serializedName: 'parsedResponse', |
| 524 | type: { |
| 525 | name: 'String' |
| 526 | } |
| 527 | }; |
| 528 | result = client.deserialize(resultMapper, parsedResponse, 'result'); |
| 529 | } |
| 530 | } catch (error) { |
| 531 | let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); |
| 532 | deserializationError.request = msRest.stripRequest(httpRequest); |
| 533 | deserializationError.response = msRest.stripResponse(response); |
| 534 | return callback(deserializationError); |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | return callback(null, result, httpRequest, response); |
| 539 | }); |
| 540 | } |
| 541 | |
| 542 | /** |
| 543 | * @summary Gets the native log of a specific crash as a text attachment |
| 544 | * |
| 545 | * Gets the native log of a specific crash as a text attachment |
| 546 | * |
| 547 | * @param {string} appName The name of the application |
| 548 | * |
| 549 | * @param {string} crashGroupId id of a specific group |
| 550 | * |
| 551 | * @param {string} crashId id of a specific crash |
| 552 | * |
| 553 | * @param {string} ownerName The name of the owner |
| 554 | * |
| 555 | * @param {object} [options] Optional Parameters. |
| 556 | * |
| 557 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 558 | * request |
| 559 | * |
| 560 | * @param {function} callback - The callback. |
| 561 | * |
| 562 | * @returns {function} callback(err, result, request, response) |
| 563 | * |
| 564 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 565 | * |
| 566 | * {string} [result] - The deserialized result object if an error did not occur. |
| 567 | * |
| 568 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 569 | * |
| 570 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 571 | */ |
| 572 | function _getNativeCrashDownload(appName, crashGroupId, crashId, ownerName, options, callback) { |
| 573 | /* jshint validthis: true */ |
| 574 | let client = this.client; |
| 575 | if(!callback && typeof options === 'function') { |
| 576 | callback = options; |
| 577 | options = null; |
| 578 | } |
| 579 | if (!callback) { |
| 580 | throw new Error('callback cannot be null.'); |
| 581 | } |
| 582 | // Validate |
| 583 | try { |
| 584 | if (appName === null || appName === undefined || typeof appName.valueOf() !== 'string') { |
| 585 | throw new Error('appName cannot be null or undefined and it must be of type string.'); |
| 586 | } |
| 587 | if (crashGroupId === null || crashGroupId === undefined || typeof crashGroupId.valueOf() !== 'string') { |
| 588 | throw new Error('crashGroupId cannot be null or undefined and it must be of type string.'); |
| 589 | } |
| 590 | if (crashId === null || crashId === undefined || typeof crashId.valueOf() !== 'string') { |
| 591 | throw new Error('crashId cannot be null or undefined and it must be of type string.'); |
| 592 | } |
| 593 | if (ownerName === null || ownerName === undefined || typeof ownerName.valueOf() !== 'string') { |
| 594 | throw new Error('ownerName cannot be null or undefined and it must be of type string.'); |
| 595 | } |
| 596 | } catch (error) { |
| 597 | return callback(error); |
| 598 | } |
| 599 | |
| 600 | // Construct URL |
| 601 | let baseUrl = this.client.baseUri; |
| 602 | let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/apps/{owner_name}/{app_name}/crash_groups/{crash_group_id}/crashes/{crash_id}/native/download'; |
| 603 | requestUrl = requestUrl.replace('{app_name}', encodeURIComponent(appName)); |
| 604 | requestUrl = requestUrl.replace('{crash_group_id}', encodeURIComponent(crashGroupId)); |
| 605 | requestUrl = requestUrl.replace('{crash_id}', encodeURIComponent(crashId)); |
| 606 | requestUrl = requestUrl.replace('{owner_name}', encodeURIComponent(ownerName)); |
| 607 | |
| 608 | // Create HTTP transport objects |
| 609 | let httpRequest = new WebResource(); |
| 610 | httpRequest.method = 'GET'; |
| 611 | httpRequest.url = requestUrl; |
| 612 | httpRequest.headers = {}; |
| 613 | // Set Headers |
| 614 | httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; |
| 615 | if(options) { |
| 616 | for(let headerName in options['customHeaders']) { |
| 617 | if (options['customHeaders'].hasOwnProperty(headerName)) { |
| 618 | httpRequest.headers[headerName] = options['customHeaders'][headerName]; |
| 619 | } |
| 620 | } |
| 621 | } |
| 622 | httpRequest.body = null; |
| 623 | // Send Request |
| 624 | return client.pipeline(httpRequest, (err, response, responseBody) => { |
| 625 | if (err) { |
| 626 | return callback(err); |
| 627 | } |
| 628 | let statusCode = response.statusCode; |
| 629 | if (statusCode !== 200) { |
| 630 | let error = new Error(responseBody); |
| 631 | error.statusCode = response.statusCode; |
| 632 | error.request = msRest.stripRequest(httpRequest); |
| 633 | error.response = msRest.stripResponse(response); |
| 634 | if (responseBody === '') responseBody = null; |
| 635 | let parsedErrorResponse; |
| 636 | try { |
| 637 | parsedErrorResponse = JSON.parse(responseBody); |
| 638 | if (parsedErrorResponse) { |
| 639 | let internalError = null; |
| 640 | if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; |
| 641 | error.code = internalError ? internalError.code : parsedErrorResponse.code; |
| 642 | error.message = internalError ? internalError.message : parsedErrorResponse.message; |
| 643 | } |
| 644 | } catch (defaultError) { |
| 645 | error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + |
| 646 | `- "${responseBody}" for the default response.`; |
| 647 | return callback(error); |
| 648 | } |
| 649 | return callback(error); |
| 650 | } |
| 651 | // Create Result |
| 652 | let result = null; |
| 653 | if (responseBody === '') responseBody = null; |
| 654 | // Deserialize Response |
| 655 | if (statusCode === 200) { |
| 656 | let parsedResponse = null; |
| 657 | try { |
| 658 | parsedResponse = JSON.parse(responseBody); |
| 659 | result = JSON.parse(responseBody); |
| 660 | if (parsedResponse !== null && parsedResponse !== undefined) { |
| 661 | let resultMapper = { |
| 662 | required: false, |
| 663 | serializedName: 'parsedResponse', |
| 664 | type: { |
| 665 | name: 'String' |
| 666 | } |
| 667 | }; |
| 668 | result = client.deserialize(resultMapper, parsedResponse, 'result'); |
| 669 | } |
| 670 | } catch (error) { |
| 671 | let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); |
| 672 | deserializationError.request = msRest.stripRequest(httpRequest); |
| 673 | deserializationError.response = msRest.stripResponse(response); |
| 674 | return callback(deserializationError); |
| 675 | } |
| 676 | } |
| 677 | |
| 678 | return callback(null, result, httpRequest, response); |
| 679 | }); |
| 680 | } |
| 681 | |
| 682 | /** |
| 683 | * Gets the URI location to download json of a specific crash |
| 684 | * |
| 685 | * @param {string} appName The name of the application |
| 686 | * |
| 687 | * @param {string} crashGroupId id of a specific group |
| 688 | * |
| 689 | * @param {string} crashId id of a specific crash |
| 690 | * |
| 691 | * @param {string} ownerName The name of the owner |
| 692 | * |
| 693 | * @param {object} [options] Optional Parameters. |
| 694 | * |
| 695 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 696 | * request |
| 697 | * |
| 698 | * @param {function} callback - The callback. |
| 699 | * |
| 700 | * @returns {function} callback(err, result, request, response) |
| 701 | * |
| 702 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 703 | * |
| 704 | * {object} [result] - The deserialized result object if an error did not occur. |
| 705 | * See {@link CrashRawLocation} for more information. |
| 706 | * |
| 707 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 708 | * |
| 709 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 710 | */ |
| 711 | function _getRawCrashLocation(appName, crashGroupId, crashId, ownerName, options, callback) { |
| 712 | /* jshint validthis: true */ |
| 713 | let client = this.client; |
| 714 | if(!callback && typeof options === 'function') { |
| 715 | callback = options; |
| 716 | options = null; |
| 717 | } |
| 718 | if (!callback) { |
| 719 | throw new Error('callback cannot be null.'); |
| 720 | } |
| 721 | // Validate |
| 722 | try { |
| 723 | if (appName === null || appName === undefined || typeof appName.valueOf() !== 'string') { |
| 724 | throw new Error('appName cannot be null or undefined and it must be of type string.'); |
| 725 | } |
| 726 | if (crashGroupId === null || crashGroupId === undefined || typeof crashGroupId.valueOf() !== 'string') { |
| 727 | throw new Error('crashGroupId cannot be null or undefined and it must be of type string.'); |
| 728 | } |
| 729 | if (crashId === null || crashId === undefined || typeof crashId.valueOf() !== 'string') { |
| 730 | throw new Error('crashId cannot be null or undefined and it must be of type string.'); |
| 731 | } |
| 732 | if (ownerName === null || ownerName === undefined || typeof ownerName.valueOf() !== 'string') { |
| 733 | throw new Error('ownerName cannot be null or undefined and it must be of type string.'); |
| 734 | } |
| 735 | } catch (error) { |
| 736 | return callback(error); |
| 737 | } |
| 738 | |
| 739 | // Construct URL |
| 740 | let baseUrl = this.client.baseUri; |
| 741 | let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/apps/{owner_name}/{app_name}/crash_groups/{crash_group_id}/crashes/{crash_id}/raw/location'; |
| 742 | requestUrl = requestUrl.replace('{app_name}', encodeURIComponent(appName)); |
| 743 | requestUrl = requestUrl.replace('{crash_group_id}', encodeURIComponent(crashGroupId)); |
| 744 | requestUrl = requestUrl.replace('{crash_id}', encodeURIComponent(crashId)); |
| 745 | requestUrl = requestUrl.replace('{owner_name}', encodeURIComponent(ownerName)); |
| 746 | |
| 747 | // Create HTTP transport objects |
| 748 | let httpRequest = new WebResource(); |
| 749 | httpRequest.method = 'GET'; |
| 750 | httpRequest.url = requestUrl; |
| 751 | httpRequest.headers = {}; |
| 752 | // Set Headers |
| 753 | httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; |
| 754 | if(options) { |
| 755 | for(let headerName in options['customHeaders']) { |
| 756 | if (options['customHeaders'].hasOwnProperty(headerName)) { |
| 757 | httpRequest.headers[headerName] = options['customHeaders'][headerName]; |
| 758 | } |
| 759 | } |
| 760 | } |
| 761 | httpRequest.body = null; |
| 762 | // Send Request |
| 763 | return client.pipeline(httpRequest, (err, response, responseBody) => { |
| 764 | if (err) { |
| 765 | return callback(err); |
| 766 | } |
| 767 | let statusCode = response.statusCode; |
| 768 | if (statusCode !== 200) { |
| 769 | let error = new Error(responseBody); |
| 770 | error.statusCode = response.statusCode; |
| 771 | error.request = msRest.stripRequest(httpRequest); |
| 772 | error.response = msRest.stripResponse(response); |
| 773 | if (responseBody === '') responseBody = null; |
| 774 | let parsedErrorResponse; |
| 775 | try { |
| 776 | parsedErrorResponse = JSON.parse(responseBody); |
| 777 | if (parsedErrorResponse) { |
| 778 | let internalError = null; |
| 779 | if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; |
| 780 | error.code = internalError ? internalError.code : parsedErrorResponse.code; |
| 781 | error.message = internalError ? internalError.message : parsedErrorResponse.message; |
| 782 | } |
| 783 | } catch (defaultError) { |
| 784 | error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + |
| 785 | `- "${responseBody}" for the default response.`; |
| 786 | return callback(error); |
| 787 | } |
| 788 | return callback(error); |
| 789 | } |
| 790 | // Create Result |
| 791 | let result = null; |
| 792 | if (responseBody === '') responseBody = null; |
| 793 | // Deserialize Response |
| 794 | if (statusCode === 200) { |
| 795 | let parsedResponse = null; |
| 796 | try { |
| 797 | parsedResponse = JSON.parse(responseBody); |
| 798 | result = JSON.parse(responseBody); |
| 799 | if (parsedResponse !== null && parsedResponse !== undefined) { |
| 800 | let resultMapper = new client.models['CrashRawLocation']().mapper(); |
| 801 | result = client.deserialize(resultMapper, parsedResponse, 'result'); |
| 802 | } |
| 803 | } catch (error) { |
| 804 | let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); |
| 805 | deserializationError.request = msRest.stripRequest(httpRequest); |
| 806 | deserializationError.response = msRest.stripResponse(response); |
| 807 | return callback(deserializationError); |
| 808 | } |
| 809 | } |
| 810 | |
| 811 | return callback(null, result, httpRequest, response); |
| 812 | }); |
| 813 | } |
| 814 | |
| 815 | /** |
| 816 | * Gets a stacktrace for a specific crash |
| 817 | * |
| 818 | * @param {string} appName The name of the application |
| 819 | * |
| 820 | * @param {string} crashGroupId id of a specific group |
| 821 | * |
| 822 | * @param {string} crashId id of a specific crash |
| 823 | * |
| 824 | * @param {string} ownerName The name of the owner |
| 825 | * |
| 826 | * @param {object} [options] Optional Parameters. |
| 827 | * |
| 828 | * @param {boolean} [options.groupingOnly] true if the stacktrace should be |
| 829 | * only the relevant thread / exception. Default is false |
| 830 | * |
| 831 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 832 | * request |
| 833 | * |
| 834 | * @param {function} callback - The callback. |
| 835 | * |
| 836 | * @returns {function} callback(err, result, request, response) |
| 837 | * |
| 838 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 839 | * |
| 840 | * {object} [result] - The deserialized result object if an error did not occur. |
| 841 | * See {@link Stacktrace} for more information. |
| 842 | * |
| 843 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 844 | * |
| 845 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 846 | */ |
| 847 | function _getStacktrace(appName, crashGroupId, crashId, ownerName, options, callback) { |
| 848 | /* jshint validthis: true */ |
| 849 | let client = this.client; |
| 850 | if(!callback && typeof options === 'function') { |
| 851 | callback = options; |
| 852 | options = null; |
| 853 | } |
| 854 | if (!callback) { |
| 855 | throw new Error('callback cannot be null.'); |
| 856 | } |
| 857 | let groupingOnly = (options && options.groupingOnly !== undefined) ? options.groupingOnly : false; |
| 858 | // Validate |
| 859 | try { |
| 860 | if (appName === null || appName === undefined || typeof appName.valueOf() !== 'string') { |
| 861 | throw new Error('appName cannot be null or undefined and it must be of type string.'); |
| 862 | } |
| 863 | if (crashGroupId === null || crashGroupId === undefined || typeof crashGroupId.valueOf() !== 'string') { |
| 864 | throw new Error('crashGroupId cannot be null or undefined and it must be of type string.'); |
| 865 | } |
| 866 | if (crashId === null || crashId === undefined || typeof crashId.valueOf() !== 'string') { |
| 867 | throw new Error('crashId cannot be null or undefined and it must be of type string.'); |
| 868 | } |
| 869 | if (groupingOnly !== null && groupingOnly !== undefined && typeof groupingOnly !== 'boolean') { |
| 870 | throw new Error('groupingOnly must be of type boolean.'); |
| 871 | } |
| 872 | if (ownerName === null || ownerName === undefined || typeof ownerName.valueOf() !== 'string') { |
| 873 | throw new Error('ownerName cannot be null or undefined and it must be of type string.'); |
| 874 | } |
| 875 | } catch (error) { |
| 876 | return callback(error); |
| 877 | } |
| 878 | |
| 879 | // Construct URL |
| 880 | let baseUrl = this.client.baseUri; |
| 881 | let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/apps/{owner_name}/{app_name}/crash_groups/{crash_group_id}/crashes/{crash_id}/stacktrace'; |
| 882 | requestUrl = requestUrl.replace('{app_name}', encodeURIComponent(appName)); |
| 883 | requestUrl = requestUrl.replace('{crash_group_id}', encodeURIComponent(crashGroupId)); |
| 884 | requestUrl = requestUrl.replace('{crash_id}', encodeURIComponent(crashId)); |
| 885 | requestUrl = requestUrl.replace('{owner_name}', encodeURIComponent(ownerName)); |
| 886 | let queryParameters = []; |
| 887 | if (groupingOnly !== null && groupingOnly !== undefined) { |
| 888 | queryParameters.push('grouping_only=' + encodeURIComponent(groupingOnly.toString())); |
| 889 | } |
| 890 | if (queryParameters.length > 0) { |
| 891 | requestUrl += '?' + queryParameters.join('&'); |
| 892 | } |
| 893 | |
| 894 | // Create HTTP transport objects |
| 895 | let httpRequest = new WebResource(); |
| 896 | httpRequest.method = 'GET'; |
| 897 | httpRequest.url = requestUrl; |
| 898 | httpRequest.headers = {}; |
| 899 | // Set Headers |
| 900 | httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; |
| 901 | if(options) { |
| 902 | for(let headerName in options['customHeaders']) { |
| 903 | if (options['customHeaders'].hasOwnProperty(headerName)) { |
| 904 | httpRequest.headers[headerName] = options['customHeaders'][headerName]; |
| 905 | } |
| 906 | } |
| 907 | } |
| 908 | httpRequest.body = null; |
| 909 | // Send Request |
| 910 | return client.pipeline(httpRequest, (err, response, responseBody) => { |
| 911 | if (err) { |
| 912 | return callback(err); |
| 913 | } |
| 914 | let statusCode = response.statusCode; |
| 915 | if (statusCode !== 200) { |
| 916 | let error = new Error(responseBody); |
| 917 | error.statusCode = response.statusCode; |
| 918 | error.request = msRest.stripRequest(httpRequest); |
| 919 | error.response = msRest.stripResponse(response); |
| 920 | if (responseBody === '') responseBody = null; |
| 921 | let parsedErrorResponse; |
| 922 | try { |
| 923 | parsedErrorResponse = JSON.parse(responseBody); |
| 924 | if (parsedErrorResponse) { |
| 925 | let internalError = null; |
| 926 | if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; |
| 927 | error.code = internalError ? internalError.code : parsedErrorResponse.code; |
| 928 | error.message = internalError ? internalError.message : parsedErrorResponse.message; |
| 929 | } |
| 930 | } catch (defaultError) { |
| 931 | error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + |
| 932 | `- "${responseBody}" for the default response.`; |
| 933 | return callback(error); |
| 934 | } |
| 935 | return callback(error); |
| 936 | } |
| 937 | // Create Result |
| 938 | let result = null; |
| 939 | if (responseBody === '') responseBody = null; |
| 940 | // Deserialize Response |
| 941 | if (statusCode === 200) { |
| 942 | let parsedResponse = null; |
| 943 | try { |
| 944 | parsedResponse = JSON.parse(responseBody); |
| 945 | result = JSON.parse(responseBody); |
| 946 | if (parsedResponse !== null && parsedResponse !== undefined) { |
| 947 | let resultMapper = new client.models['Stacktrace']().mapper(); |
| 948 | result = client.deserialize(resultMapper, parsedResponse, 'result'); |
| 949 | } |
| 950 | } catch (error) { |
| 951 | let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); |
| 952 | deserializationError.request = msRest.stripRequest(httpRequest); |
| 953 | deserializationError.response = msRest.stripResponse(response); |
| 954 | return callback(deserializationError); |
| 955 | } |
| 956 | } |
| 957 | |
| 958 | return callback(null, result, httpRequest, response); |
| 959 | }); |
| 960 | } |
| 961 | |
| 962 | /** |
| 963 | * query azure search |
| 964 | * |
| 965 | * @param {string} appName The name of the application |
| 966 | * |
| 967 | * @param {object} body the query request object |
| 968 | * |
| 969 | * @param {string} body.search |
| 970 | * |
| 971 | * @param {string} crashGroupId id of a specific group |
| 972 | * |
| 973 | * @param {string} ownerName The name of the owner |
| 974 | * |
| 975 | * @param {object} [options] Optional Parameters. |
| 976 | * |
| 977 | * @param {string} [options.appVersion] version |
| 978 | * |
| 979 | * @param {date} [options.dateFrom] |
| 980 | * |
| 981 | * @param {date} [options.dateTo] |
| 982 | * |
| 983 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 984 | * request |
| 985 | * |
| 986 | * @param {function} callback - The callback. |
| 987 | * |
| 988 | * @returns {function} callback(err, result, request, response) |
| 989 | * |
| 990 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 991 | * |
| 992 | * {array} [result] - The deserialized result object if an error did not occur. |
| 993 | * |
| 994 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 995 | * |
| 996 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 997 | */ |
| 998 | function _searchCrashes(appName, body, crashGroupId, ownerName, options, callback) { |
| 999 | /* jshint validthis: true */ |
| 1000 | let client = this.client; |
| 1001 | if(!callback && typeof options === 'function') { |
| 1002 | callback = options; |
| 1003 | options = null; |
| 1004 | } |
| 1005 | if (!callback) { |
| 1006 | throw new Error('callback cannot be null.'); |
| 1007 | } |
| 1008 | let appVersion = (options && options.appVersion !== undefined) ? options.appVersion : undefined; |
| 1009 | let dateFrom = (options && options.dateFrom !== undefined) ? options.dateFrom : undefined; |
| 1010 | let dateTo = (options && options.dateTo !== undefined) ? options.dateTo : undefined; |
| 1011 | // Validate |
| 1012 | try { |
| 1013 | if (appName === null || appName === undefined || typeof appName.valueOf() !== 'string') { |
| 1014 | throw new Error('appName cannot be null or undefined and it must be of type string.'); |
| 1015 | } |
| 1016 | if (appVersion !== null && appVersion !== undefined && typeof appVersion.valueOf() !== 'string') { |
| 1017 | throw new Error('appVersion must be of type string.'); |
| 1018 | } |
| 1019 | if (body === null || body === undefined) { |
| 1020 | throw new Error('body cannot be null or undefined.'); |
| 1021 | } |
| 1022 | if (crashGroupId === null || crashGroupId === undefined || typeof crashGroupId.valueOf() !== 'string') { |
| 1023 | throw new Error('crashGroupId cannot be null or undefined and it must be of type string.'); |
| 1024 | } |
| 1025 | if (crashGroupId !== null && crashGroupId !== undefined) { |
| 1026 | if (crashGroupId.match(/^[a-zA-Z0-9-]+$/) === null) |
| 1027 | { |
| 1028 | throw new Error('"crashGroupId" should satisfy the constraint - "Pattern": /^[a-zA-Z0-9-]+$/'); |
| 1029 | } |
| 1030 | } |
| 1031 | if (dateFrom && !(dateFrom instanceof Date || |
| 1032 | (typeof dateFrom.valueOf() === 'string' && !isNaN(Date.parse(dateFrom))))) { |
| 1033 | throw new Error('dateFrom must be of type date.'); |
| 1034 | } |
| 1035 | if (dateTo && !(dateTo instanceof Date || |
| 1036 | (typeof dateTo.valueOf() === 'string' && !isNaN(Date.parse(dateTo))))) { |
| 1037 | throw new Error('dateTo must be of type date.'); |
| 1038 | } |
| 1039 | if (ownerName === null || ownerName === undefined || typeof ownerName.valueOf() !== 'string') { |
| 1040 | throw new Error('ownerName cannot be null or undefined and it must be of type string.'); |
| 1041 | } |
| 1042 | } catch (error) { |
| 1043 | return callback(error); |
| 1044 | } |
| 1045 | |
| 1046 | // Construct URL |
| 1047 | let baseUrl = this.client.baseUri; |
| 1048 | let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/apps/{owner_name}/{app_name}/crash_groups/{crash_group_id}/crashes_search'; |
| 1049 | requestUrl = requestUrl.replace('{app_name}', encodeURIComponent(appName)); |
| 1050 | requestUrl = requestUrl.replace('{crash_group_id}', encodeURIComponent(crashGroupId)); |
| 1051 | requestUrl = requestUrl.replace('{owner_name}', encodeURIComponent(ownerName)); |
| 1052 | let queryParameters = []; |
| 1053 | if (appVersion !== null && appVersion !== undefined) { |
| 1054 | queryParameters.push('app_version=' + encodeURIComponent(appVersion)); |
| 1055 | } |
| 1056 | if (dateFrom !== null && dateFrom !== undefined) { |
| 1057 | queryParameters.push('date_from=' + encodeURIComponent(client.serializeObject(dateFrom))); |
| 1058 | } |
| 1059 | if (dateTo !== null && dateTo !== undefined) { |
| 1060 | queryParameters.push('date_to=' + encodeURIComponent(client.serializeObject(dateTo))); |
| 1061 | } |
| 1062 | if (queryParameters.length > 0) { |
| 1063 | requestUrl += '?' + queryParameters.join('&'); |
| 1064 | } |
| 1065 | |
| 1066 | // Create HTTP transport objects |
| 1067 | let httpRequest = new WebResource(); |
| 1068 | httpRequest.method = 'POST'; |
| 1069 | httpRequest.url = requestUrl; |
| 1070 | httpRequest.headers = {}; |
| 1071 | // Set Headers |
| 1072 | httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; |
| 1073 | if(options) { |
| 1074 | for(let headerName in options['customHeaders']) { |
| 1075 | if (options['customHeaders'].hasOwnProperty(headerName)) { |
| 1076 | httpRequest.headers[headerName] = options['customHeaders'][headerName]; |
| 1077 | } |
| 1078 | } |
| 1079 | } |
| 1080 | // Serialize Request |
| 1081 | let requestContent = null; |
| 1082 | let requestModel = null; |
| 1083 | try { |
| 1084 | if (body !== null && body !== undefined) { |
| 1085 | let requestModelMapper = new client.models['SearchItemsRequest']().mapper(); |
| 1086 | requestModel = client.serialize(requestModelMapper, body, 'body'); |
| 1087 | requestContent = JSON.stringify(requestModel); |
| 1088 | } |
| 1089 | } catch (error) { |
| 1090 | let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + |
| 1091 | `payload - ${JSON.stringify(body, null, 2)}.`); |
| 1092 | return callback(serializationError); |
| 1093 | } |
| 1094 | httpRequest.body = requestContent; |
| 1095 | // Send Request |
| 1096 | return client.pipeline(httpRequest, (err, response, responseBody) => { |
| 1097 | if (err) { |
| 1098 | return callback(err); |
| 1099 | } |
| 1100 | let statusCode = response.statusCode; |
| 1101 | if (statusCode !== 200) { |
| 1102 | let error = new Error(responseBody); |
| 1103 | error.statusCode = response.statusCode; |
| 1104 | error.request = msRest.stripRequest(httpRequest); |
| 1105 | error.response = msRest.stripResponse(response); |
| 1106 | if (responseBody === '') responseBody = null; |
| 1107 | let parsedErrorResponse; |
| 1108 | try { |
| 1109 | parsedErrorResponse = JSON.parse(responseBody); |
| 1110 | if (parsedErrorResponse) { |
| 1111 | let internalError = null; |
| 1112 | if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; |
| 1113 | error.code = internalError ? internalError.code : parsedErrorResponse.code; |
| 1114 | error.message = internalError ? internalError.message : parsedErrorResponse.message; |
| 1115 | } |
| 1116 | } catch (defaultError) { |
| 1117 | error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + |
| 1118 | `- "${responseBody}" for the default response.`; |
| 1119 | return callback(error); |
| 1120 | } |
| 1121 | return callback(error); |
| 1122 | } |
| 1123 | // Create Result |
| 1124 | let result = null; |
| 1125 | if (responseBody === '') responseBody = null; |
| 1126 | // Deserialize Response |
| 1127 | if (statusCode === 200) { |
| 1128 | let parsedResponse = null; |
| 1129 | try { |
| 1130 | parsedResponse = JSON.parse(responseBody); |
| 1131 | result = JSON.parse(responseBody); |
| 1132 | if (parsedResponse !== null && parsedResponse !== undefined) { |
| 1133 | let resultMapper = { |
| 1134 | required: false, |
| 1135 | serializedName: 'parsedResponse', |
| 1136 | type: { |
| 1137 | name: 'Sequence', |
| 1138 | element: { |
| 1139 | required: false, |
| 1140 | serializedName: 'SearchItemElementType', |
| 1141 | type: { |
| 1142 | name: 'Composite', |
| 1143 | className: 'SearchItem' |
| 1144 | } |
| 1145 | } |
| 1146 | } |
| 1147 | }; |
| 1148 | result = client.deserialize(resultMapper, parsedResponse, 'result'); |
| 1149 | } |
| 1150 | } catch (error) { |
| 1151 | let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); |
| 1152 | deserializationError.request = msRest.stripRequest(httpRequest); |
| 1153 | deserializationError.response = msRest.stripResponse(response); |
| 1154 | return callback(deserializationError); |
| 1155 | } |
| 1156 | } |
| 1157 | |
| 1158 | return callback(null, result, httpRequest, response); |
| 1159 | }); |
| 1160 | } |
| 1161 | |
| 1162 | /** |
| 1163 | * Gets all attachments for a specific crash |
| 1164 | * |
| 1165 | * @param {string} appName The name of the application |
| 1166 | * |
| 1167 | * @param {string} crashId id of a specific crash |
| 1168 | * |
| 1169 | * @param {string} ownerName The name of the owner |
| 1170 | * |
| 1171 | * @param {object} [options] Optional Parameters. |
| 1172 | * |
| 1173 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 1174 | * request |
| 1175 | * |
| 1176 | * @param {function} callback - The callback. |
| 1177 | * |
| 1178 | * @returns {function} callback(err, result, request, response) |
| 1179 | * |
| 1180 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 1181 | * |
| 1182 | * {array} [result] - The deserialized result object if an error did not occur. |
| 1183 | * |
| 1184 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 1185 | * |
| 1186 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 1187 | */ |
| 1188 | function _listAttachments(appName, crashId, ownerName, options, callback) { |
| 1189 | /* jshint validthis: true */ |
| 1190 | let client = this.client; |
| 1191 | if(!callback && typeof options === 'function') { |
| 1192 | callback = options; |
| 1193 | options = null; |
| 1194 | } |
| 1195 | if (!callback) { |
| 1196 | throw new Error('callback cannot be null.'); |
| 1197 | } |
| 1198 | // Validate |
| 1199 | try { |
| 1200 | if (appName === null || appName === undefined || typeof appName.valueOf() !== 'string') { |
| 1201 | throw new Error('appName cannot be null or undefined and it must be of type string.'); |
| 1202 | } |
| 1203 | if (crashId === null || crashId === undefined || typeof crashId.valueOf() !== 'string') { |
| 1204 | throw new Error('crashId cannot be null or undefined and it must be of type string.'); |
| 1205 | } |
| 1206 | if (ownerName === null || ownerName === undefined || typeof ownerName.valueOf() !== 'string') { |
| 1207 | throw new Error('ownerName cannot be null or undefined and it must be of type string.'); |
| 1208 | } |
| 1209 | } catch (error) { |
| 1210 | return callback(error); |
| 1211 | } |
| 1212 | |
| 1213 | // Construct URL |
| 1214 | let baseUrl = this.client.baseUri; |
| 1215 | let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/apps/{owner_name}/{app_name}/crashes/{crash_id}/attachments'; |
| 1216 | requestUrl = requestUrl.replace('{app_name}', encodeURIComponent(appName)); |
| 1217 | requestUrl = requestUrl.replace('{crash_id}', encodeURIComponent(crashId)); |
| 1218 | requestUrl = requestUrl.replace('{owner_name}', encodeURIComponent(ownerName)); |
| 1219 | |
| 1220 | // Create HTTP transport objects |
| 1221 | let httpRequest = new WebResource(); |
| 1222 | httpRequest.method = 'GET'; |
| 1223 | httpRequest.url = requestUrl; |
| 1224 | httpRequest.headers = {}; |
| 1225 | // Set Headers |
| 1226 | httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; |
| 1227 | if(options) { |
| 1228 | for(let headerName in options['customHeaders']) { |
| 1229 | if (options['customHeaders'].hasOwnProperty(headerName)) { |
| 1230 | httpRequest.headers[headerName] = options['customHeaders'][headerName]; |
| 1231 | } |
| 1232 | } |
| 1233 | } |
| 1234 | httpRequest.body = null; |
| 1235 | // Send Request |
| 1236 | return client.pipeline(httpRequest, (err, response, responseBody) => { |
| 1237 | if (err) { |
| 1238 | return callback(err); |
| 1239 | } |
| 1240 | let statusCode = response.statusCode; |
| 1241 | if (statusCode !== 200) { |
| 1242 | let error = new Error(responseBody); |
| 1243 | error.statusCode = response.statusCode; |
| 1244 | error.request = msRest.stripRequest(httpRequest); |
| 1245 | error.response = msRest.stripResponse(response); |
| 1246 | if (responseBody === '') responseBody = null; |
| 1247 | let parsedErrorResponse; |
| 1248 | try { |
| 1249 | parsedErrorResponse = JSON.parse(responseBody); |
| 1250 | if (parsedErrorResponse) { |
| 1251 | let internalError = null; |
| 1252 | if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; |
| 1253 | error.code = internalError ? internalError.code : parsedErrorResponse.code; |
| 1254 | error.message = internalError ? internalError.message : parsedErrorResponse.message; |
| 1255 | } |
| 1256 | } catch (defaultError) { |
| 1257 | error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + |
| 1258 | `- "${responseBody}" for the default response.`; |
| 1259 | return callback(error); |
| 1260 | } |
| 1261 | return callback(error); |
| 1262 | } |
| 1263 | // Create Result |
| 1264 | let result = null; |
| 1265 | if (responseBody === '') responseBody = null; |
| 1266 | // Deserialize Response |
| 1267 | if (statusCode === 200) { |
| 1268 | let parsedResponse = null; |
| 1269 | try { |
| 1270 | parsedResponse = JSON.parse(responseBody); |
| 1271 | result = JSON.parse(responseBody); |
| 1272 | if (parsedResponse !== null && parsedResponse !== undefined) { |
| 1273 | let resultMapper = { |
| 1274 | required: false, |
| 1275 | serializedName: 'parsedResponse', |
| 1276 | type: { |
| 1277 | name: 'Sequence', |
| 1278 | element: { |
| 1279 | required: false, |
| 1280 | serializedName: 'CrashAttachmentElementType', |
| 1281 | type: { |
| 1282 | name: 'Composite', |
| 1283 | className: 'CrashAttachment' |
| 1284 | } |
| 1285 | } |
| 1286 | } |
| 1287 | }; |
| 1288 | result = client.deserialize(resultMapper, parsedResponse, 'result'); |
| 1289 | } |
| 1290 | } catch (error) { |
| 1291 | let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); |
| 1292 | deserializationError.request = msRest.stripRequest(httpRequest); |
| 1293 | deserializationError.response = msRest.stripResponse(response); |
| 1294 | return callback(deserializationError); |
| 1295 | } |
| 1296 | } |
| 1297 | |
| 1298 | return callback(null, result, httpRequest, response); |
| 1299 | }); |
| 1300 | } |
| 1301 | |
| 1302 | /** |
| 1303 | * Gets the URI location to download crash attachment |
| 1304 | * |
| 1305 | * @param {string} appName The name of the application |
| 1306 | * |
| 1307 | * @param {string} attachmentId attachment id |
| 1308 | * |
| 1309 | * @param {string} crashId id of a specific crash |
| 1310 | * |
| 1311 | * @param {string} ownerName The name of the owner |
| 1312 | * |
| 1313 | * @param {object} [options] Optional Parameters. |
| 1314 | * |
| 1315 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 1316 | * request |
| 1317 | * |
| 1318 | * @param {function} callback - The callback. |
| 1319 | * |
| 1320 | * @returns {function} callback(err, result, request, response) |
| 1321 | * |
| 1322 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 1323 | * |
| 1324 | * {object} [result] - The deserialized result object if an error did not occur. |
| 1325 | * See {@link CrashAttachmentLocation} for more |
| 1326 | * information. |
| 1327 | * |
| 1328 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 1329 | * |
| 1330 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 1331 | */ |
| 1332 | function _getCrashAttachmentLocation(appName, attachmentId, crashId, ownerName, options, callback) { |
| 1333 | /* jshint validthis: true */ |
| 1334 | let client = this.client; |
| 1335 | if(!callback && typeof options === 'function') { |
| 1336 | callback = options; |
| 1337 | options = null; |
| 1338 | } |
| 1339 | if (!callback) { |
| 1340 | throw new Error('callback cannot be null.'); |
| 1341 | } |
| 1342 | // Validate |
| 1343 | try { |
| 1344 | if (appName === null || appName === undefined || typeof appName.valueOf() !== 'string') { |
| 1345 | throw new Error('appName cannot be null or undefined and it must be of type string.'); |
| 1346 | } |
| 1347 | if (attachmentId === null || attachmentId === undefined || typeof attachmentId.valueOf() !== 'string') { |
| 1348 | throw new Error('attachmentId cannot be null or undefined and it must be of type string.'); |
| 1349 | } |
| 1350 | if (crashId === null || crashId === undefined || typeof crashId.valueOf() !== 'string') { |
| 1351 | throw new Error('crashId cannot be null or undefined and it must be of type string.'); |
| 1352 | } |
| 1353 | if (ownerName === null || ownerName === undefined || typeof ownerName.valueOf() !== 'string') { |
| 1354 | throw new Error('ownerName cannot be null or undefined and it must be of type string.'); |
| 1355 | } |
| 1356 | } catch (error) { |
| 1357 | return callback(error); |
| 1358 | } |
| 1359 | |
| 1360 | // Construct URL |
| 1361 | let baseUrl = this.client.baseUri; |
| 1362 | let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/apps/{owner_name}/{app_name}/crashes/{crash_id}/attachments/{attachment_id}/location'; |
| 1363 | requestUrl = requestUrl.replace('{app_name}', encodeURIComponent(appName)); |
| 1364 | requestUrl = requestUrl.replace('{attachment_id}', encodeURIComponent(attachmentId)); |
| 1365 | requestUrl = requestUrl.replace('{crash_id}', encodeURIComponent(crashId)); |
| 1366 | requestUrl = requestUrl.replace('{owner_name}', encodeURIComponent(ownerName)); |
| 1367 | |
| 1368 | // Create HTTP transport objects |
| 1369 | let httpRequest = new WebResource(); |
| 1370 | httpRequest.method = 'GET'; |
| 1371 | httpRequest.url = requestUrl; |
| 1372 | httpRequest.headers = {}; |
| 1373 | // Set Headers |
| 1374 | httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; |
| 1375 | if(options) { |
| 1376 | for(let headerName in options['customHeaders']) { |
| 1377 | if (options['customHeaders'].hasOwnProperty(headerName)) { |
| 1378 | httpRequest.headers[headerName] = options['customHeaders'][headerName]; |
| 1379 | } |
| 1380 | } |
| 1381 | } |
| 1382 | httpRequest.body = null; |
| 1383 | // Send Request |
| 1384 | return client.pipeline(httpRequest, (err, response, responseBody) => { |
| 1385 | if (err) { |
| 1386 | return callback(err); |
| 1387 | } |
| 1388 | let statusCode = response.statusCode; |
| 1389 | if (statusCode !== 200) { |
| 1390 | let error = new Error(responseBody); |
| 1391 | error.statusCode = response.statusCode; |
| 1392 | error.request = msRest.stripRequest(httpRequest); |
| 1393 | error.response = msRest.stripResponse(response); |
| 1394 | if (responseBody === '') responseBody = null; |
| 1395 | let parsedErrorResponse; |
| 1396 | try { |
| 1397 | parsedErrorResponse = JSON.parse(responseBody); |
| 1398 | if (parsedErrorResponse) { |
| 1399 | let internalError = null; |
| 1400 | if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; |
| 1401 | error.code = internalError ? internalError.code : parsedErrorResponse.code; |
| 1402 | error.message = internalError ? internalError.message : parsedErrorResponse.message; |
| 1403 | } |
| 1404 | } catch (defaultError) { |
| 1405 | error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + |
| 1406 | `- "${responseBody}" for the default response.`; |
| 1407 | return callback(error); |
| 1408 | } |
| 1409 | return callback(error); |
| 1410 | } |
| 1411 | // Create Result |
| 1412 | let result = null; |
| 1413 | if (responseBody === '') responseBody = null; |
| 1414 | // Deserialize Response |
| 1415 | if (statusCode === 200) { |
| 1416 | let parsedResponse = null; |
| 1417 | try { |
| 1418 | parsedResponse = JSON.parse(responseBody); |
| 1419 | result = JSON.parse(responseBody); |
| 1420 | if (parsedResponse !== null && parsedResponse !== undefined) { |
| 1421 | let resultMapper = new client.models['CrashAttachmentLocation']().mapper(); |
| 1422 | result = client.deserialize(resultMapper, parsedResponse, 'result'); |
| 1423 | } |
| 1424 | } catch (error) { |
| 1425 | let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); |
| 1426 | deserializationError.request = msRest.stripRequest(httpRequest); |
| 1427 | deserializationError.response = msRest.stripResponse(response); |
| 1428 | return callback(deserializationError); |
| 1429 | } |
| 1430 | } |
| 1431 | |
| 1432 | return callback(null, result, httpRequest, response); |
| 1433 | }); |
| 1434 | } |
| 1435 | |
| 1436 | /** |
| 1437 | * Gets content of the text attachment |
| 1438 | * |
| 1439 | * @param {string} appName The name of the application |
| 1440 | * |
| 1441 | * @param {string} attachmentId attachment id |
| 1442 | * |
| 1443 | * @param {string} crashId id of a specific crash |
| 1444 | * |
| 1445 | * @param {string} ownerName The name of the owner |
| 1446 | * |
| 1447 | * @param {object} [options] Optional Parameters. |
| 1448 | * |
| 1449 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 1450 | * request |
| 1451 | * |
| 1452 | * @param {function} callback - The callback. |
| 1453 | * |
| 1454 | * @returns {function} callback(err, result, request, response) |
| 1455 | * |
| 1456 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 1457 | * |
| 1458 | * {string} [result] - The deserialized result object if an error did not occur. |
| 1459 | * |
| 1460 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 1461 | * |
| 1462 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 1463 | */ |
| 1464 | function _getCrashTextAttachmentContent(appName, attachmentId, crashId, ownerName, options, callback) { |
| 1465 | /* jshint validthis: true */ |
| 1466 | let client = this.client; |
| 1467 | if(!callback && typeof options === 'function') { |
| 1468 | callback = options; |
| 1469 | options = null; |
| 1470 | } |
| 1471 | if (!callback) { |
| 1472 | throw new Error('callback cannot be null.'); |
| 1473 | } |
| 1474 | // Validate |
| 1475 | try { |
| 1476 | if (appName === null || appName === undefined || typeof appName.valueOf() !== 'string') { |
| 1477 | throw new Error('appName cannot be null or undefined and it must be of type string.'); |
| 1478 | } |
| 1479 | if (attachmentId === null || attachmentId === undefined || typeof attachmentId.valueOf() !== 'string') { |
| 1480 | throw new Error('attachmentId cannot be null or undefined and it must be of type string.'); |
| 1481 | } |
| 1482 | if (crashId === null || crashId === undefined || typeof crashId.valueOf() !== 'string') { |
| 1483 | throw new Error('crashId cannot be null or undefined and it must be of type string.'); |
| 1484 | } |
| 1485 | if (ownerName === null || ownerName === undefined || typeof ownerName.valueOf() !== 'string') { |
| 1486 | throw new Error('ownerName cannot be null or undefined and it must be of type string.'); |
| 1487 | } |
| 1488 | } catch (error) { |
| 1489 | return callback(error); |
| 1490 | } |
| 1491 | |
| 1492 | // Construct URL |
| 1493 | let baseUrl = this.client.baseUri; |
| 1494 | let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/apps/{owner_name}/{app_name}/crashes/{crash_id}/attachments/{attachment_id}/text'; |
| 1495 | requestUrl = requestUrl.replace('{app_name}', encodeURIComponent(appName)); |
| 1496 | requestUrl = requestUrl.replace('{attachment_id}', encodeURIComponent(attachmentId)); |
| 1497 | requestUrl = requestUrl.replace('{crash_id}', encodeURIComponent(crashId)); |
| 1498 | requestUrl = requestUrl.replace('{owner_name}', encodeURIComponent(ownerName)); |
| 1499 | |
| 1500 | // Create HTTP transport objects |
| 1501 | let httpRequest = new WebResource(); |
| 1502 | httpRequest.method = 'GET'; |
| 1503 | httpRequest.url = requestUrl; |
| 1504 | httpRequest.headers = {}; |
| 1505 | // Set Headers |
| 1506 | httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; |
| 1507 | if(options) { |
| 1508 | for(let headerName in options['customHeaders']) { |
| 1509 | if (options['customHeaders'].hasOwnProperty(headerName)) { |
| 1510 | httpRequest.headers[headerName] = options['customHeaders'][headerName]; |
| 1511 | } |
| 1512 | } |
| 1513 | } |
| 1514 | httpRequest.body = null; |
| 1515 | // Send Request |
| 1516 | return client.pipeline(httpRequest, (err, response, responseBody) => { |
| 1517 | if (err) { |
| 1518 | return callback(err); |
| 1519 | } |
| 1520 | let statusCode = response.statusCode; |
| 1521 | if (statusCode !== 200) { |
| 1522 | let error = new Error(responseBody); |
| 1523 | error.statusCode = response.statusCode; |
| 1524 | error.request = msRest.stripRequest(httpRequest); |
| 1525 | error.response = msRest.stripResponse(response); |
| 1526 | if (responseBody === '') responseBody = null; |
| 1527 | let parsedErrorResponse; |
| 1528 | try { |
| 1529 | parsedErrorResponse = JSON.parse(responseBody); |
| 1530 | if (parsedErrorResponse) { |
| 1531 | let internalError = null; |
| 1532 | if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; |
| 1533 | error.code = internalError ? internalError.code : parsedErrorResponse.code; |
| 1534 | error.message = internalError ? internalError.message : parsedErrorResponse.message; |
| 1535 | } |
| 1536 | } catch (defaultError) { |
| 1537 | error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + |
| 1538 | `- "${responseBody}" for the default response.`; |
| 1539 | return callback(error); |
| 1540 | } |
| 1541 | return callback(error); |
| 1542 | } |
| 1543 | // Create Result |
| 1544 | let result = null; |
| 1545 | if (responseBody === '') responseBody = null; |
| 1546 | // Deserialize Response |
| 1547 | if (statusCode === 200) { |
| 1548 | let parsedResponse = null; |
| 1549 | try { |
| 1550 | parsedResponse = JSON.parse(responseBody); |
| 1551 | result = JSON.parse(responseBody); |
| 1552 | if (parsedResponse !== null && parsedResponse !== undefined) { |
| 1553 | let resultMapper = { |
| 1554 | required: false, |
| 1555 | serializedName: 'parsedResponse', |
| 1556 | type: { |
| 1557 | name: 'String' |
| 1558 | } |
| 1559 | }; |
| 1560 | result = client.deserialize(resultMapper, parsedResponse, 'result'); |
| 1561 | } |
| 1562 | } catch (error) { |
| 1563 | let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); |
| 1564 | deserializationError.request = msRest.stripRequest(httpRequest); |
| 1565 | deserializationError.response = msRest.stripResponse(response); |
| 1566 | return callback(deserializationError); |
| 1567 | } |
| 1568 | } |
| 1569 | |
| 1570 | return callback(null, result, httpRequest, response); |
| 1571 | }); |
| 1572 | } |
| 1573 | |
| 1574 | /** |
| 1575 | * @summary Gets whether the application has any crashes |
| 1576 | * |
| 1577 | * Gets whether the application has any crashes |
| 1578 | * |
| 1579 | * @param {string} appName The name of the application |
| 1580 | * |
| 1581 | * @param {string} ownerName The name of the owner |
| 1582 | * |
| 1583 | * @param {object} [options] Optional Parameters. |
| 1584 | * |
| 1585 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 1586 | * request |
| 1587 | * |
| 1588 | * @param {function} callback - The callback. |
| 1589 | * |
| 1590 | * @returns {function} callback(err, result, request, response) |
| 1591 | * |
| 1592 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 1593 | * |
| 1594 | * {object} [result] - The deserialized result object if an error did not occur. |
| 1595 | * See {@link AppCrashesInfo} for more information. |
| 1596 | * |
| 1597 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 1598 | * |
| 1599 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 1600 | */ |
| 1601 | function _getAppCrashesInfo(appName, ownerName, options, callback) { |
| 1602 | /* jshint validthis: true */ |
| 1603 | let client = this.client; |
| 1604 | if(!callback && typeof options === 'function') { |
| 1605 | callback = options; |
| 1606 | options = null; |
| 1607 | } |
| 1608 | if (!callback) { |
| 1609 | throw new Error('callback cannot be null.'); |
| 1610 | } |
| 1611 | // Validate |
| 1612 | try { |
| 1613 | if (appName === null || appName === undefined || typeof appName.valueOf() !== 'string') { |
| 1614 | throw new Error('appName cannot be null or undefined and it must be of type string.'); |
| 1615 | } |
| 1616 | if (ownerName === null || ownerName === undefined || typeof ownerName.valueOf() !== 'string') { |
| 1617 | throw new Error('ownerName cannot be null or undefined and it must be of type string.'); |
| 1618 | } |
| 1619 | } catch (error) { |
| 1620 | return callback(error); |
| 1621 | } |
| 1622 | |
| 1623 | // Construct URL |
| 1624 | let baseUrl = this.client.baseUri; |
| 1625 | let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/apps/{owner_name}/{app_name}/crashes_info'; |
| 1626 | requestUrl = requestUrl.replace('{app_name}', encodeURIComponent(appName)); |
| 1627 | requestUrl = requestUrl.replace('{owner_name}', encodeURIComponent(ownerName)); |
| 1628 | |
| 1629 | // Create HTTP transport objects |
| 1630 | let httpRequest = new WebResource(); |
| 1631 | httpRequest.method = 'GET'; |
| 1632 | httpRequest.url = requestUrl; |
| 1633 | httpRequest.headers = {}; |
| 1634 | // Set Headers |
| 1635 | httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; |
| 1636 | if(options) { |
| 1637 | for(let headerName in options['customHeaders']) { |
| 1638 | if (options['customHeaders'].hasOwnProperty(headerName)) { |
| 1639 | httpRequest.headers[headerName] = options['customHeaders'][headerName]; |
| 1640 | } |
| 1641 | } |
| 1642 | } |
| 1643 | httpRequest.body = null; |
| 1644 | // Send Request |
| 1645 | return client.pipeline(httpRequest, (err, response, responseBody) => { |
| 1646 | if (err) { |
| 1647 | return callback(err); |
| 1648 | } |
| 1649 | let statusCode = response.statusCode; |
| 1650 | if (statusCode !== 200) { |
| 1651 | let error = new Error(responseBody); |
| 1652 | error.statusCode = response.statusCode; |
| 1653 | error.request = msRest.stripRequest(httpRequest); |
| 1654 | error.response = msRest.stripResponse(response); |
| 1655 | if (responseBody === '') responseBody = null; |
| 1656 | let parsedErrorResponse; |
| 1657 | try { |
| 1658 | parsedErrorResponse = JSON.parse(responseBody); |
| 1659 | if (parsedErrorResponse) { |
| 1660 | let internalError = null; |
| 1661 | if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; |
| 1662 | error.code = internalError ? internalError.code : parsedErrorResponse.code; |
| 1663 | error.message = internalError ? internalError.message : parsedErrorResponse.message; |
| 1664 | } |
| 1665 | } catch (defaultError) { |
| 1666 | error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + |
| 1667 | `- "${responseBody}" for the default response.`; |
| 1668 | return callback(error); |
| 1669 | } |
| 1670 | return callback(error); |
| 1671 | } |
| 1672 | // Create Result |
| 1673 | let result = null; |
| 1674 | if (responseBody === '') responseBody = null; |
| 1675 | // Deserialize Response |
| 1676 | if (statusCode === 200) { |
| 1677 | let parsedResponse = null; |
| 1678 | try { |
| 1679 | parsedResponse = JSON.parse(responseBody); |
| 1680 | result = JSON.parse(responseBody); |
| 1681 | if (parsedResponse !== null && parsedResponse !== undefined) { |
| 1682 | let resultMapper = new client.models['AppCrashesInfo']().mapper(); |
| 1683 | result = client.deserialize(resultMapper, parsedResponse, 'result'); |
| 1684 | } |
| 1685 | } catch (error) { |
| 1686 | let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); |
| 1687 | deserializationError.request = msRest.stripRequest(httpRequest); |
| 1688 | deserializationError.response = msRest.stripResponse(response); |
| 1689 | return callback(deserializationError); |
| 1690 | } |
| 1691 | } |
| 1692 | |
| 1693 | return callback(null, result, httpRequest, response); |
| 1694 | }); |
| 1695 | } |
| 1696 | |
| 1697 | /** |
| 1698 | * @summary Gets the state of HockeyApp Crash forwarding for SxS apps |
| 1699 | * |
| 1700 | * Gets the state of HockeyApp Crash forwarding for SxS apps |
| 1701 | * |
| 1702 | * @param {string} appName The name of the application |
| 1703 | * |
| 1704 | * @param {string} ownerName The name of the owner |
| 1705 | * |
| 1706 | * @param {object} [options] Optional Parameters. |
| 1707 | * |
| 1708 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 1709 | * request |
| 1710 | * |
| 1711 | * @param {function} callback - The callback. |
| 1712 | * |
| 1713 | * @returns {function} callback(err, result, request, response) |
| 1714 | * |
| 1715 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 1716 | * |
| 1717 | * {object} [result] - The deserialized result object if an error did not occur. |
| 1718 | * See {@link HockeyAppCrashForwardingInfo} for more |
| 1719 | * information. |
| 1720 | * |
| 1721 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 1722 | * |
| 1723 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 1724 | */ |
| 1725 | function _getHockeyAppCrashForwardingStatus(appName, ownerName, options, callback) { |
| 1726 | /* jshint validthis: true */ |
| 1727 | let client = this.client; |
| 1728 | if(!callback && typeof options === 'function') { |
| 1729 | callback = options; |
| 1730 | options = null; |
| 1731 | } |
| 1732 | if (!callback) { |
| 1733 | throw new Error('callback cannot be null.'); |
| 1734 | } |
| 1735 | // Validate |
| 1736 | try { |
| 1737 | if (appName === null || appName === undefined || typeof appName.valueOf() !== 'string') { |
| 1738 | throw new Error('appName cannot be null or undefined and it must be of type string.'); |
| 1739 | } |
| 1740 | if (ownerName === null || ownerName === undefined || typeof ownerName.valueOf() !== 'string') { |
| 1741 | throw new Error('ownerName cannot be null or undefined and it must be of type string.'); |
| 1742 | } |
| 1743 | } catch (error) { |
| 1744 | return callback(error); |
| 1745 | } |
| 1746 | |
| 1747 | // Construct URL |
| 1748 | let baseUrl = this.client.baseUri; |
| 1749 | let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/apps/{owner_name}/{app_name}/hockeyapp_crash_forwarding'; |
| 1750 | requestUrl = requestUrl.replace('{app_name}', encodeURIComponent(appName)); |
| 1751 | requestUrl = requestUrl.replace('{owner_name}', encodeURIComponent(ownerName)); |
| 1752 | |
| 1753 | // Create HTTP transport objects |
| 1754 | let httpRequest = new WebResource(); |
| 1755 | httpRequest.method = 'GET'; |
| 1756 | httpRequest.url = requestUrl; |
| 1757 | httpRequest.headers = {}; |
| 1758 | // Set Headers |
| 1759 | httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; |
| 1760 | if(options) { |
| 1761 | for(let headerName in options['customHeaders']) { |
| 1762 | if (options['customHeaders'].hasOwnProperty(headerName)) { |
| 1763 | httpRequest.headers[headerName] = options['customHeaders'][headerName]; |
| 1764 | } |
| 1765 | } |
| 1766 | } |
| 1767 | httpRequest.body = null; |
| 1768 | // Send Request |
| 1769 | return client.pipeline(httpRequest, (err, response, responseBody) => { |
| 1770 | if (err) { |
| 1771 | return callback(err); |
| 1772 | } |
| 1773 | let statusCode = response.statusCode; |
| 1774 | if (statusCode !== 200) { |
| 1775 | let error = new Error(responseBody); |
| 1776 | error.statusCode = response.statusCode; |
| 1777 | error.request = msRest.stripRequest(httpRequest); |
| 1778 | error.response = msRest.stripResponse(response); |
| 1779 | if (responseBody === '') responseBody = null; |
| 1780 | let parsedErrorResponse; |
| 1781 | try { |
| 1782 | parsedErrorResponse = JSON.parse(responseBody); |
| 1783 | if (parsedErrorResponse) { |
| 1784 | let internalError = null; |
| 1785 | if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; |
| 1786 | error.code = internalError ? internalError.code : parsedErrorResponse.code; |
| 1787 | error.message = internalError ? internalError.message : parsedErrorResponse.message; |
| 1788 | } |
| 1789 | } catch (defaultError) { |
| 1790 | error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + |
| 1791 | `- "${responseBody}" for the default response.`; |
| 1792 | return callback(error); |
| 1793 | } |
| 1794 | return callback(error); |
| 1795 | } |
| 1796 | // Create Result |
| 1797 | let result = null; |
| 1798 | if (responseBody === '') responseBody = null; |
| 1799 | // Deserialize Response |
| 1800 | if (statusCode === 200) { |
| 1801 | let parsedResponse = null; |
| 1802 | try { |
| 1803 | parsedResponse = JSON.parse(responseBody); |
| 1804 | result = JSON.parse(responseBody); |
| 1805 | if (parsedResponse !== null && parsedResponse !== undefined) { |
| 1806 | let resultMapper = new client.models['HockeyAppCrashForwardingInfo']().mapper(); |
| 1807 | result = client.deserialize(resultMapper, parsedResponse, 'result'); |
| 1808 | } |
| 1809 | } catch (error) { |
| 1810 | let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); |
| 1811 | deserializationError.request = msRest.stripRequest(httpRequest); |
| 1812 | deserializationError.response = msRest.stripResponse(response); |
| 1813 | return callback(deserializationError); |
| 1814 | } |
| 1815 | } |
| 1816 | |
| 1817 | return callback(null, result, httpRequest, response); |
| 1818 | }); |
| 1819 | } |
| 1820 | |
| 1821 | /** |
| 1822 | * @summary Enable HockeyApp crash forwarding for SxS apps |
| 1823 | * |
| 1824 | * Enable HockeyApp crash forwarding for SxS apps |
| 1825 | * |
| 1826 | * @param {string} appName The name of the application |
| 1827 | * |
| 1828 | * @param {object} body Enable Forwarding |
| 1829 | * |
| 1830 | * @param {boolean} [body.enableForwarding] |
| 1831 | * |
| 1832 | * @param {string} ownerName The name of the owner |
| 1833 | * |
| 1834 | * @param {object} [options] Optional Parameters. |
| 1835 | * |
| 1836 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 1837 | * request |
| 1838 | * |
| 1839 | * @param {function} callback - The callback. |
| 1840 | * |
| 1841 | * @returns {function} callback(err, result, request, response) |
| 1842 | * |
| 1843 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 1844 | * |
| 1845 | * {object} [result] - The deserialized result object if an error did not occur. |
| 1846 | * See {@link HockeyAppCrashForwardingInfo} for more |
| 1847 | * information. |
| 1848 | * |
| 1849 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 1850 | * |
| 1851 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 1852 | */ |
| 1853 | function _updateHockeyAppCrashForwarding(appName, body, ownerName, options, callback) { |
| 1854 | /* jshint validthis: true */ |
| 1855 | let client = this.client; |
| 1856 | if(!callback && typeof options === 'function') { |
| 1857 | callback = options; |
| 1858 | options = null; |
| 1859 | } |
| 1860 | if (!callback) { |
| 1861 | throw new Error('callback cannot be null.'); |
| 1862 | } |
| 1863 | // Validate |
| 1864 | try { |
| 1865 | if (appName === null || appName === undefined || typeof appName.valueOf() !== 'string') { |
| 1866 | throw new Error('appName cannot be null or undefined and it must be of type string.'); |
| 1867 | } |
| 1868 | if (body === null || body === undefined) { |
| 1869 | throw new Error('body cannot be null or undefined.'); |
| 1870 | } |
| 1871 | if (ownerName === null || ownerName === undefined || typeof ownerName.valueOf() !== 'string') { |
| 1872 | throw new Error('ownerName cannot be null or undefined and it must be of type string.'); |
| 1873 | } |
| 1874 | } catch (error) { |
| 1875 | return callback(error); |
| 1876 | } |
| 1877 | |
| 1878 | // Construct URL |
| 1879 | let baseUrl = this.client.baseUri; |
| 1880 | let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/apps/{owner_name}/{app_name}/hockeyapp_crash_forwarding'; |
| 1881 | requestUrl = requestUrl.replace('{app_name}', encodeURIComponent(appName)); |
| 1882 | requestUrl = requestUrl.replace('{owner_name}', encodeURIComponent(ownerName)); |
| 1883 | |
| 1884 | // Create HTTP transport objects |
| 1885 | let httpRequest = new WebResource(); |
| 1886 | httpRequest.method = 'PATCH'; |
| 1887 | httpRequest.url = requestUrl; |
| 1888 | httpRequest.headers = {}; |
| 1889 | // Set Headers |
| 1890 | httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; |
| 1891 | if(options) { |
| 1892 | for(let headerName in options['customHeaders']) { |
| 1893 | if (options['customHeaders'].hasOwnProperty(headerName)) { |
| 1894 | httpRequest.headers[headerName] = options['customHeaders'][headerName]; |
| 1895 | } |
| 1896 | } |
| 1897 | } |
| 1898 | // Serialize Request |
| 1899 | let requestContent = null; |
| 1900 | let requestModel = null; |
| 1901 | try { |
| 1902 | if (body !== null && body !== undefined) { |
| 1903 | let requestModelMapper = new client.models['HockeyAppCrashForwardingChange']().mapper(); |
| 1904 | requestModel = client.serialize(requestModelMapper, body, 'body'); |
| 1905 | requestContent = JSON.stringify(requestModel); |
| 1906 | } |
| 1907 | } catch (error) { |
| 1908 | let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + |
| 1909 | `payload - ${JSON.stringify(body, null, 2)}.`); |
| 1910 | return callback(serializationError); |
| 1911 | } |
| 1912 | httpRequest.body = requestContent; |
| 1913 | // Send Request |
| 1914 | return client.pipeline(httpRequest, (err, response, responseBody) => { |
| 1915 | if (err) { |
| 1916 | return callback(err); |
| 1917 | } |
| 1918 | let statusCode = response.statusCode; |
| 1919 | if (statusCode !== 200) { |
| 1920 | let error = new Error(responseBody); |
| 1921 | error.statusCode = response.statusCode; |
| 1922 | error.request = msRest.stripRequest(httpRequest); |
| 1923 | error.response = msRest.stripResponse(response); |
| 1924 | if (responseBody === '') responseBody = null; |
| 1925 | let parsedErrorResponse; |
| 1926 | try { |
| 1927 | parsedErrorResponse = JSON.parse(responseBody); |
| 1928 | if (parsedErrorResponse) { |
| 1929 | let internalError = null; |
| 1930 | if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; |
| 1931 | error.code = internalError ? internalError.code : parsedErrorResponse.code; |
| 1932 | error.message = internalError ? internalError.message : parsedErrorResponse.message; |
| 1933 | } |
| 1934 | } catch (defaultError) { |
| 1935 | error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + |
| 1936 | `- "${responseBody}" for the default response.`; |
| 1937 | return callback(error); |
| 1938 | } |
| 1939 | return callback(error); |
| 1940 | } |
| 1941 | // Create Result |
| 1942 | let result = null; |
| 1943 | if (responseBody === '') responseBody = null; |
| 1944 | // Deserialize Response |
| 1945 | if (statusCode === 200) { |
| 1946 | let parsedResponse = null; |
| 1947 | try { |
| 1948 | parsedResponse = JSON.parse(responseBody); |
| 1949 | result = JSON.parse(responseBody); |
| 1950 | if (parsedResponse !== null && parsedResponse !== undefined) { |
| 1951 | let resultMapper = new client.models['HockeyAppCrashForwardingInfo']().mapper(); |
| 1952 | result = client.deserialize(resultMapper, parsedResponse, 'result'); |
| 1953 | } |
| 1954 | } catch (error) { |
| 1955 | let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); |
| 1956 | deserializationError.request = msRest.stripRequest(httpRequest); |
| 1957 | deserializationError.response = msRest.stripResponse(response); |
| 1958 | return callback(deserializationError); |
| 1959 | } |
| 1960 | } |
| 1961 | |
| 1962 | return callback(null, result, httpRequest, response); |
| 1963 | }); |
| 1964 | } |
| 1965 | |
| 1966 | /** |
| 1967 | * @summary Gets a list of application versions |
| 1968 | * |
| 1969 | * Gets a list of application versions |
| 1970 | * |
| 1971 | * @param {string} appName The name of the application |
| 1972 | * |
| 1973 | * @param {string} ownerName The name of the owner |
| 1974 | * |
| 1975 | * @param {object} [options] Optional Parameters. |
| 1976 | * |
| 1977 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 1978 | * request |
| 1979 | * |
| 1980 | * @param {function} callback - The callback. |
| 1981 | * |
| 1982 | * @returns {function} callback(err, result, request, response) |
| 1983 | * |
| 1984 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 1985 | * |
| 1986 | * {array} [result] - The deserialized result object if an error did not occur. |
| 1987 | * |
| 1988 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 1989 | * |
| 1990 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 1991 | */ |
| 1992 | function _getAppVersions(appName, ownerName, options, callback) { |
| 1993 | /* jshint validthis: true */ |
| 1994 | let client = this.client; |
| 1995 | if(!callback && typeof options === 'function') { |
| 1996 | callback = options; |
| 1997 | options = null; |
| 1998 | } |
| 1999 | if (!callback) { |
| 2000 | throw new Error('callback cannot be null.'); |
| 2001 | } |
| 2002 | // Validate |
| 2003 | try { |
| 2004 | if (appName === null || appName === undefined || typeof appName.valueOf() !== 'string') { |
| 2005 | throw new Error('appName cannot be null or undefined and it must be of type string.'); |
| 2006 | } |
| 2007 | if (ownerName === null || ownerName === undefined || typeof ownerName.valueOf() !== 'string') { |
| 2008 | throw new Error('ownerName cannot be null or undefined and it must be of type string.'); |
| 2009 | } |
| 2010 | } catch (error) { |
| 2011 | return callback(error); |
| 2012 | } |
| 2013 | |
| 2014 | // Construct URL |
| 2015 | let baseUrl = this.client.baseUri; |
| 2016 | let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'v0.1/apps/{owner_name}/{app_name}/versions'; |
| 2017 | requestUrl = requestUrl.replace('{app_name}', encodeURIComponent(appName)); |
| 2018 | requestUrl = requestUrl.replace('{owner_name}', encodeURIComponent(ownerName)); |
| 2019 | |
| 2020 | // Create HTTP transport objects |
| 2021 | let httpRequest = new WebResource(); |
| 2022 | httpRequest.method = 'GET'; |
| 2023 | httpRequest.url = requestUrl; |
| 2024 | httpRequest.headers = {}; |
| 2025 | // Set Headers |
| 2026 | httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; |
| 2027 | if(options) { |
| 2028 | for(let headerName in options['customHeaders']) { |
| 2029 | if (options['customHeaders'].hasOwnProperty(headerName)) { |
| 2030 | httpRequest.headers[headerName] = options['customHeaders'][headerName]; |
| 2031 | } |
| 2032 | } |
| 2033 | } |
| 2034 | httpRequest.body = null; |
| 2035 | // Send Request |
| 2036 | return client.pipeline(httpRequest, (err, response, responseBody) => { |
| 2037 | if (err) { |
| 2038 | return callback(err); |
| 2039 | } |
| 2040 | let statusCode = response.statusCode; |
| 2041 | if (statusCode !== 200) { |
| 2042 | let error = new Error(responseBody); |
| 2043 | error.statusCode = response.statusCode; |
| 2044 | error.request = msRest.stripRequest(httpRequest); |
| 2045 | error.response = msRest.stripResponse(response); |
| 2046 | if (responseBody === '') responseBody = null; |
| 2047 | let parsedErrorResponse; |
| 2048 | try { |
| 2049 | parsedErrorResponse = JSON.parse(responseBody); |
| 2050 | if (parsedErrorResponse) { |
| 2051 | let internalError = null; |
| 2052 | if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; |
| 2053 | error.code = internalError ? internalError.code : parsedErrorResponse.code; |
| 2054 | error.message = internalError ? internalError.message : parsedErrorResponse.message; |
| 2055 | } |
| 2056 | } catch (defaultError) { |
| 2057 | error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + |
| 2058 | `- "${responseBody}" for the default response.`; |
| 2059 | return callback(error); |
| 2060 | } |
| 2061 | return callback(error); |
| 2062 | } |
| 2063 | // Create Result |
| 2064 | let result = null; |
| 2065 | if (responseBody === '') responseBody = null; |
| 2066 | // Deserialize Response |
| 2067 | if (statusCode === 200) { |
| 2068 | let parsedResponse = null; |
| 2069 | try { |
| 2070 | parsedResponse = JSON.parse(responseBody); |
| 2071 | result = JSON.parse(responseBody); |
| 2072 | if (parsedResponse !== null && parsedResponse !== undefined) { |
| 2073 | let resultMapper = { |
| 2074 | required: false, |
| 2075 | serializedName: 'parsedResponse', |
| 2076 | type: { |
| 2077 | name: 'Sequence', |
| 2078 | element: { |
| 2079 | required: false, |
| 2080 | serializedName: 'AppVersionElementType', |
| 2081 | type: { |
| 2082 | name: 'Composite', |
| 2083 | className: 'AppVersion' |
| 2084 | } |
| 2085 | } |
| 2086 | } |
| 2087 | }; |
| 2088 | result = client.deserialize(resultMapper, parsedResponse, 'result'); |
| 2089 | } |
| 2090 | } catch (error) { |
| 2091 | let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); |
| 2092 | deserializationError.request = msRest.stripRequest(httpRequest); |
| 2093 | deserializationError.response = msRest.stripResponse(response); |
| 2094 | return callback(deserializationError); |
| 2095 | } |
| 2096 | } |
| 2097 | |
| 2098 | return callback(null, result, httpRequest, response); |
| 2099 | }); |
| 2100 | } |
| 2101 | |
| 2102 | /** Class representing a Crashes. */ |
| 2103 | class Crashes { |
| 2104 | /** |
| 2105 | * Create a Crashes. |
| 2106 | * @param {CrashClient} client Reference to the service client. |
| 2107 | */ |
| 2108 | constructor(client) { |
| 2109 | this.client = client; |
| 2110 | this._list = _list; |
| 2111 | this._get = _get; |
| 2112 | this._getNativeCrash = _getNativeCrash; |
| 2113 | this._getNativeCrashDownload = _getNativeCrashDownload; |
| 2114 | this._getRawCrashLocation = _getRawCrashLocation; |
| 2115 | this._getStacktrace = _getStacktrace; |
| 2116 | this._searchCrashes = _searchCrashes; |
| 2117 | this._listAttachments = _listAttachments; |
| 2118 | this._getCrashAttachmentLocation = _getCrashAttachmentLocation; |
| 2119 | this._getCrashTextAttachmentContent = _getCrashTextAttachmentContent; |
| 2120 | this._getAppCrashesInfo = _getAppCrashesInfo; |
| 2121 | this._getHockeyAppCrashForwardingStatus = _getHockeyAppCrashForwardingStatus; |
| 2122 | this._updateHockeyAppCrashForwarding = _updateHockeyAppCrashForwarding; |
| 2123 | this._getAppVersions = _getAppVersions; |
| 2124 | } |
| 2125 | |
| 2126 | /** |
| 2127 | * Gets all crashes of a group |
| 2128 | * |
| 2129 | * @param {string} appName The name of the application |
| 2130 | * |
| 2131 | * @param {string} crashGroupId id of a specific group |
| 2132 | * |
| 2133 | * @param {string} ownerName The name of the owner |
| 2134 | * |
| 2135 | * @param {object} [options] Optional Parameters. |
| 2136 | * |
| 2137 | * @param {string} [options.appVersion] version |
| 2138 | * |
| 2139 | * @param {date} [options.dateFrom] |
| 2140 | * |
| 2141 | * @param {date} [options.dateTo] |
| 2142 | * |
| 2143 | * @param {string} [options.errorType] Possible values include: |
| 2144 | * 'CrashingErrors', 'HandledErrors' |
| 2145 | * |
| 2146 | * @param {boolean} [options.includeLog] true if the crash should include the |
| 2147 | * custom log report. Default is false |
| 2148 | * |
| 2149 | * @param {boolean} [options.includeReport] true if the crash should include |
| 2150 | * the raw crash report. Default is false |
| 2151 | * |
| 2152 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2153 | * request |
| 2154 | * |
| 2155 | * @returns {Promise} A promise is returned |
| 2156 | * |
| 2157 | * @resolve {HttpOperationResponse<Array>} - The deserialized result object. |
| 2158 | * |
| 2159 | * @reject {Error} - The error object. |
| 2160 | */ |
| 2161 | listWithHttpOperationResponse(appName, crashGroupId, ownerName, options) { |
| 2162 | let client = this.client; |
| 2163 | let self = this; |
| 2164 | return new Promise((resolve, reject) => { |
| 2165 | self._list(appName, crashGroupId, ownerName, options, (err, result, request, response) => { |
| 2166 | let httpOperationResponse = new msRest.HttpOperationResponse(request, response); |
| 2167 | httpOperationResponse.body = result; |
| 2168 | if (err) { reject(err); } |
| 2169 | else { resolve(httpOperationResponse); } |
| 2170 | return; |
| 2171 | }); |
| 2172 | }); |
| 2173 | } |
| 2174 | |
| 2175 | /** |
| 2176 | * Gets all crashes of a group |
| 2177 | * |
| 2178 | * @param {string} appName The name of the application |
| 2179 | * |
| 2180 | * @param {string} crashGroupId id of a specific group |
| 2181 | * |
| 2182 | * @param {string} ownerName The name of the owner |
| 2183 | * |
| 2184 | * @param {object} [options] Optional Parameters. |
| 2185 | * |
| 2186 | * @param {string} [options.appVersion] version |
| 2187 | * |
| 2188 | * @param {date} [options.dateFrom] |
| 2189 | * |
| 2190 | * @param {date} [options.dateTo] |
| 2191 | * |
| 2192 | * @param {string} [options.errorType] Possible values include: |
| 2193 | * 'CrashingErrors', 'HandledErrors' |
| 2194 | * |
| 2195 | * @param {boolean} [options.includeLog] true if the crash should include the |
| 2196 | * custom log report. Default is false |
| 2197 | * |
| 2198 | * @param {boolean} [options.includeReport] true if the crash should include |
| 2199 | * the raw crash report. Default is false |
| 2200 | * |
| 2201 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2202 | * request |
| 2203 | * |
| 2204 | * @param {function} [optionalCallback] - The optional callback. |
| 2205 | * |
| 2206 | * @returns {function|Promise} If a callback was passed as the last parameter |
| 2207 | * then it returns the callback else returns a Promise. |
| 2208 | * |
| 2209 | * {Promise} A promise is returned |
| 2210 | * |
| 2211 | * @resolve {Array} - The deserialized result object. |
| 2212 | * |
| 2213 | * @reject {Error} - The error object. |
| 2214 | * |
| 2215 | * {function} optionalCallback(err, result, request, response) |
| 2216 | * |
| 2217 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 2218 | * |
| 2219 | * {array} [result] - The deserialized result object if an error did not occur. |
| 2220 | * |
| 2221 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 2222 | * |
| 2223 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 2224 | */ |
| 2225 | list(appName, crashGroupId, ownerName, options, optionalCallback) { |
| 2226 | let client = this.client; |
| 2227 | let self = this; |
| 2228 | if (!optionalCallback && typeof options === 'function') { |
| 2229 | optionalCallback = options; |
| 2230 | options = null; |
| 2231 | } |
| 2232 | if (!optionalCallback) { |
| 2233 | return new Promise((resolve, reject) => { |
| 2234 | self._list(appName, crashGroupId, ownerName, options, (err, result, request, response) => { |
| 2235 | if (err) { reject(err); } |
| 2236 | else { resolve(result); } |
| 2237 | return; |
| 2238 | }); |
| 2239 | }); |
| 2240 | } else { |
| 2241 | return self._list(appName, crashGroupId, ownerName, options, optionalCallback); |
| 2242 | } |
| 2243 | } |
| 2244 | |
| 2245 | /** |
| 2246 | * Gets a specific crash for an app |
| 2247 | * |
| 2248 | * @param {string} appName The name of the application |
| 2249 | * |
| 2250 | * @param {string} crashGroupId id of a specific group |
| 2251 | * |
| 2252 | * @param {string} crashId id of a specific crash |
| 2253 | * |
| 2254 | * @param {string} ownerName The name of the owner |
| 2255 | * |
| 2256 | * @param {object} [options] Optional Parameters. |
| 2257 | * |
| 2258 | * @param {boolean} [options.groupingOnly] true if the stacktrace should be |
| 2259 | * only the relevant thread / exception. Default is false |
| 2260 | * |
| 2261 | * @param {boolean} [options.includeDetails] true if the crash should include |
| 2262 | * in depth crash details |
| 2263 | * |
| 2264 | * @param {boolean} [options.includeLog] true if the crash should include the |
| 2265 | * custom log report. Default is false |
| 2266 | * |
| 2267 | * @param {boolean} [options.includeReport] true if the crash should include |
| 2268 | * the raw crash report. Default is false |
| 2269 | * |
| 2270 | * @param {boolean} [options.includeStacktrace] true if the crash should |
| 2271 | * include the stacktrace information |
| 2272 | * |
| 2273 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2274 | * request |
| 2275 | * |
| 2276 | * @returns {Promise} A promise is returned |
| 2277 | * |
| 2278 | * @resolve {HttpOperationResponse<Crash>} - The deserialized result object. |
| 2279 | * |
| 2280 | * @reject {Error} - The error object. |
| 2281 | */ |
| 2282 | getWithHttpOperationResponse(appName, crashGroupId, crashId, ownerName, options) { |
| 2283 | let client = this.client; |
| 2284 | let self = this; |
| 2285 | return new Promise((resolve, reject) => { |
| 2286 | self._get(appName, crashGroupId, crashId, ownerName, options, (err, result, request, response) => { |
| 2287 | let httpOperationResponse = new msRest.HttpOperationResponse(request, response); |
| 2288 | httpOperationResponse.body = result; |
| 2289 | if (err) { reject(err); } |
| 2290 | else { resolve(httpOperationResponse); } |
| 2291 | return; |
| 2292 | }); |
| 2293 | }); |
| 2294 | } |
| 2295 | |
| 2296 | /** |
| 2297 | * Gets a specific crash for an app |
| 2298 | * |
| 2299 | * @param {string} appName The name of the application |
| 2300 | * |
| 2301 | * @param {string} crashGroupId id of a specific group |
| 2302 | * |
| 2303 | * @param {string} crashId id of a specific crash |
| 2304 | * |
| 2305 | * @param {string} ownerName The name of the owner |
| 2306 | * |
| 2307 | * @param {object} [options] Optional Parameters. |
| 2308 | * |
| 2309 | * @param {boolean} [options.groupingOnly] true if the stacktrace should be |
| 2310 | * only the relevant thread / exception. Default is false |
| 2311 | * |
| 2312 | * @param {boolean} [options.includeDetails] true if the crash should include |
| 2313 | * in depth crash details |
| 2314 | * |
| 2315 | * @param {boolean} [options.includeLog] true if the crash should include the |
| 2316 | * custom log report. Default is false |
| 2317 | * |
| 2318 | * @param {boolean} [options.includeReport] true if the crash should include |
| 2319 | * the raw crash report. Default is false |
| 2320 | * |
| 2321 | * @param {boolean} [options.includeStacktrace] true if the crash should |
| 2322 | * include the stacktrace information |
| 2323 | * |
| 2324 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2325 | * request |
| 2326 | * |
| 2327 | * @param {function} [optionalCallback] - The optional callback. |
| 2328 | * |
| 2329 | * @returns {function|Promise} If a callback was passed as the last parameter |
| 2330 | * then it returns the callback else returns a Promise. |
| 2331 | * |
| 2332 | * {Promise} A promise is returned |
| 2333 | * |
| 2334 | * @resolve {Crash} - The deserialized result object. |
| 2335 | * |
| 2336 | * @reject {Error} - The error object. |
| 2337 | * |
| 2338 | * {function} optionalCallback(err, result, request, response) |
| 2339 | * |
| 2340 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 2341 | * |
| 2342 | * {object} [result] - The deserialized result object if an error did not occur. |
| 2343 | * See {@link Crash} for more information. |
| 2344 | * |
| 2345 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 2346 | * |
| 2347 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 2348 | */ |
| 2349 | get(appName, crashGroupId, crashId, ownerName, options, optionalCallback) { |
| 2350 | let client = this.client; |
| 2351 | let self = this; |
| 2352 | if (!optionalCallback && typeof options === 'function') { |
| 2353 | optionalCallback = options; |
| 2354 | options = null; |
| 2355 | } |
| 2356 | if (!optionalCallback) { |
| 2357 | return new Promise((resolve, reject) => { |
| 2358 | self._get(appName, crashGroupId, crashId, ownerName, options, (err, result, request, response) => { |
| 2359 | if (err) { reject(err); } |
| 2360 | else { resolve(result); } |
| 2361 | return; |
| 2362 | }); |
| 2363 | }); |
| 2364 | } else { |
| 2365 | return self._get(appName, crashGroupId, crashId, ownerName, options, optionalCallback); |
| 2366 | } |
| 2367 | } |
| 2368 | |
| 2369 | /** |
| 2370 | * @summary Gets the native log of a specific crash |
| 2371 | * |
| 2372 | * Gets the native log of a specific crash |
| 2373 | * |
| 2374 | * @param {string} appName The name of the application |
| 2375 | * |
| 2376 | * @param {string} crashGroupId id of a specific group |
| 2377 | * |
| 2378 | * @param {string} crashId id of a specific crash |
| 2379 | * |
| 2380 | * @param {string} ownerName The name of the owner |
| 2381 | * |
| 2382 | * @param {object} [options] Optional Parameters. |
| 2383 | * |
| 2384 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2385 | * request |
| 2386 | * |
| 2387 | * @returns {Promise} A promise is returned |
| 2388 | * |
| 2389 | * @resolve {HttpOperationResponse<String>} - The deserialized result object. |
| 2390 | * |
| 2391 | * @reject {Error} - The error object. |
| 2392 | */ |
| 2393 | getNativeCrashWithHttpOperationResponse(appName, crashGroupId, crashId, ownerName, options) { |
| 2394 | let client = this.client; |
| 2395 | let self = this; |
| 2396 | return new Promise((resolve, reject) => { |
| 2397 | self._getNativeCrash(appName, crashGroupId, crashId, ownerName, options, (err, result, request, response) => { |
| 2398 | let httpOperationResponse = new msRest.HttpOperationResponse(request, response); |
| 2399 | httpOperationResponse.body = result; |
| 2400 | if (err) { reject(err); } |
| 2401 | else { resolve(httpOperationResponse); } |
| 2402 | return; |
| 2403 | }); |
| 2404 | }); |
| 2405 | } |
| 2406 | |
| 2407 | /** |
| 2408 | * @summary Gets the native log of a specific crash |
| 2409 | * |
| 2410 | * Gets the native log of a specific crash |
| 2411 | * |
| 2412 | * @param {string} appName The name of the application |
| 2413 | * |
| 2414 | * @param {string} crashGroupId id of a specific group |
| 2415 | * |
| 2416 | * @param {string} crashId id of a specific crash |
| 2417 | * |
| 2418 | * @param {string} ownerName The name of the owner |
| 2419 | * |
| 2420 | * @param {object} [options] Optional Parameters. |
| 2421 | * |
| 2422 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2423 | * request |
| 2424 | * |
| 2425 | * @param {function} [optionalCallback] - The optional callback. |
| 2426 | * |
| 2427 | * @returns {function|Promise} If a callback was passed as the last parameter |
| 2428 | * then it returns the callback else returns a Promise. |
| 2429 | * |
| 2430 | * {Promise} A promise is returned |
| 2431 | * |
| 2432 | * @resolve {String} - The deserialized result object. |
| 2433 | * |
| 2434 | * @reject {Error} - The error object. |
| 2435 | * |
| 2436 | * {function} optionalCallback(err, result, request, response) |
| 2437 | * |
| 2438 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 2439 | * |
| 2440 | * {string} [result] - The deserialized result object if an error did not occur. |
| 2441 | * |
| 2442 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 2443 | * |
| 2444 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 2445 | */ |
| 2446 | getNativeCrash(appName, crashGroupId, crashId, ownerName, options, optionalCallback) { |
| 2447 | let client = this.client; |
| 2448 | let self = this; |
| 2449 | if (!optionalCallback && typeof options === 'function') { |
| 2450 | optionalCallback = options; |
| 2451 | options = null; |
| 2452 | } |
| 2453 | if (!optionalCallback) { |
| 2454 | return new Promise((resolve, reject) => { |
| 2455 | self._getNativeCrash(appName, crashGroupId, crashId, ownerName, options, (err, result, request, response) => { |
| 2456 | if (err) { reject(err); } |
| 2457 | else { resolve(result); } |
| 2458 | return; |
| 2459 | }); |
| 2460 | }); |
| 2461 | } else { |
| 2462 | return self._getNativeCrash(appName, crashGroupId, crashId, ownerName, options, optionalCallback); |
| 2463 | } |
| 2464 | } |
| 2465 | |
| 2466 | /** |
| 2467 | * @summary Gets the native log of a specific crash as a text attachment |
| 2468 | * |
| 2469 | * Gets the native log of a specific crash as a text attachment |
| 2470 | * |
| 2471 | * @param {string} appName The name of the application |
| 2472 | * |
| 2473 | * @param {string} crashGroupId id of a specific group |
| 2474 | * |
| 2475 | * @param {string} crashId id of a specific crash |
| 2476 | * |
| 2477 | * @param {string} ownerName The name of the owner |
| 2478 | * |
| 2479 | * @param {object} [options] Optional Parameters. |
| 2480 | * |
| 2481 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2482 | * request |
| 2483 | * |
| 2484 | * @returns {Promise} A promise is returned |
| 2485 | * |
| 2486 | * @resolve {HttpOperationResponse<String>} - The deserialized result object. |
| 2487 | * |
| 2488 | * @reject {Error} - The error object. |
| 2489 | */ |
| 2490 | getNativeCrashDownloadWithHttpOperationResponse(appName, crashGroupId, crashId, ownerName, options) { |
| 2491 | let client = this.client; |
| 2492 | let self = this; |
| 2493 | return new Promise((resolve, reject) => { |
| 2494 | self._getNativeCrashDownload(appName, crashGroupId, crashId, ownerName, options, (err, result, request, response) => { |
| 2495 | let httpOperationResponse = new msRest.HttpOperationResponse(request, response); |
| 2496 | httpOperationResponse.body = result; |
| 2497 | if (err) { reject(err); } |
| 2498 | else { resolve(httpOperationResponse); } |
| 2499 | return; |
| 2500 | }); |
| 2501 | }); |
| 2502 | } |
| 2503 | |
| 2504 | /** |
| 2505 | * @summary Gets the native log of a specific crash as a text attachment |
| 2506 | * |
| 2507 | * Gets the native log of a specific crash as a text attachment |
| 2508 | * |
| 2509 | * @param {string} appName The name of the application |
| 2510 | * |
| 2511 | * @param {string} crashGroupId id of a specific group |
| 2512 | * |
| 2513 | * @param {string} crashId id of a specific crash |
| 2514 | * |
| 2515 | * @param {string} ownerName The name of the owner |
| 2516 | * |
| 2517 | * @param {object} [options] Optional Parameters. |
| 2518 | * |
| 2519 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2520 | * request |
| 2521 | * |
| 2522 | * @param {function} [optionalCallback] - The optional callback. |
| 2523 | * |
| 2524 | * @returns {function|Promise} If a callback was passed as the last parameter |
| 2525 | * then it returns the callback else returns a Promise. |
| 2526 | * |
| 2527 | * {Promise} A promise is returned |
| 2528 | * |
| 2529 | * @resolve {String} - The deserialized result object. |
| 2530 | * |
| 2531 | * @reject {Error} - The error object. |
| 2532 | * |
| 2533 | * {function} optionalCallback(err, result, request, response) |
| 2534 | * |
| 2535 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 2536 | * |
| 2537 | * {string} [result] - The deserialized result object if an error did not occur. |
| 2538 | * |
| 2539 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 2540 | * |
| 2541 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 2542 | */ |
| 2543 | getNativeCrashDownload(appName, crashGroupId, crashId, ownerName, options, optionalCallback) { |
| 2544 | let client = this.client; |
| 2545 | let self = this; |
| 2546 | if (!optionalCallback && typeof options === 'function') { |
| 2547 | optionalCallback = options; |
| 2548 | options = null; |
| 2549 | } |
| 2550 | if (!optionalCallback) { |
| 2551 | return new Promise((resolve, reject) => { |
| 2552 | self._getNativeCrashDownload(appName, crashGroupId, crashId, ownerName, options, (err, result, request, response) => { |
| 2553 | if (err) { reject(err); } |
| 2554 | else { resolve(result); } |
| 2555 | return; |
| 2556 | }); |
| 2557 | }); |
| 2558 | } else { |
| 2559 | return self._getNativeCrashDownload(appName, crashGroupId, crashId, ownerName, options, optionalCallback); |
| 2560 | } |
| 2561 | } |
| 2562 | |
| 2563 | /** |
| 2564 | * Gets the URI location to download json of a specific crash |
| 2565 | * |
| 2566 | * @param {string} appName The name of the application |
| 2567 | * |
| 2568 | * @param {string} crashGroupId id of a specific group |
| 2569 | * |
| 2570 | * @param {string} crashId id of a specific crash |
| 2571 | * |
| 2572 | * @param {string} ownerName The name of the owner |
| 2573 | * |
| 2574 | * @param {object} [options] Optional Parameters. |
| 2575 | * |
| 2576 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2577 | * request |
| 2578 | * |
| 2579 | * @returns {Promise} A promise is returned |
| 2580 | * |
| 2581 | * @resolve {HttpOperationResponse<CrashRawLocation>} - The deserialized result object. |
| 2582 | * |
| 2583 | * @reject {Error} - The error object. |
| 2584 | */ |
| 2585 | getRawCrashLocationWithHttpOperationResponse(appName, crashGroupId, crashId, ownerName, options) { |
| 2586 | let client = this.client; |
| 2587 | let self = this; |
| 2588 | return new Promise((resolve, reject) => { |
| 2589 | self._getRawCrashLocation(appName, crashGroupId, crashId, ownerName, options, (err, result, request, response) => { |
| 2590 | let httpOperationResponse = new msRest.HttpOperationResponse(request, response); |
| 2591 | httpOperationResponse.body = result; |
| 2592 | if (err) { reject(err); } |
| 2593 | else { resolve(httpOperationResponse); } |
| 2594 | return; |
| 2595 | }); |
| 2596 | }); |
| 2597 | } |
| 2598 | |
| 2599 | /** |
| 2600 | * Gets the URI location to download json of a specific crash |
| 2601 | * |
| 2602 | * @param {string} appName The name of the application |
| 2603 | * |
| 2604 | * @param {string} crashGroupId id of a specific group |
| 2605 | * |
| 2606 | * @param {string} crashId id of a specific crash |
| 2607 | * |
| 2608 | * @param {string} ownerName The name of the owner |
| 2609 | * |
| 2610 | * @param {object} [options] Optional Parameters. |
| 2611 | * |
| 2612 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2613 | * request |
| 2614 | * |
| 2615 | * @param {function} [optionalCallback] - The optional callback. |
| 2616 | * |
| 2617 | * @returns {function|Promise} If a callback was passed as the last parameter |
| 2618 | * then it returns the callback else returns a Promise. |
| 2619 | * |
| 2620 | * {Promise} A promise is returned |
| 2621 | * |
| 2622 | * @resolve {CrashRawLocation} - The deserialized result object. |
| 2623 | * |
| 2624 | * @reject {Error} - The error object. |
| 2625 | * |
| 2626 | * {function} optionalCallback(err, result, request, response) |
| 2627 | * |
| 2628 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 2629 | * |
| 2630 | * {object} [result] - The deserialized result object if an error did not occur. |
| 2631 | * See {@link CrashRawLocation} for more information. |
| 2632 | * |
| 2633 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 2634 | * |
| 2635 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 2636 | */ |
| 2637 | getRawCrashLocation(appName, crashGroupId, crashId, ownerName, options, optionalCallback) { |
| 2638 | let client = this.client; |
| 2639 | let self = this; |
| 2640 | if (!optionalCallback && typeof options === 'function') { |
| 2641 | optionalCallback = options; |
| 2642 | options = null; |
| 2643 | } |
| 2644 | if (!optionalCallback) { |
| 2645 | return new Promise((resolve, reject) => { |
| 2646 | self._getRawCrashLocation(appName, crashGroupId, crashId, ownerName, options, (err, result, request, response) => { |
| 2647 | if (err) { reject(err); } |
| 2648 | else { resolve(result); } |
| 2649 | return; |
| 2650 | }); |
| 2651 | }); |
| 2652 | } else { |
| 2653 | return self._getRawCrashLocation(appName, crashGroupId, crashId, ownerName, options, optionalCallback); |
| 2654 | } |
| 2655 | } |
| 2656 | |
| 2657 | /** |
| 2658 | * Gets a stacktrace for a specific crash |
| 2659 | * |
| 2660 | * @param {string} appName The name of the application |
| 2661 | * |
| 2662 | * @param {string} crashGroupId id of a specific group |
| 2663 | * |
| 2664 | * @param {string} crashId id of a specific crash |
| 2665 | * |
| 2666 | * @param {string} ownerName The name of the owner |
| 2667 | * |
| 2668 | * @param {object} [options] Optional Parameters. |
| 2669 | * |
| 2670 | * @param {boolean} [options.groupingOnly] true if the stacktrace should be |
| 2671 | * only the relevant thread / exception. Default is false |
| 2672 | * |
| 2673 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2674 | * request |
| 2675 | * |
| 2676 | * @returns {Promise} A promise is returned |
| 2677 | * |
| 2678 | * @resolve {HttpOperationResponse<Stacktrace>} - The deserialized result object. |
| 2679 | * |
| 2680 | * @reject {Error} - The error object. |
| 2681 | */ |
| 2682 | getStacktraceWithHttpOperationResponse(appName, crashGroupId, crashId, ownerName, options) { |
| 2683 | let client = this.client; |
| 2684 | let self = this; |
| 2685 | return new Promise((resolve, reject) => { |
| 2686 | self._getStacktrace(appName, crashGroupId, crashId, ownerName, options, (err, result, request, response) => { |
| 2687 | let httpOperationResponse = new msRest.HttpOperationResponse(request, response); |
| 2688 | httpOperationResponse.body = result; |
| 2689 | if (err) { reject(err); } |
| 2690 | else { resolve(httpOperationResponse); } |
| 2691 | return; |
| 2692 | }); |
| 2693 | }); |
| 2694 | } |
| 2695 | |
| 2696 | /** |
| 2697 | * Gets a stacktrace for a specific crash |
| 2698 | * |
| 2699 | * @param {string} appName The name of the application |
| 2700 | * |
| 2701 | * @param {string} crashGroupId id of a specific group |
| 2702 | * |
| 2703 | * @param {string} crashId id of a specific crash |
| 2704 | * |
| 2705 | * @param {string} ownerName The name of the owner |
| 2706 | * |
| 2707 | * @param {object} [options] Optional Parameters. |
| 2708 | * |
| 2709 | * @param {boolean} [options.groupingOnly] true if the stacktrace should be |
| 2710 | * only the relevant thread / exception. Default is false |
| 2711 | * |
| 2712 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2713 | * request |
| 2714 | * |
| 2715 | * @param {function} [optionalCallback] - The optional callback. |
| 2716 | * |
| 2717 | * @returns {function|Promise} If a callback was passed as the last parameter |
| 2718 | * then it returns the callback else returns a Promise. |
| 2719 | * |
| 2720 | * {Promise} A promise is returned |
| 2721 | * |
| 2722 | * @resolve {Stacktrace} - The deserialized result object. |
| 2723 | * |
| 2724 | * @reject {Error} - The error object. |
| 2725 | * |
| 2726 | * {function} optionalCallback(err, result, request, response) |
| 2727 | * |
| 2728 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 2729 | * |
| 2730 | * {object} [result] - The deserialized result object if an error did not occur. |
| 2731 | * See {@link Stacktrace} for more information. |
| 2732 | * |
| 2733 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 2734 | * |
| 2735 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 2736 | */ |
| 2737 | getStacktrace(appName, crashGroupId, crashId, ownerName, options, optionalCallback) { |
| 2738 | let client = this.client; |
| 2739 | let self = this; |
| 2740 | if (!optionalCallback && typeof options === 'function') { |
| 2741 | optionalCallback = options; |
| 2742 | options = null; |
| 2743 | } |
| 2744 | if (!optionalCallback) { |
| 2745 | return new Promise((resolve, reject) => { |
| 2746 | self._getStacktrace(appName, crashGroupId, crashId, ownerName, options, (err, result, request, response) => { |
| 2747 | if (err) { reject(err); } |
| 2748 | else { resolve(result); } |
| 2749 | return; |
| 2750 | }); |
| 2751 | }); |
| 2752 | } else { |
| 2753 | return self._getStacktrace(appName, crashGroupId, crashId, ownerName, options, optionalCallback); |
| 2754 | } |
| 2755 | } |
| 2756 | |
| 2757 | /** |
| 2758 | * query azure search |
| 2759 | * |
| 2760 | * @param {string} appName The name of the application |
| 2761 | * |
| 2762 | * @param {object} body the query request object |
| 2763 | * |
| 2764 | * @param {string} body.search |
| 2765 | * |
| 2766 | * @param {string} crashGroupId id of a specific group |
| 2767 | * |
| 2768 | * @param {string} ownerName The name of the owner |
| 2769 | * |
| 2770 | * @param {object} [options] Optional Parameters. |
| 2771 | * |
| 2772 | * @param {string} [options.appVersion] version |
| 2773 | * |
| 2774 | * @param {date} [options.dateFrom] |
| 2775 | * |
| 2776 | * @param {date} [options.dateTo] |
| 2777 | * |
| 2778 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2779 | * request |
| 2780 | * |
| 2781 | * @returns {Promise} A promise is returned |
| 2782 | * |
| 2783 | * @resolve {HttpOperationResponse<Array>} - The deserialized result object. |
| 2784 | * |
| 2785 | * @reject {Error} - The error object. |
| 2786 | */ |
| 2787 | searchCrashesWithHttpOperationResponse(appName, body, crashGroupId, ownerName, options) { |
| 2788 | let client = this.client; |
| 2789 | let self = this; |
| 2790 | return new Promise((resolve, reject) => { |
| 2791 | self._searchCrashes(appName, body, crashGroupId, ownerName, options, (err, result, request, response) => { |
| 2792 | let httpOperationResponse = new msRest.HttpOperationResponse(request, response); |
| 2793 | httpOperationResponse.body = result; |
| 2794 | if (err) { reject(err); } |
| 2795 | else { resolve(httpOperationResponse); } |
| 2796 | return; |
| 2797 | }); |
| 2798 | }); |
| 2799 | } |
| 2800 | |
| 2801 | /** |
| 2802 | * query azure search |
| 2803 | * |
| 2804 | * @param {string} appName The name of the application |
| 2805 | * |
| 2806 | * @param {object} body the query request object |
| 2807 | * |
| 2808 | * @param {string} body.search |
| 2809 | * |
| 2810 | * @param {string} crashGroupId id of a specific group |
| 2811 | * |
| 2812 | * @param {string} ownerName The name of the owner |
| 2813 | * |
| 2814 | * @param {object} [options] Optional Parameters. |
| 2815 | * |
| 2816 | * @param {string} [options.appVersion] version |
| 2817 | * |
| 2818 | * @param {date} [options.dateFrom] |
| 2819 | * |
| 2820 | * @param {date} [options.dateTo] |
| 2821 | * |
| 2822 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2823 | * request |
| 2824 | * |
| 2825 | * @param {function} [optionalCallback] - The optional callback. |
| 2826 | * |
| 2827 | * @returns {function|Promise} If a callback was passed as the last parameter |
| 2828 | * then it returns the callback else returns a Promise. |
| 2829 | * |
| 2830 | * {Promise} A promise is returned |
| 2831 | * |
| 2832 | * @resolve {Array} - The deserialized result object. |
| 2833 | * |
| 2834 | * @reject {Error} - The error object. |
| 2835 | * |
| 2836 | * {function} optionalCallback(err, result, request, response) |
| 2837 | * |
| 2838 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 2839 | * |
| 2840 | * {array} [result] - The deserialized result object if an error did not occur. |
| 2841 | * |
| 2842 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 2843 | * |
| 2844 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 2845 | */ |
| 2846 | searchCrashes(appName, body, crashGroupId, ownerName, options, optionalCallback) { |
| 2847 | let client = this.client; |
| 2848 | let self = this; |
| 2849 | if (!optionalCallback && typeof options === 'function') { |
| 2850 | optionalCallback = options; |
| 2851 | options = null; |
| 2852 | } |
| 2853 | if (!optionalCallback) { |
| 2854 | return new Promise((resolve, reject) => { |
| 2855 | self._searchCrashes(appName, body, crashGroupId, ownerName, options, (err, result, request, response) => { |
| 2856 | if (err) { reject(err); } |
| 2857 | else { resolve(result); } |
| 2858 | return; |
| 2859 | }); |
| 2860 | }); |
| 2861 | } else { |
| 2862 | return self._searchCrashes(appName, body, crashGroupId, ownerName, options, optionalCallback); |
| 2863 | } |
| 2864 | } |
| 2865 | |
| 2866 | /** |
| 2867 | * Gets all attachments for a specific crash |
| 2868 | * |
| 2869 | * @param {string} appName The name of the application |
| 2870 | * |
| 2871 | * @param {string} crashId id of a specific crash |
| 2872 | * |
| 2873 | * @param {string} ownerName The name of the owner |
| 2874 | * |
| 2875 | * @param {object} [options] Optional Parameters. |
| 2876 | * |
| 2877 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2878 | * request |
| 2879 | * |
| 2880 | * @returns {Promise} A promise is returned |
| 2881 | * |
| 2882 | * @resolve {HttpOperationResponse<Array>} - The deserialized result object. |
| 2883 | * |
| 2884 | * @reject {Error} - The error object. |
| 2885 | */ |
| 2886 | listAttachmentsWithHttpOperationResponse(appName, crashId, ownerName, options) { |
| 2887 | let client = this.client; |
| 2888 | let self = this; |
| 2889 | return new Promise((resolve, reject) => { |
| 2890 | self._listAttachments(appName, crashId, ownerName, options, (err, result, request, response) => { |
| 2891 | let httpOperationResponse = new msRest.HttpOperationResponse(request, response); |
| 2892 | httpOperationResponse.body = result; |
| 2893 | if (err) { reject(err); } |
| 2894 | else { resolve(httpOperationResponse); } |
| 2895 | return; |
| 2896 | }); |
| 2897 | }); |
| 2898 | } |
| 2899 | |
| 2900 | /** |
| 2901 | * Gets all attachments for a specific crash |
| 2902 | * |
| 2903 | * @param {string} appName The name of the application |
| 2904 | * |
| 2905 | * @param {string} crashId id of a specific crash |
| 2906 | * |
| 2907 | * @param {string} ownerName The name of the owner |
| 2908 | * |
| 2909 | * @param {object} [options] Optional Parameters. |
| 2910 | * |
| 2911 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2912 | * request |
| 2913 | * |
| 2914 | * @param {function} [optionalCallback] - The optional callback. |
| 2915 | * |
| 2916 | * @returns {function|Promise} If a callback was passed as the last parameter |
| 2917 | * then it returns the callback else returns a Promise. |
| 2918 | * |
| 2919 | * {Promise} A promise is returned |
| 2920 | * |
| 2921 | * @resolve {Array} - The deserialized result object. |
| 2922 | * |
| 2923 | * @reject {Error} - The error object. |
| 2924 | * |
| 2925 | * {function} optionalCallback(err, result, request, response) |
| 2926 | * |
| 2927 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 2928 | * |
| 2929 | * {array} [result] - The deserialized result object if an error did not occur. |
| 2930 | * |
| 2931 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 2932 | * |
| 2933 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 2934 | */ |
| 2935 | listAttachments(appName, crashId, ownerName, options, optionalCallback) { |
| 2936 | let client = this.client; |
| 2937 | let self = this; |
| 2938 | if (!optionalCallback && typeof options === 'function') { |
| 2939 | optionalCallback = options; |
| 2940 | options = null; |
| 2941 | } |
| 2942 | if (!optionalCallback) { |
| 2943 | return new Promise((resolve, reject) => { |
| 2944 | self._listAttachments(appName, crashId, ownerName, options, (err, result, request, response) => { |
| 2945 | if (err) { reject(err); } |
| 2946 | else { resolve(result); } |
| 2947 | return; |
| 2948 | }); |
| 2949 | }); |
| 2950 | } else { |
| 2951 | return self._listAttachments(appName, crashId, ownerName, options, optionalCallback); |
| 2952 | } |
| 2953 | } |
| 2954 | |
| 2955 | /** |
| 2956 | * Gets the URI location to download crash attachment |
| 2957 | * |
| 2958 | * @param {string} appName The name of the application |
| 2959 | * |
| 2960 | * @param {string} attachmentId attachment id |
| 2961 | * |
| 2962 | * @param {string} crashId id of a specific crash |
| 2963 | * |
| 2964 | * @param {string} ownerName The name of the owner |
| 2965 | * |
| 2966 | * @param {object} [options] Optional Parameters. |
| 2967 | * |
| 2968 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 2969 | * request |
| 2970 | * |
| 2971 | * @returns {Promise} A promise is returned |
| 2972 | * |
| 2973 | * @resolve {HttpOperationResponse<CrashAttachmentLocation>} - The deserialized result object. |
| 2974 | * |
| 2975 | * @reject {Error} - The error object. |
| 2976 | */ |
| 2977 | getCrashAttachmentLocationWithHttpOperationResponse(appName, attachmentId, crashId, ownerName, options) { |
| 2978 | let client = this.client; |
| 2979 | let self = this; |
| 2980 | return new Promise((resolve, reject) => { |
| 2981 | self._getCrashAttachmentLocation(appName, attachmentId, crashId, ownerName, options, (err, result, request, response) => { |
| 2982 | let httpOperationResponse = new msRest.HttpOperationResponse(request, response); |
| 2983 | httpOperationResponse.body = result; |
| 2984 | if (err) { reject(err); } |
| 2985 | else { resolve(httpOperationResponse); } |
| 2986 | return; |
| 2987 | }); |
| 2988 | }); |
| 2989 | } |
| 2990 | |
| 2991 | /** |
| 2992 | * Gets the URI location to download crash attachment |
| 2993 | * |
| 2994 | * @param {string} appName The name of the application |
| 2995 | * |
| 2996 | * @param {string} attachmentId attachment id |
| 2997 | * |
| 2998 | * @param {string} crashId id of a specific crash |
| 2999 | * |
| 3000 | * @param {string} ownerName The name of the owner |
| 3001 | * |
| 3002 | * @param {object} [options] Optional Parameters. |
| 3003 | * |
| 3004 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 3005 | * request |
| 3006 | * |
| 3007 | * @param {function} [optionalCallback] - The optional callback. |
| 3008 | * |
| 3009 | * @returns {function|Promise} If a callback was passed as the last parameter |
| 3010 | * then it returns the callback else returns a Promise. |
| 3011 | * |
| 3012 | * {Promise} A promise is returned |
| 3013 | * |
| 3014 | * @resolve {CrashAttachmentLocation} - The deserialized result object. |
| 3015 | * |
| 3016 | * @reject {Error} - The error object. |
| 3017 | * |
| 3018 | * {function} optionalCallback(err, result, request, response) |
| 3019 | * |
| 3020 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 3021 | * |
| 3022 | * {object} [result] - The deserialized result object if an error did not occur. |
| 3023 | * See {@link CrashAttachmentLocation} for more |
| 3024 | * information. |
| 3025 | * |
| 3026 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 3027 | * |
| 3028 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 3029 | */ |
| 3030 | getCrashAttachmentLocation(appName, attachmentId, crashId, ownerName, options, optionalCallback) { |
| 3031 | let client = this.client; |
| 3032 | let self = this; |
| 3033 | if (!optionalCallback && typeof options === 'function') { |
| 3034 | optionalCallback = options; |
| 3035 | options = null; |
| 3036 | } |
| 3037 | if (!optionalCallback) { |
| 3038 | return new Promise((resolve, reject) => { |
| 3039 | self._getCrashAttachmentLocation(appName, attachmentId, crashId, ownerName, options, (err, result, request, response) => { |
| 3040 | if (err) { reject(err); } |
| 3041 | else { resolve(result); } |
| 3042 | return; |
| 3043 | }); |
| 3044 | }); |
| 3045 | } else { |
| 3046 | return self._getCrashAttachmentLocation(appName, attachmentId, crashId, ownerName, options, optionalCallback); |
| 3047 | } |
| 3048 | } |
| 3049 | |
| 3050 | /** |
| 3051 | * Gets content of the text attachment |
| 3052 | * |
| 3053 | * @param {string} appName The name of the application |
| 3054 | * |
| 3055 | * @param {string} attachmentId attachment id |
| 3056 | * |
| 3057 | * @param {string} crashId id of a specific crash |
| 3058 | * |
| 3059 | * @param {string} ownerName The name of the owner |
| 3060 | * |
| 3061 | * @param {object} [options] Optional Parameters. |
| 3062 | * |
| 3063 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 3064 | * request |
| 3065 | * |
| 3066 | * @returns {Promise} A promise is returned |
| 3067 | * |
| 3068 | * @resolve {HttpOperationResponse<String>} - The deserialized result object. |
| 3069 | * |
| 3070 | * @reject {Error} - The error object. |
| 3071 | */ |
| 3072 | getCrashTextAttachmentContentWithHttpOperationResponse(appName, attachmentId, crashId, ownerName, options) { |
| 3073 | let client = this.client; |
| 3074 | let self = this; |
| 3075 | return new Promise((resolve, reject) => { |
| 3076 | self._getCrashTextAttachmentContent(appName, attachmentId, crashId, ownerName, options, (err, result, request, response) => { |
| 3077 | let httpOperationResponse = new msRest.HttpOperationResponse(request, response); |
| 3078 | httpOperationResponse.body = result; |
| 3079 | if (err) { reject(err); } |
| 3080 | else { resolve(httpOperationResponse); } |
| 3081 | return; |
| 3082 | }); |
| 3083 | }); |
| 3084 | } |
| 3085 | |
| 3086 | /** |
| 3087 | * Gets content of the text attachment |
| 3088 | * |
| 3089 | * @param {string} appName The name of the application |
| 3090 | * |
| 3091 | * @param {string} attachmentId attachment id |
| 3092 | * |
| 3093 | * @param {string} crashId id of a specific crash |
| 3094 | * |
| 3095 | * @param {string} ownerName The name of the owner |
| 3096 | * |
| 3097 | * @param {object} [options] Optional Parameters. |
| 3098 | * |
| 3099 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 3100 | * request |
| 3101 | * |
| 3102 | * @param {function} [optionalCallback] - The optional callback. |
| 3103 | * |
| 3104 | * @returns {function|Promise} If a callback was passed as the last parameter |
| 3105 | * then it returns the callback else returns a Promise. |
| 3106 | * |
| 3107 | * {Promise} A promise is returned |
| 3108 | * |
| 3109 | * @resolve {String} - The deserialized result object. |
| 3110 | * |
| 3111 | * @reject {Error} - The error object. |
| 3112 | * |
| 3113 | * {function} optionalCallback(err, result, request, response) |
| 3114 | * |
| 3115 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 3116 | * |
| 3117 | * {string} [result] - The deserialized result object if an error did not occur. |
| 3118 | * |
| 3119 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 3120 | * |
| 3121 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 3122 | */ |
| 3123 | getCrashTextAttachmentContent(appName, attachmentId, crashId, ownerName, options, optionalCallback) { |
| 3124 | let client = this.client; |
| 3125 | let self = this; |
| 3126 | if (!optionalCallback && typeof options === 'function') { |
| 3127 | optionalCallback = options; |
| 3128 | options = null; |
| 3129 | } |
| 3130 | if (!optionalCallback) { |
| 3131 | return new Promise((resolve, reject) => { |
| 3132 | self._getCrashTextAttachmentContent(appName, attachmentId, crashId, ownerName, options, (err, result, request, response) => { |
| 3133 | if (err) { reject(err); } |
| 3134 | else { resolve(result); } |
| 3135 | return; |
| 3136 | }); |
| 3137 | }); |
| 3138 | } else { |
| 3139 | return self._getCrashTextAttachmentContent(appName, attachmentId, crashId, ownerName, options, optionalCallback); |
| 3140 | } |
| 3141 | } |
| 3142 | |
| 3143 | /** |
| 3144 | * @summary Gets whether the application has any crashes |
| 3145 | * |
| 3146 | * Gets whether the application has any crashes |
| 3147 | * |
| 3148 | * @param {string} appName The name of the application |
| 3149 | * |
| 3150 | * @param {string} ownerName The name of the owner |
| 3151 | * |
| 3152 | * @param {object} [options] Optional Parameters. |
| 3153 | * |
| 3154 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 3155 | * request |
| 3156 | * |
| 3157 | * @returns {Promise} A promise is returned |
| 3158 | * |
| 3159 | * @resolve {HttpOperationResponse<AppCrashesInfo>} - The deserialized result object. |
| 3160 | * |
| 3161 | * @reject {Error} - The error object. |
| 3162 | */ |
| 3163 | getAppCrashesInfoWithHttpOperationResponse(appName, ownerName, options) { |
| 3164 | let client = this.client; |
| 3165 | let self = this; |
| 3166 | return new Promise((resolve, reject) => { |
| 3167 | self._getAppCrashesInfo(appName, ownerName, options, (err, result, request, response) => { |
| 3168 | let httpOperationResponse = new msRest.HttpOperationResponse(request, response); |
| 3169 | httpOperationResponse.body = result; |
| 3170 | if (err) { reject(err); } |
| 3171 | else { resolve(httpOperationResponse); } |
| 3172 | return; |
| 3173 | }); |
| 3174 | }); |
| 3175 | } |
| 3176 | |
| 3177 | /** |
| 3178 | * @summary Gets whether the application has any crashes |
| 3179 | * |
| 3180 | * Gets whether the application has any crashes |
| 3181 | * |
| 3182 | * @param {string} appName The name of the application |
| 3183 | * |
| 3184 | * @param {string} ownerName The name of the owner |
| 3185 | * |
| 3186 | * @param {object} [options] Optional Parameters. |
| 3187 | * |
| 3188 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 3189 | * request |
| 3190 | * |
| 3191 | * @param {function} [optionalCallback] - The optional callback. |
| 3192 | * |
| 3193 | * @returns {function|Promise} If a callback was passed as the last parameter |
| 3194 | * then it returns the callback else returns a Promise. |
| 3195 | * |
| 3196 | * {Promise} A promise is returned |
| 3197 | * |
| 3198 | * @resolve {AppCrashesInfo} - The deserialized result object. |
| 3199 | * |
| 3200 | * @reject {Error} - The error object. |
| 3201 | * |
| 3202 | * {function} optionalCallback(err, result, request, response) |
| 3203 | * |
| 3204 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 3205 | * |
| 3206 | * {object} [result] - The deserialized result object if an error did not occur. |
| 3207 | * See {@link AppCrashesInfo} for more information. |
| 3208 | * |
| 3209 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 3210 | * |
| 3211 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 3212 | */ |
| 3213 | getAppCrashesInfo(appName, ownerName, options, optionalCallback) { |
| 3214 | let client = this.client; |
| 3215 | let self = this; |
| 3216 | if (!optionalCallback && typeof options === 'function') { |
| 3217 | optionalCallback = options; |
| 3218 | options = null; |
| 3219 | } |
| 3220 | if (!optionalCallback) { |
| 3221 | return new Promise((resolve, reject) => { |
| 3222 | self._getAppCrashesInfo(appName, ownerName, options, (err, result, request, response) => { |
| 3223 | if (err) { reject(err); } |
| 3224 | else { resolve(result); } |
| 3225 | return; |
| 3226 | }); |
| 3227 | }); |
| 3228 | } else { |
| 3229 | return self._getAppCrashesInfo(appName, ownerName, options, optionalCallback); |
| 3230 | } |
| 3231 | } |
| 3232 | |
| 3233 | /** |
| 3234 | * @summary Gets the state of HockeyApp Crash forwarding for SxS apps |
| 3235 | * |
| 3236 | * Gets the state of HockeyApp Crash forwarding for SxS apps |
| 3237 | * |
| 3238 | * @param {string} appName The name of the application |
| 3239 | * |
| 3240 | * @param {string} ownerName The name of the owner |
| 3241 | * |
| 3242 | * @param {object} [options] Optional Parameters. |
| 3243 | * |
| 3244 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 3245 | * request |
| 3246 | * |
| 3247 | * @returns {Promise} A promise is returned |
| 3248 | * |
| 3249 | * @resolve {HttpOperationResponse<HockeyAppCrashForwardingInfo>} - The deserialized result object. |
| 3250 | * |
| 3251 | * @reject {Error} - The error object. |
| 3252 | */ |
| 3253 | getHockeyAppCrashForwardingStatusWithHttpOperationResponse(appName, ownerName, options) { |
| 3254 | let client = this.client; |
| 3255 | let self = this; |
| 3256 | return new Promise((resolve, reject) => { |
| 3257 | self._getHockeyAppCrashForwardingStatus(appName, ownerName, options, (err, result, request, response) => { |
| 3258 | let httpOperationResponse = new msRest.HttpOperationResponse(request, response); |
| 3259 | httpOperationResponse.body = result; |
| 3260 | if (err) { reject(err); } |
| 3261 | else { resolve(httpOperationResponse); } |
| 3262 | return; |
| 3263 | }); |
| 3264 | }); |
| 3265 | } |
| 3266 | |
| 3267 | /** |
| 3268 | * @summary Gets the state of HockeyApp Crash forwarding for SxS apps |
| 3269 | * |
| 3270 | * Gets the state of HockeyApp Crash forwarding for SxS apps |
| 3271 | * |
| 3272 | * @param {string} appName The name of the application |
| 3273 | * |
| 3274 | * @param {string} ownerName The name of the owner |
| 3275 | * |
| 3276 | * @param {object} [options] Optional Parameters. |
| 3277 | * |
| 3278 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 3279 | * request |
| 3280 | * |
| 3281 | * @param {function} [optionalCallback] - The optional callback. |
| 3282 | * |
| 3283 | * @returns {function|Promise} If a callback was passed as the last parameter |
| 3284 | * then it returns the callback else returns a Promise. |
| 3285 | * |
| 3286 | * {Promise} A promise is returned |
| 3287 | * |
| 3288 | * @resolve {HockeyAppCrashForwardingInfo} - The deserialized result object. |
| 3289 | * |
| 3290 | * @reject {Error} - The error object. |
| 3291 | * |
| 3292 | * {function} optionalCallback(err, result, request, response) |
| 3293 | * |
| 3294 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 3295 | * |
| 3296 | * {object} [result] - The deserialized result object if an error did not occur. |
| 3297 | * See {@link HockeyAppCrashForwardingInfo} for more |
| 3298 | * information. |
| 3299 | * |
| 3300 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 3301 | * |
| 3302 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 3303 | */ |
| 3304 | getHockeyAppCrashForwardingStatus(appName, ownerName, options, optionalCallback) { |
| 3305 | let client = this.client; |
| 3306 | let self = this; |
| 3307 | if (!optionalCallback && typeof options === 'function') { |
| 3308 | optionalCallback = options; |
| 3309 | options = null; |
| 3310 | } |
| 3311 | if (!optionalCallback) { |
| 3312 | return new Promise((resolve, reject) => { |
| 3313 | self._getHockeyAppCrashForwardingStatus(appName, ownerName, options, (err, result, request, response) => { |
| 3314 | if (err) { reject(err); } |
| 3315 | else { resolve(result); } |
| 3316 | return; |
| 3317 | }); |
| 3318 | }); |
| 3319 | } else { |
| 3320 | return self._getHockeyAppCrashForwardingStatus(appName, ownerName, options, optionalCallback); |
| 3321 | } |
| 3322 | } |
| 3323 | |
| 3324 | /** |
| 3325 | * @summary Enable HockeyApp crash forwarding for SxS apps |
| 3326 | * |
| 3327 | * Enable HockeyApp crash forwarding for SxS apps |
| 3328 | * |
| 3329 | * @param {string} appName The name of the application |
| 3330 | * |
| 3331 | * @param {object} body Enable Forwarding |
| 3332 | * |
| 3333 | * @param {boolean} [body.enableForwarding] |
| 3334 | * |
| 3335 | * @param {string} ownerName The name of the owner |
| 3336 | * |
| 3337 | * @param {object} [options] Optional Parameters. |
| 3338 | * |
| 3339 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 3340 | * request |
| 3341 | * |
| 3342 | * @returns {Promise} A promise is returned |
| 3343 | * |
| 3344 | * @resolve {HttpOperationResponse<HockeyAppCrashForwardingInfo>} - The deserialized result object. |
| 3345 | * |
| 3346 | * @reject {Error} - The error object. |
| 3347 | */ |
| 3348 | updateHockeyAppCrashForwardingWithHttpOperationResponse(appName, body, ownerName, options) { |
| 3349 | let client = this.client; |
| 3350 | let self = this; |
| 3351 | return new Promise((resolve, reject) => { |
| 3352 | self._updateHockeyAppCrashForwarding(appName, body, ownerName, options, (err, result, request, response) => { |
| 3353 | let httpOperationResponse = new msRest.HttpOperationResponse(request, response); |
| 3354 | httpOperationResponse.body = result; |
| 3355 | if (err) { reject(err); } |
| 3356 | else { resolve(httpOperationResponse); } |
| 3357 | return; |
| 3358 | }); |
| 3359 | }); |
| 3360 | } |
| 3361 | |
| 3362 | /** |
| 3363 | * @summary Enable HockeyApp crash forwarding for SxS apps |
| 3364 | * |
| 3365 | * Enable HockeyApp crash forwarding for SxS apps |
| 3366 | * |
| 3367 | * @param {string} appName The name of the application |
| 3368 | * |
| 3369 | * @param {object} body Enable Forwarding |
| 3370 | * |
| 3371 | * @param {boolean} [body.enableForwarding] |
| 3372 | * |
| 3373 | * @param {string} ownerName The name of the owner |
| 3374 | * |
| 3375 | * @param {object} [options] Optional Parameters. |
| 3376 | * |
| 3377 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 3378 | * request |
| 3379 | * |
| 3380 | * @param {function} [optionalCallback] - The optional callback. |
| 3381 | * |
| 3382 | * @returns {function|Promise} If a callback was passed as the last parameter |
| 3383 | * then it returns the callback else returns a Promise. |
| 3384 | * |
| 3385 | * {Promise} A promise is returned |
| 3386 | * |
| 3387 | * @resolve {HockeyAppCrashForwardingInfo} - The deserialized result object. |
| 3388 | * |
| 3389 | * @reject {Error} - The error object. |
| 3390 | * |
| 3391 | * {function} optionalCallback(err, result, request, response) |
| 3392 | * |
| 3393 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 3394 | * |
| 3395 | * {object} [result] - The deserialized result object if an error did not occur. |
| 3396 | * See {@link HockeyAppCrashForwardingInfo} for more |
| 3397 | * information. |
| 3398 | * |
| 3399 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 3400 | * |
| 3401 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 3402 | */ |
| 3403 | updateHockeyAppCrashForwarding(appName, body, ownerName, options, optionalCallback) { |
| 3404 | let client = this.client; |
| 3405 | let self = this; |
| 3406 | if (!optionalCallback && typeof options === 'function') { |
| 3407 | optionalCallback = options; |
| 3408 | options = null; |
| 3409 | } |
| 3410 | if (!optionalCallback) { |
| 3411 | return new Promise((resolve, reject) => { |
| 3412 | self._updateHockeyAppCrashForwarding(appName, body, ownerName, options, (err, result, request, response) => { |
| 3413 | if (err) { reject(err); } |
| 3414 | else { resolve(result); } |
| 3415 | return; |
| 3416 | }); |
| 3417 | }); |
| 3418 | } else { |
| 3419 | return self._updateHockeyAppCrashForwarding(appName, body, ownerName, options, optionalCallback); |
| 3420 | } |
| 3421 | } |
| 3422 | |
| 3423 | /** |
| 3424 | * @summary Gets a list of application versions |
| 3425 | * |
| 3426 | * Gets a list of application versions |
| 3427 | * |
| 3428 | * @param {string} appName The name of the application |
| 3429 | * |
| 3430 | * @param {string} ownerName The name of the owner |
| 3431 | * |
| 3432 | * @param {object} [options] Optional Parameters. |
| 3433 | * |
| 3434 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 3435 | * request |
| 3436 | * |
| 3437 | * @returns {Promise} A promise is returned |
| 3438 | * |
| 3439 | * @resolve {HttpOperationResponse<Array>} - The deserialized result object. |
| 3440 | * |
| 3441 | * @reject {Error} - The error object. |
| 3442 | */ |
| 3443 | getAppVersionsWithHttpOperationResponse(appName, ownerName, options) { |
| 3444 | let client = this.client; |
| 3445 | let self = this; |
| 3446 | return new Promise((resolve, reject) => { |
| 3447 | self._getAppVersions(appName, ownerName, options, (err, result, request, response) => { |
| 3448 | let httpOperationResponse = new msRest.HttpOperationResponse(request, response); |
| 3449 | httpOperationResponse.body = result; |
| 3450 | if (err) { reject(err); } |
| 3451 | else { resolve(httpOperationResponse); } |
| 3452 | return; |
| 3453 | }); |
| 3454 | }); |
| 3455 | } |
| 3456 | |
| 3457 | /** |
| 3458 | * @summary Gets a list of application versions |
| 3459 | * |
| 3460 | * Gets a list of application versions |
| 3461 | * |
| 3462 | * @param {string} appName The name of the application |
| 3463 | * |
| 3464 | * @param {string} ownerName The name of the owner |
| 3465 | * |
| 3466 | * @param {object} [options] Optional Parameters. |
| 3467 | * |
| 3468 | * @param {object} [options.customHeaders] Headers that will be added to the |
| 3469 | * request |
| 3470 | * |
| 3471 | * @param {function} [optionalCallback] - The optional callback. |
| 3472 | * |
| 3473 | * @returns {function|Promise} If a callback was passed as the last parameter |
| 3474 | * then it returns the callback else returns a Promise. |
| 3475 | * |
| 3476 | * {Promise} A promise is returned |
| 3477 | * |
| 3478 | * @resolve {Array} - The deserialized result object. |
| 3479 | * |
| 3480 | * @reject {Error} - The error object. |
| 3481 | * |
| 3482 | * {function} optionalCallback(err, result, request, response) |
| 3483 | * |
| 3484 | * {Error} err - The Error object if an error occurred, null otherwise. |
| 3485 | * |
| 3486 | * {array} [result] - The deserialized result object if an error did not occur. |
| 3487 | * |
| 3488 | * {object} [request] - The HTTP Request object if an error did not occur. |
| 3489 | * |
| 3490 | * {stream} [response] - The HTTP Response stream if an error did not occur. |
| 3491 | */ |
| 3492 | getAppVersions(appName, ownerName, options, optionalCallback) { |
| 3493 | let client = this.client; |
| 3494 | let self = this; |
| 3495 | if (!optionalCallback && typeof options === 'function') { |
| 3496 | optionalCallback = options; |
| 3497 | options = null; |
| 3498 | } |
| 3499 | if (!optionalCallback) { |
| 3500 | return new Promise((resolve, reject) => { |
| 3501 | self._getAppVersions(appName, ownerName, options, (err, result, request, response) => { |
| 3502 | if (err) { reject(err); } |
| 3503 | else { resolve(result); } |
| 3504 | return; |
| 3505 | }); |
| 3506 | }); |
| 3507 | } else { |
| 3508 | return self._getAppVersions(appName, ownerName, options, optionalCallback); |
| 3509 | } |
| 3510 | } |
| 3511 | |
| 3512 | } |
| 3513 | |
| 3514 | module.exports = Crashes; |
| 3515 | |