Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR cognitiveservices/data-plane/TranslatorText] Translator Text API V3 #2985

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/**
* 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.
*/

package com.microsoft.azure.cognitiveservices.translatortext;

import com.microsoft.azure.AzureClient;
import com.microsoft.rest.RestClient;

/**
* The interface for TranslatorTextClient class.
*/
public interface TranslatorTextClient {
/**
* Gets the REST client.
*
* @return the {@link RestClient} object.
*/
RestClient restClient();

/**
* Gets the {@link AzureClient} used for long running operations.
* @return the azure client;
*/
AzureClient getAzureClient();

/**
* Gets the User-Agent header for the client.
*
* @return the user agent string.
*/
String userAgent();

/**
* Gets Supported Cognitive Services endpoints.
*
* @return the endpoint value.
*/
String endpoint();

/**
* Sets Supported Cognitive Services endpoints.
*
* @param endpoint the endpoint value.
* @return the service client itself
*/
TranslatorTextClient withEndpoint(String endpoint);

/**
* Gets Version of the API requested by the client. Value must be **3.0**..
*
* @return the apiVersion value.
*/
String apiVersion();

/**
* Gets The preferred language for the response..
*
* @return the acceptLanguage value.
*/
String acceptLanguage();

/**
* Sets The preferred language for the response..
*
* @param acceptLanguage the acceptLanguage value.
* @return the service client itself
*/
TranslatorTextClient withAcceptLanguage(String acceptLanguage);

/**
* Gets The retry timeout in seconds for Long Running Operations. Default value is 30..
*
* @return the longRunningOperationRetryTimeout value.
*/
int longRunningOperationRetryTimeout();

/**
* Sets The retry timeout in seconds for Long Running Operations. Default value is 30..
*
* @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value.
* @return the service client itself
*/
TranslatorTextClient withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout);

/**
* Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true..
*
* @return the generateClientRequestId value.
*/
boolean generateClientRequestId();

/**
* Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true..
*
* @param generateClientRequestId the generateClientRequestId value.
* @return the service client itself
*/
TranslatorTextClient withGenerateClientRequestId(boolean generateClientRequestId);

/**
* Gets the Translators object to access its operations.
* @return the Translators object.
*/
Translators translators();

}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
/**
* 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.
*/

package com.microsoft.azure.cognitiveservices.translatortext.implementation;

import com.microsoft.azure.AzureClient;
import com.microsoft.azure.AzureServiceClient;
import com.microsoft.azure.cognitiveservices.translatortext.Translators;
import com.microsoft.azure.cognitiveservices.translatortext.TranslatorTextClient;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import com.microsoft.rest.RestClient;

/**
* Initializes a new instance of the TranslatorTextClientImpl class.
*/
public class TranslatorTextClientImpl extends AzureServiceClient implements TranslatorTextClient {
/** the {@link AzureClient} used for long running operations. */
private AzureClient azureClient;

/**
* Gets the {@link AzureClient} used for long running operations.
* @return the azure client;
*/
public AzureClient getAzureClient() {
return this.azureClient;
}

/** Supported Cognitive Services endpoints. */
private String endpoint;

/**
* Gets Supported Cognitive Services endpoints.
*
* @return the endpoint value.
*/
public String endpoint() {
return this.endpoint;
}

/**
* Sets Supported Cognitive Services endpoints.
*
* @param endpoint the endpoint value.
* @return the service client itself
*/
public TranslatorTextClientImpl withEndpoint(String endpoint) {
this.endpoint = endpoint;
return this;
}

/** Version of the API requested by the client. Value must be **3.0**. */
private String apiVersion;

/**
* Gets Version of the API requested by the client. Value must be **3.0**.
*
* @return the apiVersion value.
*/
public String apiVersion() {
return this.apiVersion;
}

/** The preferred language for the response. */
private String acceptLanguage;

/**
* Gets The preferred language for the response.
*
* @return the acceptLanguage value.
*/
public String acceptLanguage() {
return this.acceptLanguage;
}

/**
* Sets The preferred language for the response.
*
* @param acceptLanguage the acceptLanguage value.
* @return the service client itself
*/
public TranslatorTextClientImpl withAcceptLanguage(String acceptLanguage) {
this.acceptLanguage = acceptLanguage;
return this;
}

/** The retry timeout in seconds for Long Running Operations. Default value is 30. */
private int longRunningOperationRetryTimeout;

/**
* Gets The retry timeout in seconds for Long Running Operations. Default value is 30.
*
* @return the longRunningOperationRetryTimeout value.
*/
public int longRunningOperationRetryTimeout() {
return this.longRunningOperationRetryTimeout;
}

/**
* Sets The retry timeout in seconds for Long Running Operations. Default value is 30.
*
* @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value.
* @return the service client itself
*/
public TranslatorTextClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) {
this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout;
return this;
}

/** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */
private boolean generateClientRequestId;

/**
* Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*
* @return the generateClientRequestId value.
*/
public boolean generateClientRequestId() {
return this.generateClientRequestId;
}

/**
* Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*
* @param generateClientRequestId the generateClientRequestId value.
* @return the service client itself
*/
public TranslatorTextClientImpl withGenerateClientRequestId(boolean generateClientRequestId) {
this.generateClientRequestId = generateClientRequestId;
return this;
}

/**
* The Translators object to access its operations.
*/
private Translators translators;

/**
* Gets the Translators object to access its operations.
* @return the Translators object.
*/
public Translators translators() {
return this.translators;
}

/**
* Initializes an instance of TranslatorTextClient client.
*
* @param credentials the management credentials for Azure
*/
public TranslatorTextClientImpl(ServiceClientCredentials credentials) {
this("https://{Endpoint}", credentials);
}

/**
* Initializes an instance of TranslatorTextClient client.
*
* @param baseUrl the base URL of the host
* @param credentials the management credentials for Azure
*/
private TranslatorTextClientImpl(String baseUrl, ServiceClientCredentials credentials) {
super(baseUrl, credentials);
initialize();
}

/**
* Initializes an instance of TranslatorTextClient client.
*
* @param restClient the REST client to connect to Azure.
*/
public TranslatorTextClientImpl(RestClient restClient) {
super(restClient);
initialize();
}

protected void initialize() {
this.apiVersion = "3.0";
this.acceptLanguage = "en-US";
this.longRunningOperationRetryTimeout = 30;
this.generateClientRequestId = true;
this.translators = new TranslatorsImpl(restClient().retrofit(), this);
this.azureClient = new AzureClient(this);
}

/**
* Gets the User-Agent header for the client.
*
* @return the user agent string.
*/
@Override
public String userAgent() {
return String.format("%s (%s, %s)", super.userAgent(), "TranslatorTextClient", "3.0");
}
}
Loading