24 #ifndef GOOGLE_TRANSLATE_API_TRANSLATE_SERVICE_H_
25 #define GOOGLE_TRANSLATE_API_TRANSLATE_SERVICE_H_
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"
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"
40 namespace google_translate_api {
41 using namespace googleapis;
72 class TranslateService;
82 :
public client::ClientServiceRequest {
106 const client::ClientService* service,
107 client::AuthorizationCredential* credential,
108 client::HttpRequest::HttpMethod method,
109 const StringPiece& uri_template);
121 _have_xgafv_ =
false;
122 client::ClearCppValueHelper(&xgafv_);
160 _have_access_token_ =
false;
161 client::ClearCppValueHelper(&access_token_);
179 _have_access_token_ =
true;
180 return &access_token_;
190 _have_access_token_ =
true;
191 access_token_ = value;
201 client::ClearCppValueHelper(&alt_);
210 const string&
get_alt()
const {
return alt_; }
239 _have_bearer_token_ =
false;
240 client::ClearCppValueHelper(&bearer_token_);
258 _have_bearer_token_ =
true;
259 return &bearer_token_;
269 _have_bearer_token_ =
true;
270 bearer_token_ = value;
279 _have_callback_ =
false;
280 client::ClearCppValueHelper(&callback_);
297 _have_callback_ =
true;
308 _have_callback_ =
true;
318 _have_fields_ =
false;
319 client::ClearCppValueHelper(&fields_);
336 _have_fields_ =
true;
348 _have_fields_ =
true;
359 client::ClearCppValueHelper(&key_);
368 const string&
get_key()
const {
return key_; }
399 _have_oauth_token_ =
false;
400 client::ClearCppValueHelper(&oauth_token_);
418 _have_oauth_token_ =
true;
419 return &oauth_token_;
429 _have_oauth_token_ =
true;
430 oauth_token_ = value;
440 client::ClearCppValueHelper(&pp_);
465 _have_pretty_print_ =
false;
466 client::ClearCppValueHelper(&pretty_print_);
483 _have_pretty_print_ =
true;
484 pretty_print_ = value;
491 _have_quota_user_ =
false;
492 client::ClearCppValueHelper("a_user_);
510 _have_quota_user_ =
true;
523 _have_quota_user_ =
true;
533 _have_upload_type_ =
false;
534 client::ClearCppValueHelper(&upload_type_);
552 _have_upload_type_ =
true;
553 return &upload_type_;
564 _have_upload_type_ =
true;
565 upload_type_ = value;
574 _have_upload_protocol_ =
false;
575 client::ClearCppValueHelper(&upload_protocol_);
593 _have_upload_protocol_ =
true;
594 return &upload_protocol_;
604 _have_upload_protocol_ =
true;
605 upload_protocol_ = value;
618 virtual util::Status AppendVariable(
619 const StringPiece& variable_name,
620 const client::UriTemplateConfig& config,
628 virtual util::Status AppendOptionalQueryParameters(
string* target);
637 void AddJsonContentToRequest(
const client::JsonCppData *content);
641 string access_token_;
643 string bearer_token_;
652 string upload_protocol_;
653 bool _have_xgafv_ : 1;
654 bool _have_access_token_ : 1;
656 bool _have_bearer_token_ : 1;
657 bool _have_callback_ : 1;
658 bool _have_fields_ : 1;
660 bool _have_oauth_token_ : 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;
697 client::AuthorizationCredential* _credential_,
715 util::Status ExecuteAndParseResponse(
717 return TranslateServiceBaseRequest::ExecuteAndParseResponse(data);
752 client::AuthorizationCredential* _credential_,
753 const client::JsonCppArray<string >& q);
770 virtual util::Status AppendVariable(
771 const StringPiece& variable_name,
772 const client::UriTemplateConfig& config,
780 virtual util::Status AppendOptionalQueryParameters(
string* target);
793 util::Status ExecuteAndParseResponse(
795 return TranslateServiceBaseRequest::ExecuteAndParseResponse(data);
799 client::JsonCppArray<string > q_;
829 client::AuthorizationCredential* _credential_);
841 _have_model_ =
false;
842 client::ClearCppValueHelper(&model_);
881 _have_target_ =
false;
882 client::ClearCppValueHelper(&target_);
899 _have_target_ =
true;
912 _have_target_ =
true;
925 virtual util::Status AppendVariable(
926 const StringPiece& variable_name,
927 const client::UriTemplateConfig& config,
935 virtual util::Status AppendOptionalQueryParameters(
string* target);
948 util::Status ExecuteAndParseResponse(
950 return TranslateServiceBaseRequest::ExecuteAndParseResponse(data);
956 bool _have_model_ : 1;
957 bool _have_target_ : 1;
993 client::AuthorizationCredential* _credential_,
994 const client::JsonCppArray<string >& q,
995 const StringPiece& target);
1008 client::ClearCppValueHelper(&cid_);
1017 const client::JsonCppArray<string >&
get_cid()
const {
return cid_; }
1035 _have_format_ =
false;
1036 client::ClearCppValueHelper(&format_);
1053 _have_format_ =
true;
1067 _have_format_ =
true;
1077 _have_model_ =
false;
1078 client::ClearCppValueHelper(&model_);
1095 _have_model_ =
true;
1108 _have_model_ =
true;
1118 _have_source_ =
false;
1119 client::ClearCppValueHelper(&source_);
1136 _have_source_ =
true;
1152 _have_source_ =
true;
1165 virtual util::Status AppendVariable(
1166 const StringPiece& variable_name,
1167 const client::UriTemplateConfig& config,
1175 virtual util::Status AppendOptionalQueryParameters(
string* target);
1188 util::Status ExecuteAndParseResponse(
1190 return TranslateServiceBaseRequest::ExecuteAndParseResponse(data);
1194 client::JsonCppArray<string > q_;
1196 client::JsonCppCapsule< client::JsonCppArray<string > > cid_;
1200 bool _have_cid_ : 1;
1201 bool _have_format_ : 1;
1202 bool _have_model_ : 1;
1203 bool _have_source_ : 1;
1232 client::AuthorizationCredential* _credential_,
1250 util::Status ExecuteAndParseResponse(
1252 return TranslateServiceBaseRequest::ExecuteAndParseResponse(data);
1275 static const char googleapis_API_NAME[];
1280 static const char googleapis_API_VERSION[];
1285 static const char googleapis_API_GENERATOR[];
1320 client::AuthorizationCredential* _credential_,
1335 client::AuthorizationCredential* _credential_,
1336 const client::JsonCppArray<string >& q)
const;
1375 client::AuthorizationCredential* _credential_)
const;
1420 client::AuthorizationCredential* _credential_,
1421 const client::JsonCppArray<string >& q,
1422 const StringPiece& target)
const;
1434 client::AuthorizationCredential* _credential_,
1484 return translations_;
1498 static const char CLOUD_PLATFORM[];
1503 static const char CLOUD_TRANSLATION[];
1550 #endif // GOOGLE_TRANSLATE_API_TRANSLATE_SERVICE_H_