//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:2.0.50727.5466
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
namespace Google.Apis.Translate.v2.Data
{
using System;
using System.Collections;
using System.Collections.Generic;
public class DetectionsListResponse : Google.Apis.Requests.IDirectResponseSchema
{
private System.Collections.Generic.IList _detections;
private string _ETag;
/// A detections contains detection results of several text
[Newtonsoft.Json.JsonPropertyAttribute("detections")]
public virtual System.Collections.Generic.IList Detections
{
get
{
return this._detections;
}
set
{
this._detections = value;
}
}
public virtual string ETag
{
get
{
return this._ETag;
}
set
{
this._ETag = value;
}
}
}
/// An array of languages which we detect for the given text The most likely language list first.
public class DetectionsResource : System.Collections.Generic.List
{
public class Entry
{
private System.Nullable _confidence;
private System.Nullable _isReliable;
private string _language;
/// The confidence of the detection resul of this language.
[Newtonsoft.Json.JsonPropertyAttribute("confidence")]
public virtual System.Nullable Confidence
{
get
{
return this._confidence;
}
set
{
this._confidence = value;
}
}
/// A boolean to indicate is the language detection result reliable.
[Newtonsoft.Json.JsonPropertyAttribute("isReliable")]
public virtual System.Nullable IsReliable
{
get
{
return this._isReliable;
}
set
{
this._isReliable = value;
}
}
/// The language we detect
[Newtonsoft.Json.JsonPropertyAttribute("language")]
public virtual string Language
{
get
{
return this._language;
}
set
{
this._language = value;
}
}
}
}
public class LanguagesListResponse : Google.Apis.Requests.IDirectResponseSchema
{
private System.Collections.Generic.IList _languages;
private string _ETag;
/// List of source/target languages supported by the translation API. If target parameter is unspecified, the list is sorted by the ASCII code point order of the language code. If target parameter is specified, the list is sorted by the collation order of the language name in the target language.
[Newtonsoft.Json.JsonPropertyAttribute("languages")]
public virtual System.Collections.Generic.IList Languages
{
get
{
return this._languages;
}
set
{
this._languages = value;
}
}
public virtual string ETag
{
get
{
return this._ETag;
}
set
{
this._ETag = value;
}
}
}
public class LanguagesResource
{
private string _language;
private string _name;
/// The language code.
[Newtonsoft.Json.JsonPropertyAttribute("language")]
public virtual string Language
{
get
{
return this._language;
}
set
{
this._language = value;
}
}
/// The localized name of the language if target parameter is given.
[Newtonsoft.Json.JsonPropertyAttribute("name")]
public virtual string Name
{
get
{
return this._name;
}
set
{
this._name = value;
}
}
}
public class TranslationsListResponse : Google.Apis.Requests.IDirectResponseSchema
{
private System.Collections.Generic.IList _translations;
private string _ETag;
/// Translations contains list of translation results of given text
[Newtonsoft.Json.JsonPropertyAttribute("translations")]
public virtual System.Collections.Generic.IList Translations
{
get
{
return this._translations;
}
set
{
this._translations = value;
}
}
public virtual string ETag
{
get
{
return this._ETag;
}
set
{
this._ETag = value;
}
}
}
public class TranslationsResource
{
private string _detectedSourceLanguage;
private string _translatedText;
/// Detected source language if source parameter is unspecified.
[Newtonsoft.Json.JsonPropertyAttribute("detectedSourceLanguage")]
public virtual string DetectedSourceLanguage
{
get
{
return this._detectedSourceLanguage;
}
set
{
this._detectedSourceLanguage = value;
}
}
/// The translation.
[Newtonsoft.Json.JsonPropertyAttribute("translatedText")]
public virtual string TranslatedText
{
get
{
return this._translatedText;
}
set
{
this._translatedText = value;
}
}
}
}
namespace Google.Apis.Translate.v2
{
using System;
using System.IO;
using System.Collections.Generic;
using Google.Apis;
using Google.Apis.Discovery;
public partial class TranslateService : Google.Apis.Discovery.IRequestProvider
{
private Google.Apis.Discovery.IService _service;
private Google.Apis.Authentication.IAuthenticator _authenticator;
private const string DiscoveryDocument = "{\"kind\":\"discovery#restDescription\",\"etag\":\"\\\"zZ6SZIrxjkCWan0Pp0n2ulHSaJk/0-Y5DNK" +
"93jgoziDxP4PQmKHHkRM\\\"\",\"discoveryVersion\":\"v1\",\"id\":\"translate:v2\",\"name\":\"tran" +
"slate\",\"version\":\"v2\",\"revision\":\"20120112\",\"title\":\"Translate API\",\"description" +
"\":\"Lets you translate text from one language to another\",\"icons\":{\"x16\":\"http://" +
"www.google.com/images/icons/product/translate-16.png\",\"x32\":\"http://www.google.c" +
"om/images/icons/product/translate-32.png\"},\"documentationLink\":\"http://code.goog" +
"le.com/apis/language/translate/v2/using_rest.html\",\"protocol\":\"rest\",\"baseUrl\":\"" +
"https://www.googleapis.com/language/translate/\",\"basePath\":\"/language/translate/" +
"\",\"rootUrl\":\"https://www.googleapis.com/\",\"servicePath\":\"language/translate/\",\"b" +
"atchPath\":\"batch\",\"parameters\":{\"alt\":{\"type\":\"string\",\"description\":\"Data forma" +
"t for the response.\",\"default\":\"json\",\"enum\":[\"json\"],\"enumDescriptions\":[\"Respo" +
"nses with Content-Type of application/json\"],\"location\":\"query\"},\"fields\":{\"type" +
"\":\"string\",\"description\":\"Selector specifying which fields to include in a parti" +
"al response.\",\"location\":\"query\"},\"key\":{\"type\":\"string\",\"description\":\"API key." +
" Your API key identifies your project and provides you with API access, quota, a" +
"nd reports. Required unless you provide an OAuth 2.0 token.\",\"location\":\"query\"}" +
",\"oauth_token\":{\"type\":\"string\",\"description\":\"OAuth 2.0 token for the current u" +
"ser.\",\"location\":\"query\"},\"prettyPrint\":{\"type\":\"boolean\",\"description\":\"Returns" +
" response with indentations and line breaks.\",\"default\":\"true\",\"location\":\"query" +
"\"},\"quotaUser\":{\"type\":\"string\",\"description\":\"Available to use for quota purpos" +
"es for server-side applications. Can be any arbitrary string assigned to a user," +
" but should not exceed 40 characters. Overrides userIp if both are provided.\",\"l" +
"ocation\":\"query\"},\"userIp\":{\"type\":\"string\",\"description\":\"IP address of the sit" +
"e where the request originates. Use this if you want to enforce per-user limits." +
"\",\"location\":\"query\"}},\"features\":[\"dataWrapper\"],\"schemas\":{\"DetectionsListResp" +
"onse\":{\"id\":\"DetectionsListResponse\",\"type\":\"object\",\"properties\":{\"detections\":" +
"{\"type\":\"array\",\"description\":\"A detections contains detection results of severa" +
"l text\",\"items\":{\"$ref\":\"DetectionsResource\"}}}},\"DetectionsResource\":{\"id\":\"Det" +
"ectionsResource\",\"type\":\"array\",\"description\":\"An array of languages which we de" +
"tect for the given text The most likely language list first.\",\"items\":{\"type\":\"o" +
"bject\",\"properties\":{\"confidence\":{\"type\":\"number\",\"description\":\"The confidence" +
" of the detection resul of this language.\",\"format\":\"float\"},\"isReliable\":{\"type" +
"\":\"boolean\",\"description\":\"A boolean to indicate is the language detection resul" +
"t reliable.\"},\"language\":{\"type\":\"string\",\"description\":\"The language we detect\"" +
"}}}},\"LanguagesListResponse\":{\"id\":\"LanguagesListResponse\",\"type\":\"object\",\"prop" +
"erties\":{\"languages\":{\"type\":\"array\",\"description\":\"List of source/target langua" +
"ges supported by the translation API. If target parameter is unspecified, the li" +
"st is sorted by the ASCII code point order of the language code. If target param" +
"eter is specified, the list is sorted by the collation order of the language nam" +
"e in the target language.\",\"items\":{\"$ref\":\"LanguagesResource\"}}}},\"LanguagesRes" +
"ource\":{\"id\":\"LanguagesResource\",\"type\":\"object\",\"properties\":{\"language\":{\"type" +
"\":\"string\",\"description\":\"The language code.\"},\"name\":{\"type\":\"string\",\"descript" +
"ion\":\"The localized name of the language if target parameter is given.\"}}},\"Tran" +
"slationsListResponse\":{\"id\":\"TranslationsListResponse\",\"type\":\"object\",\"properti" +
"es\":{\"translations\":{\"type\":\"array\",\"description\":\"Translations contains list of" +
" translation results of given text\",\"items\":{\"$ref\":\"TranslationsResource\"}}}},\"" +
"TranslationsResource\":{\"id\":\"TranslationsResource\",\"type\":\"object\",\"properties\":" +
"{\"detectedSourceLanguage\":{\"type\":\"string\",\"description\":\"Detected source langua" +
"ge if source parameter is unspecified.\"},\"translatedText\":{\"type\":\"string\",\"desc" +
"ription\":\"The translation.\"}}}},\"resources\":{\"detections\":{\"methods\":{\"list\":{\"i" +
"d\":\"language.detections.list\",\"path\":\"v2/detect\",\"httpMethod\":\"GET\",\"description" +
"\":\"Detect the language of text.\",\"parameters\":{\"q\":{\"type\":\"string\",\"description" +
"\":\"The text to detect\",\"required\":true,\"repeated\":true,\"location\":\"query\"}},\"par" +
"ameterOrder\":[\"q\"],\"response\":{\"$ref\":\"DetectionsListResponse\"}}}},\"languages\":{" +
"\"methods\":{\"list\":{\"id\":\"language.languages.list\",\"path\":\"v2/languages\",\"httpMet" +
"hod\":\"GET\",\"description\":\"List the source/target languages supported by the API\"" +
",\"parameters\":{\"target\":{\"type\":\"string\",\"description\":\"the language and collati" +
"on in which the localized results should be returned\",\"location\":\"query\"}},\"resp" +
"onse\":{\"$ref\":\"LanguagesListResponse\"}}}},\"translations\":{\"methods\":{\"list\":{\"id" +
"\":\"language.translations.list\",\"path\":\"v2\",\"httpMethod\":\"GET\",\"description\":\"Ret" +
"urns text translations from one language to another.\",\"parameters\":{\"cid\":{\"type" +
"\":\"string\",\"description\":\"The customization id for translate\",\"repeated\":true,\"l" +
"ocation\":\"query\"},\"format\":{\"type\":\"string\",\"description\":\"The format of the tex" +
"t\",\"enum\":[\"html\",\"text\"],\"enumDescriptions\":[\"Specifies the input is in HTML\",\"" +
"Specifies the input is in plain textual format\"],\"location\":\"query\"},\"q\":{\"type\"" +
":\"string\",\"description\":\"The text to translate\",\"required\":true,\"repeated\":true," +
"\"location\":\"query\"},\"source\":{\"type\":\"string\",\"description\":\"The source language" +
" of the text\",\"location\":\"query\"},\"target\":{\"type\":\"string\",\"description\":\"The t" +
"arget language into which the text should be translated\",\"required\":true,\"locati" +
"on\":\"query\"}},\"parameterOrder\":[\"q\",\"target\"],\"response\":{\"$ref\":\"TranslationsLi" +
"stResponse\"}}}}}}";
public const string Version = "v2";
public static Google.Apis.Discovery.DiscoveryVersion DiscoveryVersionUsed = Google.Apis.Discovery.DiscoveryVersion.Version_1_0;
private string _Key;
protected TranslateService(Google.Apis.Discovery.IService _service, Google.Apis.Authentication.IAuthenticator _authenticator)
{
this._service = _service;
this._authenticator = _authenticator;
this._detections = new DetectionsResource(this, _authenticator);
this._languages = new LanguagesResource(this, _authenticator);
this._translations = new TranslationsResource(this, _authenticator);
}
public TranslateService() :
this(Google.Apis.Authentication.NullAuthenticator.Instance)
{
}
public TranslateService(Google.Apis.Authentication.IAuthenticator _authenticator) :
this(new Google.Apis.Discovery.DiscoveryService(new Google.Apis.Discovery.StringDiscoveryDevice(DiscoveryDocument)).GetService(TranslateService.DiscoveryVersionUsed, new Google.Apis.Discovery.FactoryParameters(new System.Uri("https://www.googleapis.com/language/translate/"))), _authenticator)
{
}
public Google.Apis.Authentication.IAuthenticator Authenticator
{
get
{
return this._authenticator;
}
}
public virtual string Name
{
get
{
return "translate";
}
}
public virtual string BaseUri
{
get
{
return "https://www.googleapis.com/language/translate/";
}
}
/// Sets the API-Key (or DeveloperKey) which this service uses for all requests
public virtual string Key
{
get
{
return this._Key;
}
set
{
this._Key = value;
}
}
public virtual Google.Apis.Requests.IRequest CreateRequest(string resource, string method)
{
Google.Apis.Requests.IRequest request = this._service.CreateRequest(resource, method);
if ((string.IsNullOrEmpty(Key) == false))
{
request = request.WithKey(this.Key);
}
return request.WithAuthentication(_authenticator);
}
public virtual void RegisterSerializer(Google.Apis.ISerializer serializer)
{
_service.Serializer = serializer;
}
public virtual string SerializeObject(object obj)
{
return _service.SerializeRequest(obj);
}
public virtual T DeserializeResponse(Google.Apis.Requests.IResponse response)
{
return _service.DeserializeResponse(response);
}
}
public class DetectionsResource
{
private TranslateService service;
private Google.Apis.Authentication.IAuthenticator _authenticator;
private const string Resource = "detections";
public DetectionsResource(TranslateService service, Google.Apis.Authentication.IAuthenticator _authenticator)
{
this.service = service;
this._authenticator = _authenticator;
}
/// Detect the language of text.
/// Required - The text to detect
public virtual ListRequest List(Google.Apis.Util.Repeatable q)
{
return new ListRequest(service, q);
}
public class ListRequest : Google.Apis.Requests.ServiceRequest
{
private string _oauth_token;
private System.Nullable _prettyPrint;
private Google.Apis.Util.Repeatable _q;
public ListRequest(Google.Apis.Discovery.IRequestProvider service, Google.Apis.Util.Repeatable q) :
base(service)
{
this._q = q;
}
/// OAuth 2.0 token for the current user.
[Google.Apis.Util.RequestParameterAttribute("oauth_token", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Oauth_token
{
get
{
return this._oauth_token;
}
set
{
this._oauth_token = value;
}
}
/// Returns response with indentations and line breaks.
[Google.Apis.Util.RequestParameterAttribute("prettyPrint", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable PrettyPrint
{
get
{
return this._prettyPrint;
}
set
{
this._prettyPrint = value;
}
}
/// The text to detect
[Google.Apis.Util.RequestParameterAttribute("q", Google.Apis.Util.RequestParameterType.Query)]
public virtual Google.Apis.Util.Repeatable Q
{
get
{
return this._q;
}
}
protected override string ResourcePath
{
get
{
return "detections";
}
}
protected override string MethodName
{
get
{
return "list";
}
}
}
}
public class LanguagesResource
{
private TranslateService service;
private Google.Apis.Authentication.IAuthenticator _authenticator;
private const string Resource = "languages";
public LanguagesResource(TranslateService service, Google.Apis.Authentication.IAuthenticator _authenticator)
{
this.service = service;
this._authenticator = _authenticator;
}
/// List the source/target languages supported by the API
public virtual ListRequest List()
{
return new ListRequest(service);
}
public class ListRequest : Google.Apis.Requests.ServiceRequest
{
private string _oauth_token;
private System.Nullable _prettyPrint;
private string _target;
public ListRequest(Google.Apis.Discovery.IRequestProvider service) :
base(service)
{
}
/// OAuth 2.0 token for the current user.
[Google.Apis.Util.RequestParameterAttribute("oauth_token", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Oauth_token
{
get
{
return this._oauth_token;
}
set
{
this._oauth_token = value;
}
}
/// Returns response with indentations and line breaks.
[Google.Apis.Util.RequestParameterAttribute("prettyPrint", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable PrettyPrint
{
get
{
return this._prettyPrint;
}
set
{
this._prettyPrint = value;
}
}
/// the language and collation in which the localized results should be returned
[Google.Apis.Util.RequestParameterAttribute("target", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Target
{
get
{
return this._target;
}
set
{
this._target = value;
}
}
protected override string ResourcePath
{
get
{
return "languages";
}
}
protected override string MethodName
{
get
{
return "list";
}
}
}
}
public class TranslationsResource
{
private TranslateService service;
private Google.Apis.Authentication.IAuthenticator _authenticator;
private const string Resource = "translations";
public TranslationsResource(TranslateService service, Google.Apis.Authentication.IAuthenticator _authenticator)
{
this.service = service;
this._authenticator = _authenticator;
}
/// Returns text translations from one language to another.
/// Required - The text to translate
/// Required - The target language into which the text should be translated
public virtual ListRequest List(Google.Apis.Util.Repeatable q, string target)
{
return new ListRequest(service, q, target);
}
/// The format of the text
[System.ComponentModel.TypeConverterAttribute(typeof(Google.Apis.Util.EnumStringValueTypeConverter))]
public enum Format
{
/// Specifies the input is in HTML
[Google.Apis.Util.StringValueAttribute("html")]
Html,
/// Specifies the input is in plain textual format
[Google.Apis.Util.StringValueAttribute("text")]
Text,
}
public class ListRequest : Google.Apis.Requests.ServiceRequest
{
private string _oauth_token;
private System.Nullable _prettyPrint;
private Google.Apis.Util.Repeatable _cid;
private System.Nullable _format;
private Google.Apis.Util.Repeatable _q;
private string _source;
private string _target;
public ListRequest(Google.Apis.Discovery.IRequestProvider service, Google.Apis.Util.Repeatable q, string target) :
base(service)
{
this._q = q;
this._target = target;
}
/// OAuth 2.0 token for the current user.
[Google.Apis.Util.RequestParameterAttribute("oauth_token", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Oauth_token
{
get
{
return this._oauth_token;
}
set
{
this._oauth_token = value;
}
}
/// Returns response with indentations and line breaks.
[Google.Apis.Util.RequestParameterAttribute("prettyPrint", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable PrettyPrint
{
get
{
return this._prettyPrint;
}
set
{
this._prettyPrint = value;
}
}
/// The customization id for translate
[Google.Apis.Util.RequestParameterAttribute("cid", Google.Apis.Util.RequestParameterType.Query)]
public virtual Google.Apis.Util.Repeatable Cid
{
get
{
return this._cid;
}
set
{
this._cid = value;
}
}
/// The format of the text
[Google.Apis.Util.RequestParameterAttribute("format", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable Format
{
get
{
return this._format;
}
set
{
this._format = value;
}
}
/// The text to translate
[Google.Apis.Util.RequestParameterAttribute("q", Google.Apis.Util.RequestParameterType.Query)]
public virtual Google.Apis.Util.Repeatable Q
{
get
{
return this._q;
}
}
/// The source language of the text
[Google.Apis.Util.RequestParameterAttribute("source", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Source
{
get
{
return this._source;
}
set
{
this._source = value;
}
}
/// The target language into which the text should be translated
[Google.Apis.Util.RequestParameterAttribute("target", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Target
{
get
{
return this._target;
}
}
protected override string ResourcePath
{
get
{
return "translations";
}
}
protected override string MethodName
{
get
{
return "list";
}
}
}
}
public partial class TranslateService
{
private const string Resource = "";
private DetectionsResource _detections;
private LanguagesResource _languages;
private TranslationsResource _translations;
private Google.Apis.Discovery.IRequestProvider service
{
get
{
return this;
}
}
public virtual DetectionsResource Detections
{
get
{
return this._detections;
}
}
public virtual LanguagesResource Languages
{
get
{
return this._languages;
}
}
public virtual TranslationsResource Translations
{
get
{
return this._translations;
}
}
}
}