/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is * regenerated. */ import * as msRest from "@azure/ms-rest-js"; import * as Models from "./models"; import * as Mappers from "./models/mappers"; import * as Parameters from "./models/parameters"; import { PredictionAPIClientContext } from "./predictionAPIClientContext"; class PredictionAPIClient extends PredictionAPIClientContext { /** * Initializes a new instance of the PredictionAPIClient class. * @param endpoint Supported Cognitive Services endpoints. * @param credentials Subscription credentials which uniquely identify client subscription. * @param [options] The parameter options */ constructor(credentials: msRest.ServiceClientCredentials, endpoint: string, options?: msRest.ServiceClientOptions) { super(credentials, endpoint, options); } /** * @summary Classify an image and saves the result. * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports * images up to 4MB. * @param [options] The optional parameters * @returns Promise */ classifyImage(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, options?: Models.PredictionAPIClientClassifyImageOptionalParams): Promise; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports * images up to 4MB. * @param callback The callback */ classifyImage(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports * images up to 4MB. * @param options The optional parameters * @param callback The callback */ classifyImage(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, options: Models.PredictionAPIClientClassifyImageOptionalParams, callback: msRest.ServiceCallback): void; classifyImage(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, options?: Models.PredictionAPIClientClassifyImageOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { projectId, publishedName, imageData, options }, classifyImageOperationSpec, callback) as Promise; } /** * @summary Classify an image without saving the result. * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports * images up to 4MB. * @param [options] The optional parameters * @returns Promise */ classifyImageWithNoStore(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, options?: Models.PredictionAPIClientClassifyImageWithNoStoreOptionalParams): Promise; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports * images up to 4MB. * @param callback The callback */ classifyImageWithNoStore(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports * images up to 4MB. * @param options The optional parameters * @param callback The callback */ classifyImageWithNoStore(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, options: Models.PredictionAPIClientClassifyImageWithNoStoreOptionalParams, callback: msRest.ServiceCallback): void; classifyImageWithNoStore(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, options?: Models.PredictionAPIClientClassifyImageWithNoStoreOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { projectId, publishedName, imageData, options }, classifyImageWithNoStoreOperationSpec, callback) as Promise; } /** * @summary Classify an image url and saves the result. * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageUrl An ImageUrl that contains the url of the image to be evaluated. * @param [options] The optional parameters * @returns Promise */ classifyImageUrl(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, options?: Models.PredictionAPIClientClassifyImageUrlOptionalParams): Promise; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageUrl An ImageUrl that contains the url of the image to be evaluated. * @param callback The callback */ classifyImageUrl(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, callback: msRest.ServiceCallback): void; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageUrl An ImageUrl that contains the url of the image to be evaluated. * @param options The optional parameters * @param callback The callback */ classifyImageUrl(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, options: Models.PredictionAPIClientClassifyImageUrlOptionalParams, callback: msRest.ServiceCallback): void; classifyImageUrl(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, options?: Models.PredictionAPIClientClassifyImageUrlOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { projectId, publishedName, imageUrl, options }, classifyImageUrlOperationSpec, callback) as Promise; } /** * @summary Classify an image url without saving the result. * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageUrl An {Iris.Web.Api.Models.ImageUrl} that contains the url of the image to be * evaluated. * @param [options] The optional parameters * @returns Promise */ classifyImageUrlWithNoStore(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, options?: Models.PredictionAPIClientClassifyImageUrlWithNoStoreOptionalParams): Promise; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageUrl An {Iris.Web.Api.Models.ImageUrl} that contains the url of the image to be * evaluated. * @param callback The callback */ classifyImageUrlWithNoStore(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, callback: msRest.ServiceCallback): void; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageUrl An {Iris.Web.Api.Models.ImageUrl} that contains the url of the image to be * evaluated. * @param options The optional parameters * @param callback The callback */ classifyImageUrlWithNoStore(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, options: Models.PredictionAPIClientClassifyImageUrlWithNoStoreOptionalParams, callback: msRest.ServiceCallback): void; classifyImageUrlWithNoStore(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, options?: Models.PredictionAPIClientClassifyImageUrlWithNoStoreOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { projectId, publishedName, imageUrl, options }, classifyImageUrlWithNoStoreOperationSpec, callback) as Promise; } /** * @summary Detect objects in an image and saves the result. * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports * images up to 4MB. * @param [options] The optional parameters * @returns Promise */ detectImage(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, options?: Models.PredictionAPIClientDetectImageOptionalParams): Promise; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports * images up to 4MB. * @param callback The callback */ detectImage(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports * images up to 4MB. * @param options The optional parameters * @param callback The callback */ detectImage(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, options: Models.PredictionAPIClientDetectImageOptionalParams, callback: msRest.ServiceCallback): void; detectImage(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, options?: Models.PredictionAPIClientDetectImageOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { projectId, publishedName, imageData, options }, detectImageOperationSpec, callback) as Promise; } /** * @summary Detect objects in an image without saving the result. * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports * images up to 4MB. * @param [options] The optional parameters * @returns Promise */ detectImageWithNoStore(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, options?: Models.PredictionAPIClientDetectImageWithNoStoreOptionalParams): Promise; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports * images up to 4MB. * @param callback The callback */ detectImageWithNoStore(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, callback: msRest.ServiceCallback): void; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports * images up to 4MB. * @param options The optional parameters * @param callback The callback */ detectImageWithNoStore(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, options: Models.PredictionAPIClientDetectImageWithNoStoreOptionalParams, callback: msRest.ServiceCallback): void; detectImageWithNoStore(projectId: string, publishedName: string, imageData: msRest.HttpRequestBody, options?: Models.PredictionAPIClientDetectImageWithNoStoreOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { projectId, publishedName, imageData, options }, detectImageWithNoStoreOperationSpec, callback) as Promise; } /** * @summary Detect objects in an image url and saves the result. * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageUrl An ImageUrl that contains the url of the image to be evaluated. * @param [options] The optional parameters * @returns Promise */ detectImageUrl(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, options?: Models.PredictionAPIClientDetectImageUrlOptionalParams): Promise; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageUrl An ImageUrl that contains the url of the image to be evaluated. * @param callback The callback */ detectImageUrl(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, callback: msRest.ServiceCallback): void; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageUrl An ImageUrl that contains the url of the image to be evaluated. * @param options The optional parameters * @param callback The callback */ detectImageUrl(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, options: Models.PredictionAPIClientDetectImageUrlOptionalParams, callback: msRest.ServiceCallback): void; detectImageUrl(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, options?: Models.PredictionAPIClientDetectImageUrlOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { projectId, publishedName, imageUrl, options }, detectImageUrlOperationSpec, callback) as Promise; } /** * @summary Detect objects in an image url without saving the result. * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageUrl An {Iris.Web.Api.Models.ImageUrl} that contains the url of the image to be * evaluated. * @param [options] The optional parameters * @returns Promise */ detectImageUrlWithNoStore(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, options?: Models.PredictionAPIClientDetectImageUrlWithNoStoreOptionalParams): Promise; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageUrl An {Iris.Web.Api.Models.ImageUrl} that contains the url of the image to be * evaluated. * @param callback The callback */ detectImageUrlWithNoStore(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, callback: msRest.ServiceCallback): void; /** * @param projectId The project id. * @param publishedName Specifies the name of the model to evaluate against. * @param imageUrl An {Iris.Web.Api.Models.ImageUrl} that contains the url of the image to be * evaluated. * @param options The optional parameters * @param callback The callback */ detectImageUrlWithNoStore(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, options: Models.PredictionAPIClientDetectImageUrlWithNoStoreOptionalParams, callback: msRest.ServiceCallback): void; detectImageUrlWithNoStore(projectId: string, publishedName: string, imageUrl: Models.ImageUrl, options?: Models.PredictionAPIClientDetectImageUrlWithNoStoreOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.sendOperationRequest( { projectId, publishedName, imageUrl, options }, detectImageUrlWithNoStoreOperationSpec, callback) as Promise; } } // Operation Specifications const serializer = new msRest.Serializer(Mappers); const classifyImageOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "{projectId}/classify/iterations/{publishedName}/image", urlParameters: [ Parameters.endpoint, Parameters.projectId, Parameters.publishedName ], queryParameters: [ Parameters.application ], formDataParameters: [ Parameters.imageData ], contentType: "multipart/form-data", responses: { 200: { bodyMapper: Mappers.ImagePrediction }, default: { bodyMapper: Mappers.CustomVisionError } }, serializer }; const classifyImageWithNoStoreOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "{projectId}/classify/iterations/{publishedName}/image/nostore", urlParameters: [ Parameters.endpoint, Parameters.projectId, Parameters.publishedName ], queryParameters: [ Parameters.application ], formDataParameters: [ Parameters.imageData ], contentType: "multipart/form-data", responses: { 200: { bodyMapper: Mappers.ImagePrediction }, default: { bodyMapper: Mappers.CustomVisionError } }, serializer }; const classifyImageUrlOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "{projectId}/classify/iterations/{publishedName}/url", urlParameters: [ Parameters.endpoint, Parameters.projectId, Parameters.publishedName ], queryParameters: [ Parameters.application ], requestBody: { parameterPath: "imageUrl", mapper: { ...Mappers.ImageUrl, required: true } }, contentType: "application/json; charset=utf-8", responses: { 200: { bodyMapper: Mappers.ImagePrediction }, default: { bodyMapper: Mappers.CustomVisionError } }, serializer }; const classifyImageUrlWithNoStoreOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "{projectId}/classify/iterations/{publishedName}/url/nostore", urlParameters: [ Parameters.endpoint, Parameters.projectId, Parameters.publishedName ], queryParameters: [ Parameters.application ], requestBody: { parameterPath: "imageUrl", mapper: { ...Mappers.ImageUrl, required: true } }, contentType: "application/json; charset=utf-8", responses: { 200: { bodyMapper: Mappers.ImagePrediction }, default: { bodyMapper: Mappers.CustomVisionError } }, serializer }; const detectImageOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "{projectId}/detect/iterations/{publishedName}/image", urlParameters: [ Parameters.endpoint, Parameters.projectId, Parameters.publishedName ], queryParameters: [ Parameters.application ], formDataParameters: [ Parameters.imageData ], contentType: "multipart/form-data", responses: { 200: { bodyMapper: Mappers.ImagePrediction }, default: { bodyMapper: Mappers.CustomVisionError } }, serializer }; const detectImageWithNoStoreOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "{projectId}/detect/iterations/{publishedName}/image/nostore", urlParameters: [ Parameters.endpoint, Parameters.projectId, Parameters.publishedName ], queryParameters: [ Parameters.application ], formDataParameters: [ Parameters.imageData ], contentType: "multipart/form-data", responses: { 200: { bodyMapper: Mappers.ImagePrediction }, default: { bodyMapper: Mappers.CustomVisionError } }, serializer }; const detectImageUrlOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "{projectId}/detect/iterations/{publishedName}/url", urlParameters: [ Parameters.endpoint, Parameters.projectId, Parameters.publishedName ], queryParameters: [ Parameters.application ], requestBody: { parameterPath: "imageUrl", mapper: { ...Mappers.ImageUrl, required: true } }, contentType: "application/json; charset=utf-8", responses: { 200: { bodyMapper: Mappers.ImagePrediction }, default: { bodyMapper: Mappers.CustomVisionError } }, serializer }; const detectImageUrlWithNoStoreOperationSpec: msRest.OperationSpec = { httpMethod: "POST", path: "{projectId}/detect/iterations/{publishedName}/url/nostore", urlParameters: [ Parameters.endpoint, Parameters.projectId, Parameters.publishedName ], queryParameters: [ Parameters.application ], requestBody: { parameterPath: "imageUrl", mapper: { ...Mappers.ImageUrl, required: true } }, contentType: "application/json; charset=utf-8", responses: { 200: { bodyMapper: Mappers.ImagePrediction }, default: { bodyMapper: Mappers.CustomVisionError } }, serializer }; export { PredictionAPIClient, PredictionAPIClientContext, Models as PredictionAPIModels, Mappers as PredictionAPIMappers };