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/CustomWebSearch #2585

Closed
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

Large diffs are not rendered by default.

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

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

/**
* The interface for CustomSearchClient class.
*/
public interface CustomSearchClient {
/**
* 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 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
*/
CustomSearchClient 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
*/
CustomSearchClient 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
*/
CustomSearchClient withGenerateClientRequestId(boolean generateClientRequestId);

/**
* Gets the CustomInstances object to access its operations.
* @return the CustomInstances object.
*/
CustomInstances customInstances();

}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
/**
* 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.search.customsearch.implementation;

import com.microsoft.azure.AzureClient;
import com.microsoft.azure.AzureServiceClient;
import com.microsoft.azure.cognitiveservices.search.customsearch.CustomInstances;
import com.microsoft.azure.cognitiveservices.search.customsearch.CustomSearchClient;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import com.microsoft.rest.RestClient;

/**
* Initializes a new instance of the CustomSearchClientImpl class.
*/
public class CustomSearchClientImpl extends AzureServiceClient implements CustomSearchClient {
/** 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;
}

/** 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 CustomSearchClientImpl 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 CustomSearchClientImpl 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 CustomSearchClientImpl withGenerateClientRequestId(boolean generateClientRequestId) {
this.generateClientRequestId = generateClientRequestId;
return this;
}

/**
* The CustomInstances object to access its operations.
*/
private CustomInstances customInstances;

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

/**
* Initializes an instance of CustomSearchClient client.
*
* @param credentials the management credentials for Azure
*/
public CustomSearchClientImpl(ServiceClientCredentials credentials) {
this("https://api.cognitive.microsoft.com/bingcustomsearch/v7.0", credentials);
}

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

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

protected void initialize() {
this.acceptLanguage = "en-US";
this.longRunningOperationRetryTimeout = 30;
this.generateClientRequestId = true;
this.customInstances = new CustomInstancesImpl(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(), "CustomSearchClient", "1.0");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Code generated by Microsoft (R) AutoRest Code Generator.

/**
* This package contains the implementation classes for BingCustomSearchAPI.
* This package contains the implementation classes for CustomSearchClient.
* The Bing Custom Search API lets you send a search query to Bing and get back search results customized to meet your custom search definition.
*/
package com.microsoft.azure.cognitiveservices.search.customsearch.implementation;
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* The Answer model.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "_type", defaultImpl = Answer.class)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "_type")
@JsonTypeName("Answer")
@JsonSubTypes({
@JsonSubTypes.Type(name = "SearchResultsAnswer", value = SearchResultsAnswer.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* The CreativeWork model.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "_type", defaultImpl = CreativeWork.class)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "_type")
@JsonTypeName("CreativeWork")
@JsonSubTypes({
@JsonSubTypes.Type(name = "WebPage", value = WebPage.class)
Expand All @@ -42,7 +42,7 @@ public class CreativeWork extends Thing {
private String text;

/**
* Get the thumbnailUrl value.
* Get the URL to a thumbnail of the item.
*
* @return the thumbnailUrl value
*/
Expand All @@ -51,7 +51,7 @@ public String thumbnailUrl() {
}

/**
* Get the provider value.
* Get the source of the creative work.
*
* @return the provider value
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class Error {
private String value;

/**
* Get the code value.
* Get the error code that identifies the category of error. Possible values include: 'None', 'ServerError', 'InvalidRequest', 'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization'.
*
* @return the code value
*/
Expand All @@ -66,7 +66,7 @@ public ErrorCode code() {
}

/**
* Set the code value.
* Set the error code that identifies the category of error. Possible values include: 'None', 'ServerError', 'InvalidRequest', 'RateLimitExceeded', 'InvalidAuthorization', 'InsufficientAuthorization'.
*
* @param code the code value to set
* @return the Error object itself.
Expand All @@ -77,7 +77,7 @@ public Error withCode(ErrorCode code) {
}

/**
* Get the subCode value.
* Get the error code that further helps to identify the error. Possible values include: 'UnexpectedError', 'ResourceError', 'NotImplemented', 'ParameterMissing', 'ParameterInvalidValue', 'HttpNotAllowed', 'Blocked', 'AuthorizationMissing', 'AuthorizationRedundancy', 'AuthorizationDisabled', 'AuthorizationExpired'.
*
* @return the subCode value
*/
Expand All @@ -86,7 +86,7 @@ public ErrorSubCode subCode() {
}

/**
* Get the message value.
* Get a description of the error.
*
* @return the message value
*/
Expand All @@ -95,7 +95,7 @@ public String message() {
}

/**
* Set the message value.
* Set a description of the error.
*
* @param message the message value to set
* @return the Error object itself.
Expand All @@ -106,7 +106,7 @@ public Error withMessage(String message) {
}

/**
* Get the moreDetails value.
* Get a description that provides additional information about the error.
*
* @return the moreDetails value
*/
Expand All @@ -115,7 +115,7 @@ public String moreDetails() {
}

/**
* Get the parameter value.
* Get the parameter in the request that caused the error.
*
* @return the parameter value
*/
Expand All @@ -124,7 +124,7 @@ public String parameter() {
}

/**
* Get the value value.
* Get the parameter's value in the request that was not valid.
*
* @return the value value
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* The top-level response that represents a failed request.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "_type", defaultImpl = ErrorResponse.class)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "_type")
@JsonTypeName("ErrorResponse")
public class ErrorResponse extends Response {
/**
Expand All @@ -26,7 +26,7 @@ public class ErrorResponse extends Response {
private List<Error> errors;

/**
* Get the errors value.
* Get a list of errors that describe the reasons why the request failed.
*
* @return the errors value
*/
Expand All @@ -35,7 +35,7 @@ public List<Error> errors() {
}

/**
* Set the errors value.
* Set a list of errors that describe the reasons why the request failed.
*
* @param errors the errors value to set
* @return the ErrorResponse object itself.
Expand Down
Loading