Skip to content
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

Large diffs are not rendered by default.

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

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

/**
* The interface for NewsSearchClient class.
*/
public interface NewsSearchClient {
/**
* 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 (protocol and hostname, for example: "https://westus.api.cognitive.microsoft.com", "https://api.cognitive.microsoft.com")..
*
* @return the endpoint value.
*/
String endpoint();

/**
* Sets Supported Cognitive Services endpoints (protocol and hostname, for example: "https://westus.api.cognitive.microsoft.com", "https://api.cognitive.microsoft.com")..
*
* @param endpoint the endpoint value.
* @return the service client itself
*/
NewsSearchClient withEndpoint(String endpoint);

/**
* 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
*/
NewsSearchClient 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
*/
NewsSearchClient 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
*/
NewsSearchClient withGenerateClientRequestId(boolean generateClientRequestId);

/**
* Gets the News object to access its operations.
* @return the News object.
*/
News news();

}

Large diffs are not rendered by default.

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

import com.microsoft.azure.AzureClient;
import com.microsoft.azure.AzureServiceClient;
import com.microsoft.azure.cognitiveservices.search.newssearch.News;
import com.microsoft.azure.cognitiveservices.search.newssearch.NewsSearchClient;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import com.microsoft.rest.RestClient;

/**
* Initializes a new instance of the NewsSearchClientImpl class.
*/
public class NewsSearchClientImpl extends AzureServiceClient implements NewsSearchClient {
/** 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 (protocol and hostname, for example: "https://westus.api.cognitive.microsoft.com", "https://api.cognitive.microsoft.com"). */
private String endpoint;

/**
* Gets Supported Cognitive Services endpoints (protocol and hostname, for example: "https://westus.api.cognitive.microsoft.com", "https://api.cognitive.microsoft.com").
*
* @return the endpoint value.
*/
public String endpoint() {
return this.endpoint;
}

/**
* Sets Supported Cognitive Services endpoints (protocol and hostname, for example: "https://westus.api.cognitive.microsoft.com", "https://api.cognitive.microsoft.com").
*
* @param endpoint the endpoint value.
* @return the service client itself
*/
public NewsSearchClientImpl withEndpoint(String endpoint) {
this.endpoint = endpoint;
return this;
}

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

/**
* The News object to access its operations.
*/
private News news;

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

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

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

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

protected void initialize() {
this.endpoint = "https://api.cognitive.microsoft.com";
this.acceptLanguage = "en-US";
this.longRunningOperationRetryTimeout = 30;
this.generateClientRequestId = true;
this.news = new NewsImpl(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(), "NewsSearchClient", "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 BingNewsSearchAPI.
* This package contains the implementation classes for NewsSearchClient.
* The News Search API lets you send a search query to Bing and get back a list of news that are relevant to the search query. This section provides technical details about the query parameters and headers that you use to request news and the JSON response objects that contain them. For examples that show how to make requests, see [Searching the web for news](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-news-search/search-the-web).
*/
package com.microsoft.azure.cognitiveservices.search.newssearch.implementation;
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Defines an answer.
*/
@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 @@ -16,7 +16,7 @@
/**
* The Article model.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "_type", defaultImpl = Article.class)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "_type")
@JsonTypeName("Article")
@JsonSubTypes({
@JsonSubTypes.Type(name = "NewsArticle", value = NewsArticle.class)
Expand All @@ -29,7 +29,7 @@ public class Article extends CreativeWork {
private Integer wordCount;

/**
* Get the wordCount value.
* Get the number of words in the text of the Article.
*
* @return the wordCount value
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* The most generic kind of creative work, including books, movies,
* photographs, software programs, etc.
*/
@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 = "Article", value = Article.class),
Expand Down Expand Up @@ -50,7 +50,7 @@ public class CreativeWork extends Thing {
private VideoObject video;

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

/**
* Get the provider value.
* Get the source of the creative work.
*
* @return the provider value
*/
Expand All @@ -68,7 +68,7 @@ public List<Thing> provider() {
}

/**
* Get the datePublished value.
* Get the date on which the CreativeWork was published.
*
* @return the datePublished value
*/
Expand All @@ -77,7 +77,7 @@ public String datePublished() {
}

/**
* Get the video value.
* Get a video of the item.
*
* @return the video value
*/
Expand Down
Loading