All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.api.services.translate.Translate Maven / Gradle / Ivy

/*
 * Copyright 2010 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This file was generated.
 *  with google-apis-code-generator 1.4.0 (build: 2013-06-19 16:59:56 UTC)
 *  on 2013-06-19 at 17:11:02 UTC 
 */

package com.google.api.services.translate;

import com.google.api.client.googleapis.GoogleUtils;
import com.google.api.client.googleapis.services.AbstractGoogleClientRequest;
import com.google.api.client.googleapis.services.GoogleClientRequestInitializer;
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.JsonObjectParser;
import com.google.common.base.Preconditions;

/**
 * Service definition for Translate (v2).
 *
 * 

* Lets you translate text from one language to another *

* *

* For more information about this service, see the * API Documentation *

* *

* This service uses {@link TranslateRequestInitializer} to initialize global parameters via its * {@link Builder}. *

* *

* Upgrade warning: this class now extends {@link AbstractGoogleJsonClient}, whereas in prior * version 1.8 it extended {@link com.google.api.client.googleapis.services.GoogleClient}. *

* * @since 1.3 * @author Google, Inc. */ @SuppressWarnings("javadoc") public class Translate extends AbstractGoogleJsonClient { // Note: Leave this static initializer at the top of the file. static { Preconditions.checkState(GoogleUtils.VERSION.equals("1.13.2-beta"), "You are currently running with version %s of google-api-client. " + "You need version 1.13.2-beta of google-api-client to run version " + "1.13.2-beta of the Translate API library.", GoogleUtils.VERSION); } /** * The default encoded root URL of the service. This is determined when the library is generated * and normally should not be changed. * * @since 1.7 */ public static final String DEFAULT_ROOT_URL = "https://www.googleapis.com/"; /** * The default encoded service path of the service. This is determined when the library is * generated and normally should not be changed. * * @since 1.7 */ public static final String DEFAULT_SERVICE_PATH = "language/translate/"; /** * The default encoded base URL of the service. This is determined when the library is generated * and normally should not be changed. * @deprecated (scheduled to be removed in 1.13) */ @Deprecated public static final String DEFAULT_BASE_URL = DEFAULT_ROOT_URL + DEFAULT_SERVICE_PATH; /** * Constructor. * *

* Use {@link Builder} if you need to specify any of the optional parameters. *

* * @param transport HTTP transport * @param jsonFactory JSON factory * @param httpRequestInitializer HTTP request initializer or {@code null} for none * @since 1.7 */ public Translate(HttpTransport transport, JsonFactory jsonFactory, HttpRequestInitializer httpRequestInitializer) { super(transport, jsonFactory, DEFAULT_ROOT_URL, DEFAULT_SERVICE_PATH, httpRequestInitializer, true); } /** * @param transport HTTP transport * @param httpRequestInitializer HTTP request initializer or {@code null} for none * @param rootUrl root URL of the service * @param servicePath service path * @param jsonObjectParser JSON object parser * @param googleClientRequestInitializer Google request initializer or {@code null} for none * @param applicationName application name to be sent in the User-Agent header of requests or * {@code null} for none * @param suppressPatternChecks whether discovery pattern checks should be suppressed on required * parameters */ Translate(HttpTransport transport, HttpRequestInitializer httpRequestInitializer, String rootUrl, String servicePath, JsonObjectParser jsonObjectParser, GoogleClientRequestInitializer googleClientRequestInitializer, String applicationName, boolean suppressPatternChecks) { super(transport, httpRequestInitializer, rootUrl, servicePath, jsonObjectParser, googleClientRequestInitializer, applicationName, suppressPatternChecks); } @Override protected void initialize(AbstractGoogleClientRequest httpClientRequest) throws java.io.IOException { super.initialize(httpClientRequest); } /** * An accessor for creating requests from the Detections collection. * *

The typical use is:

*
   *   {@code Translate translate = new Translate(...);}
   *   {@code Translate.Detections.List request = translate.detections().list(parameters ...)}
   * 
* * @return the resource collection */ public Detections detections() { return new Detections(); } /** * The "detections" collection of methods. */ public class Detections { /** * Detect the language of text. * * Create a request for the method "detections.list". * * This request holds the parameters needed by the the translate server. After setting any optional * parameters, call the {@link List#execute()} method to invoke the remote operation. * * @param q The text to detect * @return the request */ public List list(java.util.List q) throws java.io.IOException { List result = new List(q); initialize(result); return result; } public class List extends TranslateRequest { private static final String REST_PATH = "v2/detect"; /** * Detect the language of text. * * Create a request for the method "detections.list". * * This request holds the parameters needed by the the translate server. After setting any * optional parameters, call the {@link List#execute()} method to invoke the remote operation.

* {@link List#initialize(AbstractGoogleClientRequest)} must be called to initialize this instance * immediately after invoking the constructor.

* * @param q The text to detect * @since 1.13 */ protected List(java.util.List q) { super(Translate.this, "GET", REST_PATH, null, com.google.api.services.translate.model.DetectionsListResponse.class); this.q = Preconditions.checkNotNull(q, "Required parameter q must be specified."); } @Override public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException { return super.executeUsingHead(); } @Override public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException { return super.buildHttpRequestUsingHead(); } @Override public List setAlt(String alt) { return (List) super.setAlt(alt); } @Override public List setFields(String fields) { return (List) super.setFields(fields); } @Override public List setKey(String key) { return (List) super.setKey(key); } @Override public List setOauthToken(String oauthToken) { return (List) super.setOauthToken(oauthToken); } @Override public List setPrettyPrint(Boolean prettyPrint) { return (List) super.setPrettyPrint(prettyPrint); } @Override public List setQuotaUser(String quotaUser) { return (List) super.setQuotaUser(quotaUser); } @Override public List setUserIp(String userIp) { return (List) super.setUserIp(userIp); } /** The text to detect */ @com.google.api.client.util.Key private java.util.List q; /** The text to detect */ public java.util.List getQ() { return q; } /** The text to detect */ public List setQ(java.util.List q) { this.q = q; return this; } } } /** * An accessor for creating requests from the Languages collection. * *

The typical use is:

*
   *   {@code Translate translate = new Translate(...);}
   *   {@code Translate.Languages.List request = translate.languages().list(parameters ...)}
   * 
* * @return the resource collection */ public Languages languages() { return new Languages(); } /** * The "languages" collection of methods. */ public class Languages { /** * List the source/target languages supported by the API * * Create a request for the method "languages.list". * * This request holds the parameters needed by the the translate server. After setting any optional * parameters, call the {@link List#execute()} method to invoke the remote operation. * * @return the request */ public List list() throws java.io.IOException { List result = new List(); initialize(result); return result; } public class List extends TranslateRequest { private static final String REST_PATH = "v2/languages"; /** * List the source/target languages supported by the API * * Create a request for the method "languages.list". * * This request holds the parameters needed by the the translate server. After setting any * optional parameters, call the {@link List#execute()} method to invoke the remote operation.

* {@link List#initialize(AbstractGoogleClientRequest)} must be called to initialize this instance * immediately after invoking the constructor.

* * @since 1.13 */ protected List() { super(Translate.this, "GET", REST_PATH, null, com.google.api.services.translate.model.LanguagesListResponse.class); } @Override public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException { return super.executeUsingHead(); } @Override public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException { return super.buildHttpRequestUsingHead(); } @Override public List setAlt(String alt) { return (List) super.setAlt(alt); } @Override public List setFields(String fields) { return (List) super.setFields(fields); } @Override public List setKey(String key) { return (List) super.setKey(key); } @Override public List setOauthToken(String oauthToken) { return (List) super.setOauthToken(oauthToken); } @Override public List setPrettyPrint(Boolean prettyPrint) { return (List) super.setPrettyPrint(prettyPrint); } @Override public List setQuotaUser(String quotaUser) { return (List) super.setQuotaUser(quotaUser); } @Override public List setUserIp(String userIp) { return (List) super.setUserIp(userIp); } /** the language and collation in which the localized results should be returned */ @com.google.api.client.util.Key private String target; /** the language and collation in which the localized results should be returned */ public String getTarget() { return target; } /** the language and collation in which the localized results should be returned */ public List setTarget(String target) { this.target = target; return this; } } } /** * An accessor for creating requests from the Translations collection. * *

The typical use is:

*
   *   {@code Translate translate = new Translate(...);}
   *   {@code Translate.Translations.List request = translate.translations().list(parameters ...)}
   * 
* * @return the resource collection */ public Translations translations() { return new Translations(); } /** * The "translations" collection of methods. */ public class Translations { /** * Returns text translations from one language to another. * * Create a request for the method "translations.list". * * This request holds the parameters needed by the the translate server. After setting any optional * parameters, call the {@link List#execute()} method to invoke the remote operation. * * @param q The text to translate * @param target The target language into which the text should be translated * @return the request */ public List list(java.util.List q, String target) throws java.io.IOException { List result = new List(q, target); initialize(result); return result; } public class List extends TranslateRequest { private static final String REST_PATH = "v2"; /** * Returns text translations from one language to another. * * Create a request for the method "translations.list". * * This request holds the parameters needed by the the translate server. After setting any * optional parameters, call the {@link List#execute()} method to invoke the remote operation.

* {@link List#initialize(AbstractGoogleClientRequest)} must be called to initialize this instance * immediately after invoking the constructor.

* * @param q The text to translate * @param target The target language into which the text should be translated * @since 1.13 */ protected List(java.util.List q, String target) { super(Translate.this, "GET", REST_PATH, null, com.google.api.services.translate.model.TranslationsListResponse.class); this.q = Preconditions.checkNotNull(q, "Required parameter q must be specified."); this.target = Preconditions.checkNotNull(target, "Required parameter target must be specified."); } @Override public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException { return super.executeUsingHead(); } @Override public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException { return super.buildHttpRequestUsingHead(); } @Override public List setAlt(String alt) { return (List) super.setAlt(alt); } @Override public List setFields(String fields) { return (List) super.setFields(fields); } @Override public List setKey(String key) { return (List) super.setKey(key); } @Override public List setOauthToken(String oauthToken) { return (List) super.setOauthToken(oauthToken); } @Override public List setPrettyPrint(Boolean prettyPrint) { return (List) super.setPrettyPrint(prettyPrint); } @Override public List setQuotaUser(String quotaUser) { return (List) super.setQuotaUser(quotaUser); } @Override public List setUserIp(String userIp) { return (List) super.setUserIp(userIp); } /** The text to translate */ @com.google.api.client.util.Key private java.util.List q; /** The text to translate */ public java.util.List getQ() { return q; } /** The text to translate */ public List setQ(java.util.List q) { this.q = q; return this; } /** The target language into which the text should be translated */ @com.google.api.client.util.Key private String target; /** The target language into which the text should be translated */ public String getTarget() { return target; } /** The target language into which the text should be translated */ public List setTarget(String target) { this.target = target; return this; } /** The source language of the text */ @com.google.api.client.util.Key private String source; /** The source language of the text */ public String getSource() { return source; } /** The source language of the text */ public List setSource(String source) { this.source = source; return this; } /** The format of the text */ @com.google.api.client.util.Key private String format; /** The format of the text */ public String getFormat() { return format; } /** The format of the text */ public List setFormat(String format) { this.format = format; return this; } /** The customization id for translate */ @com.google.api.client.util.Key private java.util.List cid; /** The customization id for translate */ public java.util.List getCid() { return cid; } /** The customization id for translate */ public List setCid(java.util.List cid) { this.cid = cid; return this; } } } /** * Builder for {@link Translate}. * *

* Implementation is not thread-safe. *

* * @since 1.3.0 */ public static final class Builder extends AbstractGoogleJsonClient.Builder { /** * Returns an instance of a new builder. * * @param transport HTTP transport * @param jsonFactory JSON factory * @param httpRequestInitializer HTTP request initializer or {@code null} for none * @since 1.7 */ public Builder(HttpTransport transport, JsonFactory jsonFactory, HttpRequestInitializer httpRequestInitializer) { super( transport, jsonFactory, DEFAULT_ROOT_URL, DEFAULT_SERVICE_PATH, httpRequestInitializer, true); } /** Builds a new instance of {@link Translate}. */ @Override public Translate build() { return new Translate(getTransport(), getHttpRequestInitializer(), getRootUrl(), getServicePath(), getObjectParser(), getGoogleClientRequestInitializer(), getApplicationName(), getSuppressPatternChecks()); } @Override public Builder setRootUrl(String rootUrl) { return (Builder) super.setRootUrl(rootUrl); } @Override public Builder setServicePath(String servicePath) { return (Builder) super.setServicePath(servicePath); } @Override public Builder setHttpRequestInitializer(HttpRequestInitializer httpRequestInitializer) { return (Builder) super.setHttpRequestInitializer(httpRequestInitializer); } @Override public Builder setApplicationName(String applicationName) { return (Builder) super.setApplicationName(applicationName); } @Override public Builder setSuppressPatternChecks(boolean suppressPatternChecks) { return (Builder) super.setSuppressPatternChecks(suppressPatternChecks); } /** * Set the {@link TranslateRequestInitializer}. * * @since 1.12 */ public Builder setTranslateRequestInitializer( TranslateRequestInitializer translateRequestInitializer) { return (Builder) super.setGoogleClientRequestInitializer(translateRequestInitializer); } @Override public Builder setGoogleClientRequestInitializer( GoogleClientRequestInitializer googleClientRequestInitializer) { return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy