/
Google.Apis.Translate.v2.cs
831 lines (713 loc) · 35.9 KB
/
Google.Apis.Translate.v2.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
// Copyright 2024 Google LLC
//
// 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
//
// https://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.
// Generated code. DO NOT EDIT!
namespace Google.Apis.Translate.v2
{
/// <summary>The Translate Service.</summary>
public class TranslateService : Google.Apis.Services.BaseClientService
{
/// <summary>The API version.</summary>
public const string Version = "v2";
/// <summary>The discovery version used to generate this service.</summary>
public static Google.Apis.Discovery.DiscoveryVersion DiscoveryVersionUsed = Google.Apis.Discovery.DiscoveryVersion.Version_1_0;
/// <summary>Constructs a new service.</summary>
public TranslateService() : this(new Google.Apis.Services.BaseClientService.Initializer())
{
}
/// <summary>Constructs a new service.</summary>
/// <param name="initializer">The service initializer.</param>
public TranslateService(Google.Apis.Services.BaseClientService.Initializer initializer) : base(initializer)
{
Detections = new DetectionsResource(this);
Languages = new LanguagesResource(this);
Translations = new TranslationsResource(this);
}
/// <summary>Gets the service supported features.</summary>
public override System.Collections.Generic.IList<string> Features => new string[] { "dataWrapper", };
/// <summary>Gets the service name.</summary>
public override string Name => "translate";
/// <summary>Gets the service base URI.</summary>
public override string BaseUri => BaseUriOverride ?? "https://translation.googleapis.com/language/translate/";
/// <summary>Gets the service base path.</summary>
public override string BasePath => "language/translate/";
/// <summary>Gets the batch base URI; <c>null</c> if unspecified.</summary>
public override string BatchUri => "https://translation.googleapis.com/batch/translate";
/// <summary>Gets the batch base path; <c>null</c> if unspecified.</summary>
public override string BatchPath => "batch/translate";
/// <summary>Available OAuth 2.0 scopes for use with the Google Cloud Translation API.</summary>
public class Scope
{
/// <summary>View and manage your data across Google Cloud Platform services</summary>
public static string CloudPlatform = "https://www.googleapis.com/auth/cloud-platform";
/// <summary>Translate text from one language to another using Google Translate</summary>
public static string CloudTranslation = "https://www.googleapis.com/auth/cloud-translation";
}
/// <summary>Available OAuth 2.0 scope constants for use with the Google Cloud Translation API.</summary>
public static class ScopeConstants
{
/// <summary>View and manage your data across Google Cloud Platform services</summary>
public const string CloudPlatform = "https://www.googleapis.com/auth/cloud-platform";
/// <summary>Translate text from one language to another using Google Translate</summary>
public const string CloudTranslation = "https://www.googleapis.com/auth/cloud-translation";
}
/// <summary>Gets the Detections resource.</summary>
public virtual DetectionsResource Detections { get; }
/// <summary>Gets the Languages resource.</summary>
public virtual LanguagesResource Languages { get; }
/// <summary>Gets the Translations resource.</summary>
public virtual TranslationsResource Translations { get; }
}
/// <summary>A base abstract class for Translate requests.</summary>
public abstract class TranslateBaseServiceRequest<TResponse> : Google.Apis.Requests.ClientServiceRequest<TResponse>
{
/// <summary>Constructs a new TranslateBaseServiceRequest instance.</summary>
protected TranslateBaseServiceRequest(Google.Apis.Services.IClientService service) : base(service)
{
}
/// <summary>V1 error format.</summary>
[Google.Apis.Util.RequestParameterAttribute("$.xgafv", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<XgafvEnum> Xgafv { get; set; }
/// <summary>V1 error format.</summary>
public enum XgafvEnum
{
/// <summary>v1 error format</summary>
[Google.Apis.Util.StringValueAttribute("1")]
Value1 = 0,
/// <summary>v2 error format</summary>
[Google.Apis.Util.StringValueAttribute("2")]
Value2 = 1,
}
/// <summary>OAuth access token.</summary>
[Google.Apis.Util.RequestParameterAttribute("access_token", Google.Apis.Util.RequestParameterType.Query)]
public virtual string AccessToken { get; set; }
/// <summary>Data format for response.</summary>
[Google.Apis.Util.RequestParameterAttribute("alt", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<AltEnum> Alt { get; set; }
/// <summary>Data format for response.</summary>
public enum AltEnum
{
/// <summary>Responses with Content-Type of application/json</summary>
[Google.Apis.Util.StringValueAttribute("json")]
Json = 0,
/// <summary>Media download with context-dependent Content-Type</summary>
[Google.Apis.Util.StringValueAttribute("media")]
Media = 1,
/// <summary>Responses with Content-Type of application/x-protobuf</summary>
[Google.Apis.Util.StringValueAttribute("proto")]
Proto = 2,
}
/// <summary>OAuth bearer token.</summary>
[Google.Apis.Util.RequestParameterAttribute("bearer_token", Google.Apis.Util.RequestParameterType.Query)]
public virtual string BearerToken { get; set; }
/// <summary>JSONP</summary>
[Google.Apis.Util.RequestParameterAttribute("callback", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Callback { get; set; }
/// <summary>Selector specifying which fields to include in a partial response.</summary>
[Google.Apis.Util.RequestParameterAttribute("fields", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Fields { get; set; }
/// <summary>
/// API key. Your API key identifies your project and provides you with API access, quota, and reports. Required
/// unless you provide an OAuth 2.0 token.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("key", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Key { get; set; }
/// <summary>OAuth 2.0 token for the current user.</summary>
[Google.Apis.Util.RequestParameterAttribute("oauth_token", Google.Apis.Util.RequestParameterType.Query)]
public virtual string OauthToken { get; set; }
/// <summary>Pretty-print response.</summary>
[Google.Apis.Util.RequestParameterAttribute("pp", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<bool> Pp { get; set; }
/// <summary>Returns response with indentations and line breaks.</summary>
[Google.Apis.Util.RequestParameterAttribute("prettyPrint", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<bool> PrettyPrint { get; set; }
/// <summary>
/// Available to use for quota purposes 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.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("quotaUser", Google.Apis.Util.RequestParameterType.Query)]
public virtual string QuotaUser { get; set; }
/// <summary>Legacy upload protocol for media (e.g. "media", "multipart").</summary>
[Google.Apis.Util.RequestParameterAttribute("uploadType", Google.Apis.Util.RequestParameterType.Query)]
public virtual string UploadType { get; set; }
/// <summary>Upload protocol for media (e.g. "raw", "multipart").</summary>
[Google.Apis.Util.RequestParameterAttribute("upload_protocol", Google.Apis.Util.RequestParameterType.Query)]
public virtual string UploadProtocol { get; set; }
/// <summary>Initializes Translate parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("$.xgafv", new Google.Apis.Discovery.Parameter
{
Name = "$.xgafv",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("access_token", new Google.Apis.Discovery.Parameter
{
Name = "access_token",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("alt", new Google.Apis.Discovery.Parameter
{
Name = "alt",
IsRequired = false,
ParameterType = "query",
DefaultValue = "json",
Pattern = null,
});
RequestParameters.Add("bearer_token", new Google.Apis.Discovery.Parameter
{
Name = "bearer_token",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("callback", new Google.Apis.Discovery.Parameter
{
Name = "callback",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("fields", new Google.Apis.Discovery.Parameter
{
Name = "fields",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("key", new Google.Apis.Discovery.Parameter
{
Name = "key",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("oauth_token", new Google.Apis.Discovery.Parameter
{
Name = "oauth_token",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pp", new Google.Apis.Discovery.Parameter
{
Name = "pp",
IsRequired = false,
ParameterType = "query",
DefaultValue = "true",
Pattern = null,
});
RequestParameters.Add("prettyPrint", new Google.Apis.Discovery.Parameter
{
Name = "prettyPrint",
IsRequired = false,
ParameterType = "query",
DefaultValue = "true",
Pattern = null,
});
RequestParameters.Add("quotaUser", new Google.Apis.Discovery.Parameter
{
Name = "quotaUser",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("uploadType", new Google.Apis.Discovery.Parameter
{
Name = "uploadType",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("upload_protocol", new Google.Apis.Discovery.Parameter
{
Name = "upload_protocol",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>The "detections" collection of methods.</summary>
public class DetectionsResource
{
private const string Resource = "detections";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public DetectionsResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>Detects the language of text within a request.</summary>
/// <param name="body">The body of the request.</param>
public virtual DetectRequest Detect(Google.Apis.Translate.v2.Data.DetectLanguageRequest body)
{
return new DetectRequest(this.service, body);
}
/// <summary>Detects the language of text within a request.</summary>
public class DetectRequest : TranslateBaseServiceRequest<Google.Apis.Translate.v2.Data.DetectionsListResponse>
{
/// <summary>Constructs a new Detect request.</summary>
public DetectRequest(Google.Apis.Services.IClientService service, Google.Apis.Translate.v2.Data.DetectLanguageRequest body) : base(service)
{
Body = body;
InitParameters();
}
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.Translate.v2.Data.DetectLanguageRequest Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "detect";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v2/detect";
/// <summary>Initializes Detect parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
}
}
/// <summary>Detects the language of text within a request.</summary>
/// <param name="q">
/// The input text upon which to perform language detection. Repeat this parameter to perform language detection
/// on multiple text inputs.
/// </param>
public virtual ListRequest List(Google.Apis.Util.Repeatable<string> q)
{
return new ListRequest(this.service, q);
}
/// <summary>Detects the language of text within a request.</summary>
public class ListRequest : TranslateBaseServiceRequest<Google.Apis.Translate.v2.Data.DetectionsListResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, Google.Apis.Util.Repeatable<string> q) : base(service)
{
Q = q;
InitParameters();
}
/// <summary>
/// The input text upon which to perform language detection. Repeat this parameter to perform language
/// detection on multiple text inputs.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("q", Google.Apis.Util.RequestParameterType.Query)]
public virtual Google.Apis.Util.Repeatable<string> Q { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v2/detect";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("q", new Google.Apis.Discovery.Parameter
{
Name = "q",
IsRequired = true,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
}
/// <summary>The "languages" collection of methods.</summary>
public class LanguagesResource
{
private const string Resource = "languages";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public LanguagesResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>Returns a list of supported languages for translation.</summary>
public virtual ListRequest List()
{
return new ListRequest(this.service);
}
/// <summary>Returns a list of supported languages for translation.</summary>
public class ListRequest : TranslateBaseServiceRequest<Google.Apis.Translate.v2.Data.LanguagesListResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service) : base(service)
{
InitParameters();
}
/// <summary>The model type for which supported languages should be returned.</summary>
[Google.Apis.Util.RequestParameterAttribute("model", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Model { get; set; }
/// <summary>The language to use to return localized, human readable names of supported languages.</summary>
[Google.Apis.Util.RequestParameterAttribute("target", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Target { get; set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v2/languages";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("model", new Google.Apis.Discovery.Parameter
{
Name = "model",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("target", new Google.Apis.Discovery.Parameter
{
Name = "target",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
}
/// <summary>The "translations" collection of methods.</summary>
public class TranslationsResource
{
private const string Resource = "translations";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public TranslationsResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>Translates input text, returning translated text.</summary>
/// <param name="q">
/// The input text to translate. Repeat this parameter to perform translation operations on multiple text
/// inputs.
/// </param>
/// <param name="target">
/// The language to use for translation of the input text, set to one of the language codes listed in Language
/// Support.
/// </param>
public virtual ListRequest List(Google.Apis.Util.Repeatable<string> q, string target)
{
return new ListRequest(this.service, q, target);
}
/// <summary>Translates input text, returning translated text.</summary>
public class ListRequest : TranslateBaseServiceRequest<Google.Apis.Translate.v2.Data.TranslationsListResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, Google.Apis.Util.Repeatable<string> q, string target) : base(service)
{
Q = q;
Target = target;
InitParameters();
}
/// <summary>
/// The input text to translate. Repeat this parameter to perform translation operations on multiple text
/// inputs.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("q", Google.Apis.Util.RequestParameterType.Query)]
public virtual Google.Apis.Util.Repeatable<string> Q { get; private set; }
/// <summary>
/// The language to use for translation of the input text, set to one of the language codes listed in
/// Language Support.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("target", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Target { get; private set; }
/// <summary>The customization id for translate</summary>
[Google.Apis.Util.RequestParameterAttribute("cid", Google.Apis.Util.RequestParameterType.Query)]
public virtual Google.Apis.Util.Repeatable<string> Cid { get; set; }
/// <summary>
/// The format of the source text, in either HTML (default) or plain-text. A value of "html" indicates HTML
/// and a value of "text" indicates plain-text.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("format", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<FormatEnum> Format { get; set; }
/// <summary>
/// The format of the source text, in either HTML (default) or plain-text. A value of "html" indicates HTML
/// and a value of "text" indicates plain-text.
/// </summary>
public enum FormatEnum
{
/// <summary>Specifies the input is in HTML</summary>
[Google.Apis.Util.StringValueAttribute("html")]
Html = 0,
/// <summary>Specifies the input is in plain textual format</summary>
[Google.Apis.Util.StringValueAttribute("text")]
Text = 1,
}
/// <summary>
/// The `model` type requested for this translation. Valid values are listed in public documentation.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("model", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Model { get; set; }
/// <summary>
/// The language of the source text, set to one of the language codes listed in Language Support. If the
/// source language is not specified, the API will attempt to identify the source language automatically and
/// return it within the response.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("source", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Source { get; set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v2";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("q", new Google.Apis.Discovery.Parameter
{
Name = "q",
IsRequired = true,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("target", new Google.Apis.Discovery.Parameter
{
Name = "target",
IsRequired = true,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("cid", new Google.Apis.Discovery.Parameter
{
Name = "cid",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("format", new Google.Apis.Discovery.Parameter
{
Name = "format",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("model", new Google.Apis.Discovery.Parameter
{
Name = "model",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("source", new Google.Apis.Discovery.Parameter
{
Name = "source",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Translates input text, returning translated text.</summary>
/// <param name="body">The body of the request.</param>
public virtual TranslateRequest Translate(Google.Apis.Translate.v2.Data.TranslateTextRequest body)
{
return new TranslateRequest(this.service, body);
}
/// <summary>Translates input text, returning translated text.</summary>
public class TranslateRequest : TranslateBaseServiceRequest<Google.Apis.Translate.v2.Data.TranslationsListResponse>
{
/// <summary>Constructs a new Translate request.</summary>
public TranslateRequest(Google.Apis.Services.IClientService service, Google.Apis.Translate.v2.Data.TranslateTextRequest body) : base(service)
{
Body = body;
InitParameters();
}
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.Translate.v2.Data.TranslateTextRequest Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "translate";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v2";
/// <summary>Initializes Translate parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
}
}
}
}
namespace Google.Apis.Translate.v2.Data
{
/// <summary>The request message for language detection.</summary>
public class DetectLanguageRequest : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// The input text upon which to perform language detection. Repeat this parameter to perform language detection
/// on multiple text inputs.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("q")]
public virtual System.Collections.Generic.IList<string> Q { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
public class DetectionsListResponse : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>A detections contains detection results of several text</summary>
[Newtonsoft.Json.JsonPropertyAttribute("detections")]
public virtual System.Collections.Generic.IList<System.Collections.Generic.IList<DetectionsResourceItems>> Detections { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>An array of languages which we detect for the given text The most likely language list first.</summary>
public class DetectionsResourceItems : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The confidence of the detection result of this language.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("confidence")]
public virtual System.Nullable<float> Confidence { get; set; }
/// <summary>A boolean to indicate is the language detection result reliable.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("isReliable")]
public virtual System.Nullable<bool> IsReliable { get; set; }
/// <summary>The language we detected.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("language")]
public virtual string Language { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>The request message for discovering supported languages.</summary>
public class GetSupportedLanguagesRequest : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The language to use to return localized, human readable names of supported languages.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("target")]
public virtual string Target { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
public class LanguagesListResponse : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// 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.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("languages")]
public virtual System.Collections.Generic.IList<LanguagesResource> Languages { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
public class LanguagesResource : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// Supported language code, generally consisting of its ISO 639-1 identifier. (E.g. 'en', 'ja'). In certain
/// cases, BCP-47 codes including language + region identifiers are returned (e.g. 'zh-TW' and 'zh-CH')
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("language")]
public virtual string Language { get; set; }
/// <summary>Human readable name of the language localized to the target language.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("name")]
public virtual string Name { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>The main translation request message for the Cloud Translation API.</summary>
public class TranslateTextRequest : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// The format of the source text, in either HTML (default) or plain-text. A value of "html" indicates HTML and
/// a value of "text" indicates plain-text.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("format")]
public virtual string Format { get; set; }
/// <summary>
/// The `model` type requested for this translation. Valid values are listed in public documentation.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("model")]
public virtual string Model { get; set; }
/// <summary>
/// The input text to translate. Repeat this parameter to perform translation operations on multiple text
/// inputs.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("q")]
public virtual System.Collections.Generic.IList<string> Q { get; set; }
/// <summary>
/// The language of the source text, set to one of the language codes listed in Language Support. If the source
/// language is not specified, the API will attempt to identify the source language automatically and return it
/// within the response.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("source")]
public virtual string Source { get; set; }
/// <summary>
/// The language to use for translation of the input text, set to one of the language codes listed in Language
/// Support.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("target")]
public virtual string Target { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>The main language translation response message.</summary>
public class TranslationsListResponse : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>Translations contains list of translation results of given text</summary>
[Newtonsoft.Json.JsonPropertyAttribute("translations")]
public virtual System.Collections.Generic.IList<TranslationsResource> Translations { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
public class TranslationsResource : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// The source language of the initial request, detected automatically, if no source language was passed within
/// the initial request. If the source language was passed, auto-detection of the language will not occur and
/// this field will be empty.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("detectedSourceLanguage")]
public virtual string DetectedSourceLanguage { get; set; }
/// <summary>
/// The `model` type used for this translation. Valid values are listed in public documentation. Can be
/// different from requested `model`. Present only if specific model type was explicitly requested.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("model")]
public virtual string Model { get; set; }
/// <summary>Text translated into the target language.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("translatedText")]
public virtual string TranslatedText { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
}