translate  v2
 All Classes Functions Variables Groups
translate_service.h
1 // Copyright 2010 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
13 // the License.
14 //
15 //------------------------------------------------------------------------------
16 // This code was generated by google-apis-code-generator 1.5.1
17 // Build date: 2017-02-15 17:18:02 UTC
18 // on: 2017-05-29, 17:24:01 UTC
19 // C++ generator version: 0.1.4
20 //
21 // Changes to this file may cause incorrect behavior and will be lost if
22 // the code is regenerated.
23 //------------------------------------------------------------------------------
24 #ifndef GOOGLE_TRANSLATE_API_TRANSLATE_SERVICE_H_
25 #define GOOGLE_TRANSLATE_API_TRANSLATE_SERVICE_H_
26 
27 #include <string>
28 #include "googleapis/base/macros.h"
29 #include "googleapis/client/service/client_service.h"
30 #include "googleapis/client/util/status.h"
31 #include "googleapis/client/util/uri_template.h"
32 
33 #include "google/translate_api/detect_language_request.h"
34 #include "google/translate_api/detections_list_response.h"
35 #include "google/translate_api/languages_list_response.h"
36 #include "google/translate_api/translate_text_request.h"
37 #include "google/translate_api/translations_list_response.h"
38 
39 
40 namespace google_translate_api {
41 using namespace googleapis;
72 class TranslateService;
73 
82  : public client::ClientServiceRequest {
83  public:
106  const client::ClientService* service,
107  client::AuthorizationCredential* credential,
108  client::HttpRequest::HttpMethod method,
109  const StringPiece& uri_template);
110 
114  virtual ~TranslateServiceBaseRequest();
115 
116 
120  void clear_xgafv() {
121  _have_xgafv_ = false;
122  client::ClearCppValueHelper(&xgafv_);
123  }
124 
125 
131  const string& get_xgafv() const { return xgafv_; }
132 
138  string* mutable_$Xgafv() {
139  _have_xgafv_ = true;
140  return &xgafv_;
141  }
142 
143 
149  void set_xgafv(const string& value) {
150  _have_xgafv_ = true;
151  xgafv_ = value;
152  }
153 
154 
155 
160  _have_access_token_ = false;
161  client::ClearCppValueHelper(&access_token_);
162  }
163 
164 
170  const string& get_access_token() const { return access_token_; }
171 
179  _have_access_token_ = true;
180  return &access_token_;
181  }
182 
183 
189  void set_access_token(const string& value) {
190  _have_access_token_ = true;
191  access_token_ = value;
192  }
193 
194 
195 
199  void clear_alt() {
200  _have_alt_ = false;
201  client::ClearCppValueHelper(&alt_);
202  }
203 
204 
210  const string& get_alt() const { return alt_; }
211 
217  string* mutable_alt() {
218  _have_alt_ = true;
219  return &alt_;
220  }
221 
222 
228  void set_alt(const string& value) {
229  _have_alt_ = true;
230  alt_ = value;
231  }
232 
233 
234 
239  _have_bearer_token_ = false;
240  client::ClearCppValueHelper(&bearer_token_);
241  }
242 
243 
249  const string& get_bearer_token() const { return bearer_token_; }
250 
258  _have_bearer_token_ = true;
259  return &bearer_token_;
260  }
261 
262 
268  void set_bearer_token(const string& value) {
269  _have_bearer_token_ = true;
270  bearer_token_ = value;
271  }
272 
273 
274 
278  void clear_callback() {
279  _have_callback_ = false;
280  client::ClearCppValueHelper(&callback_);
281  }
282 
283 
289  const string& get_callback() const { return callback_; }
290 
296  string* mutable_callback() {
297  _have_callback_ = true;
298  return &callback_;
299  }
300 
301 
307  void set_callback(const string& value) {
308  _have_callback_ = true;
309  callback_ = value;
310  }
311 
312 
313 
317  void clear_fields() {
318  _have_fields_ = false;
319  client::ClearCppValueHelper(&fields_);
320  }
321 
322 
328  const string& get_fields() const { return fields_; }
329 
335  string* mutable_fields() {
336  _have_fields_ = true;
337  return &fields_;
338  }
339 
340 
347  void set_fields(const string& value) {
348  _have_fields_ = true;
349  fields_ = value;
350  }
351 
352 
353 
357  void clear_key() {
358  _have_key_ = false;
359  client::ClearCppValueHelper(&key_);
360  }
361 
362 
368  const string& get_key() const { return key_; }
369 
375  string* mutable_key() {
376  _have_key_ = true;
377  return &key_;
378  }
379 
380 
388  void set_key(const string& value) {
389  _have_key_ = true;
390  key_ = value;
391  }
392 
393 
394 
399  _have_oauth_token_ = false;
400  client::ClearCppValueHelper(&oauth_token_);
401  }
402 
403 
409  const string& get_oauth_token() const { return oauth_token_; }
410 
417  string* mutable_oauthToken() {
418  _have_oauth_token_ = true;
419  return &oauth_token_;
420  }
421 
422 
428  void set_oauth_token(const string& value) {
429  _have_oauth_token_ = true;
430  oauth_token_ = value;
431  }
432 
433 
434 
438  void clear_pp() {
439  _have_pp_ = false;
440  client::ClearCppValueHelper(&pp_);
441  }
442 
443 
449  bool get_pp() const { return pp_; }
450 
456  void set_pp(bool value) {
457  _have_pp_ = true;
458  pp_ = value;
459  }
460 
465  _have_pretty_print_ = false;
466  client::ClearCppValueHelper(&pretty_print_);
467  }
468 
469 
475  bool get_pretty_print() const { return pretty_print_; }
476 
482  void set_pretty_print(bool value) {
483  _have_pretty_print_ = true;
484  pretty_print_ = value;
485  }
486 
491  _have_quota_user_ = false;
492  client::ClearCppValueHelper(&quota_user_);
493  }
494 
495 
501  const string& get_quota_user() const { return quota_user_; }
502 
509  string* mutable_quotaUser() {
510  _have_quota_user_ = true;
511  return &quota_user_;
512  }
513 
514 
522  void set_quota_user(const string& value) {
523  _have_quota_user_ = true;
524  quota_user_ = value;
525  }
526 
527 
528 
533  _have_upload_type_ = false;
534  client::ClearCppValueHelper(&upload_type_);
535  }
536 
537 
543  const string& get_upload_type() const { return upload_type_; }
544 
551  string* mutable_uploadType() {
552  _have_upload_type_ = true;
553  return &upload_type_;
554  }
555 
556 
563  void set_upload_type(const string& value) {
564  _have_upload_type_ = true;
565  upload_type_ = value;
566  }
567 
568 
569 
574  _have_upload_protocol_ = false;
575  client::ClearCppValueHelper(&upload_protocol_);
576  }
577 
578 
584  const string& get_upload_protocol() const { return upload_protocol_; }
585 
593  _have_upload_protocol_ = true;
594  return &upload_protocol_;
595  }
596 
597 
603  void set_upload_protocol(const string& value) {
604  _have_upload_protocol_ = true;
605  upload_protocol_ = value;
606  }
607 
618  virtual util::Status AppendVariable(
619  const StringPiece& variable_name,
620  const client::UriTemplateConfig& config,
621  string* target);
622 
628  virtual util::Status AppendOptionalQueryParameters(string* target);
629 
630 
631  protected:
637  void AddJsonContentToRequest(const client::JsonCppData *content);
638 
639  private:
640  string xgafv_;
641  string access_token_;
642  string alt_;
643  string bearer_token_;
644  string callback_;
645  string fields_;
646  string key_;
647  string oauth_token_;
648  bool pp_;
649  bool pretty_print_;
650  string quota_user_;
651  string upload_type_;
652  string upload_protocol_;
653  bool _have_xgafv_ : 1;
654  bool _have_access_token_ : 1;
655  bool _have_alt_ : 1;
656  bool _have_bearer_token_ : 1;
657  bool _have_callback_ : 1;
658  bool _have_fields_ : 1;
659  bool _have_key_ : 1;
660  bool _have_oauth_token_ : 1;
661  bool _have_pp_ : 1;
662  bool _have_pretty_print_ : 1;
663  bool _have_quota_user_ : 1;
664  bool _have_upload_type_ : 1;
665  bool _have_upload_protocol_ : 1;
666 
667  DISALLOW_COPY_AND_ASSIGN(TranslateServiceBaseRequest);
668 };
669 
670 
671 
686  public:
696  const TranslateService* _service_,
697  client::AuthorizationCredential* _credential_,
698  const DetectLanguageRequest& _content_);
699 
704 
715  util::Status ExecuteAndParseResponse(
716  DetectionsListResponse* data) {
717  return TranslateServiceBaseRequest::ExecuteAndParseResponse(data);
718  }
719 
720  private:
721  string _content_;
722  DISALLOW_COPY_AND_ASSIGN(DetectionsResource_DetectMethod);
723 };
724 
739  public:
751  const TranslateService* _service_,
752  client::AuthorizationCredential* _credential_,
753  const client::JsonCppArray<string >& q);
754 
759 
760 
770  virtual util::Status AppendVariable(
771  const StringPiece& variable_name,
772  const client::UriTemplateConfig& config,
773  string* target);
774 
780  virtual util::Status AppendOptionalQueryParameters(string* target);
781 
782 
793  util::Status ExecuteAndParseResponse(
794  DetectionsListResponse* data) {
795  return TranslateServiceBaseRequest::ExecuteAndParseResponse(data);
796  }
797 
798  private:
799  client::JsonCppArray<string > q_;
800  DISALLOW_COPY_AND_ASSIGN(DetectionsResource_ListMethod);
801 };
802 
803 
804 
819  public:
828  const TranslateService* _service_,
829  client::AuthorizationCredential* _credential_);
830 
834  virtual ~LanguagesResource_ListMethod();
835 
836 
840  void clear_model() {
841  _have_model_ = false;
842  client::ClearCppValueHelper(&model_);
843  }
844 
845 
851  const string& get_model() const { return model_; }
852 
858  string* mutable_model() {
859  _have_model_ = true;
860  return &model_;
861  }
862 
863 
870  void set_model(const string& value) {
871  _have_model_ = true;
872  model_ = value;
873  }
874 
875 
876 
880  void clear_target() {
881  _have_target_ = false;
882  client::ClearCppValueHelper(&target_);
883  }
884 
885 
891  const string& get_target() const { return target_; }
892 
898  string* mutable_target() {
899  _have_target_ = true;
900  return &target_;
901  }
902 
903 
911  void set_target(const string& value) {
912  _have_target_ = true;
913  target_ = value;
914  }
915 
925  virtual util::Status AppendVariable(
926  const StringPiece& variable_name,
927  const client::UriTemplateConfig& config,
928  string* target);
929 
935  virtual util::Status AppendOptionalQueryParameters(string* target);
936 
937 
948  util::Status ExecuteAndParseResponse(
949  LanguagesListResponse* data) {
950  return TranslateServiceBaseRequest::ExecuteAndParseResponse(data);
951  }
952 
953  private:
954  string model_;
955  string target_;
956  bool _have_model_ : 1;
957  bool _have_target_ : 1;
958  DISALLOW_COPY_AND_ASSIGN(LanguagesResource_ListMethod);
959 };
960 
961 
962 
977  public:
992  const TranslateService* _service_,
993  client::AuthorizationCredential* _credential_,
994  const client::JsonCppArray<string >& q,
995  const StringPiece& target);
996 
1001 
1002 
1006  void clear_cid() {
1007  _have_cid_ = false;
1008  client::ClearCppValueHelper(&cid_);
1009  }
1010 
1011 
1017  const client::JsonCppArray<string >& get_cid() const { return cid_; }
1018 
1024  client::JsonCppArray<string >* mutable_cid() {
1025  _have_cid_ = true;
1026  return &cid_;
1027  }
1028 
1029 
1030 
1034  void clear_format() {
1035  _have_format_ = false;
1036  client::ClearCppValueHelper(&format_);
1037  }
1038 
1039 
1045  const string& get_format() const { return format_; }
1046 
1052  string* mutable_format() {
1053  _have_format_ = true;
1054  return &format_;
1055  }
1056 
1057 
1066  void set_format(const string& value) {
1067  _have_format_ = true;
1068  format_ = value;
1069  }
1070 
1071 
1072 
1076  void clear_model() {
1077  _have_model_ = false;
1078  client::ClearCppValueHelper(&model_);
1079  }
1080 
1081 
1087  const string& get_model() const { return model_; }
1088 
1094  string* mutable_model() {
1095  _have_model_ = true;
1096  return &model_;
1097  }
1098 
1099 
1107  void set_model(const string& value) {
1108  _have_model_ = true;
1109  model_ = value;
1110  }
1111 
1112 
1113 
1117  void clear_source() {
1118  _have_source_ = false;
1119  client::ClearCppValueHelper(&source_);
1120  }
1121 
1122 
1128  const string& get_source() const { return source_; }
1129 
1135  string* mutable_source() {
1136  _have_source_ = true;
1137  return &source_;
1138  }
1139 
1140 
1151  void set_source(const string& value) {
1152  _have_source_ = true;
1153  source_ = value;
1154  }
1155 
1165  virtual util::Status AppendVariable(
1166  const StringPiece& variable_name,
1167  const client::UriTemplateConfig& config,
1168  string* target);
1169 
1175  virtual util::Status AppendOptionalQueryParameters(string* target);
1176 
1177 
1188  util::Status ExecuteAndParseResponse(
1189  TranslationsListResponse* data) {
1190  return TranslateServiceBaseRequest::ExecuteAndParseResponse(data);
1191  }
1192 
1193  private:
1194  client::JsonCppArray<string > q_;
1195  string target_;
1196  client::JsonCppCapsule< client::JsonCppArray<string > > cid_;
1197  string format_;
1198  string model_;
1199  string source_;
1200  bool _have_cid_ : 1;
1201  bool _have_format_ : 1;
1202  bool _have_model_ : 1;
1203  bool _have_source_ : 1;
1204  DISALLOW_COPY_AND_ASSIGN(TranslationsResource_ListMethod);
1205 };
1206 
1221  public:
1231  const TranslateService* _service_,
1232  client::AuthorizationCredential* _credential_,
1233  const TranslateTextRequest& _content_);
1234 
1239 
1250  util::Status ExecuteAndParseResponse(
1251  TranslationsListResponse* data) {
1252  return TranslateServiceBaseRequest::ExecuteAndParseResponse(data);
1253  }
1254 
1255  private:
1256  string _content_;
1257  DISALLOW_COPY_AND_ASSIGN(TranslationsResource_TranslateMethod);
1258 };
1259 
1260 
1261 
1270 class TranslateService : public client::ClientService {
1271  public:
1275  static const char googleapis_API_NAME[];
1276 
1280  static const char googleapis_API_VERSION[];
1281 
1285  static const char googleapis_API_GENERATOR[];
1286 
1287 
1294  public:
1302  explicit DetectionsResource(TranslateService* service);
1303 
1308 
1309 
1319  DetectionsResource_DetectMethod* NewDetectMethod(
1320  client::AuthorizationCredential* _credential_,
1321  const DetectLanguageRequest& _content_) const;
1322 
1334  DetectionsResource_ListMethod* NewListMethod(
1335  client::AuthorizationCredential* _credential_,
1336  const client::JsonCppArray<string >& q) const;
1337 
1338  private:
1339  TranslateService* service_;
1340 
1341  DISALLOW_COPY_AND_ASSIGN(DetectionsResource);
1342  };
1343 
1350  public:
1358  explicit LanguagesResource(TranslateService* service);
1359 
1364 
1365 
1374  LanguagesResource_ListMethod* NewListMethod(
1375  client::AuthorizationCredential* _credential_) const;
1376 
1377  private:
1378  TranslateService* service_;
1379 
1380  DISALLOW_COPY_AND_ASSIGN(LanguagesResource);
1381  };
1382 
1389  public:
1397  explicit TranslationsResource(TranslateService* service);
1398 
1403 
1404 
1419  TranslationsResource_ListMethod* NewListMethod(
1420  client::AuthorizationCredential* _credential_,
1421  const client::JsonCppArray<string >& q,
1422  const StringPiece& target) const;
1423 
1433  TranslationsResource_TranslateMethod* NewTranslateMethod(
1434  client::AuthorizationCredential* _credential_,
1435  const TranslateTextRequest& _content_) const;
1436 
1437  private:
1438  TranslateService* service_;
1439 
1440  DISALLOW_COPY_AND_ASSIGN(TranslationsResource);
1441  };
1442 
1443 
1444 
1451  explicit TranslateService(client::HttpTransport* transport);
1452 
1456  virtual ~TranslateService();
1457 
1464  return detections_;
1465  }
1466 
1467 
1474  return languages_;
1475  }
1476 
1477 
1484  return translations_;
1485  }
1486 
1493  class SCOPES {
1494  public:
1498  static const char CLOUD_PLATFORM[];
1499 
1503  static const char CLOUD_TRANSLATION[];
1504 
1505  private:
1506  SCOPES(); // Never instantiated.
1507  ~SCOPES(); // Never instantiated.
1508  };
1509 
1510  private:
1511  DetectionsResource detections_;
1512  LanguagesResource languages_;
1513  TranslationsResource translations_;
1514 
1515  DISALLOW_COPY_AND_ASSIGN(TranslateService);
1516 };
1517 
1518 
1549 } // namespace google_translate_api
1550 #endif // GOOGLE_TRANSLATE_API_TRANSLATE_SERVICE_H_