oauth2  v2
oauth2_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: 2018-10-08 17:45:39 UTC
18 // on: 2020-03-23, 20:41:13 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_OAUTH2_API_OAUTH2_SERVICE_H_
25 #define GOOGLE_OAUTH2_API_OAUTH2_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/oauth2_api/tokeninfo.h"
34 #include "google/oauth2_api/userinfo.h"
35 
36 
37 namespace google_oauth2_api {
38 using namespace googleapis;
69 class Oauth2Service;
70 
79  : public client::ClientServiceRequest {
80  public:
103  const client::ClientService* service,
104  client::AuthorizationCredential* credential,
105  client::HttpRequest::HttpMethod method,
106  const StringPiece& uri_template);
107 
111  virtual ~Oauth2ServiceBaseRequest();
112 
113 
117  void clear_alt() {
118  _have_alt_ = false;
119  client::ClearCppValueHelper(&alt_);
120  }
121 
122 
128  const string& get_alt() const { return alt_; }
129 
135  string* mutable_alt() {
136  _have_alt_ = true;
137  return &alt_;
138  }
139 
140 
146  void set_alt(const string& value) {
147  _have_alt_ = true;
148  alt_ = value;
149  }
150 
151 
152 
156  void clear_fields() {
157  _have_fields_ = false;
158  client::ClearCppValueHelper(&fields_);
159  }
160 
161 
167  const string& get_fields() const { return fields_; }
168 
174  string* mutable_fields() {
175  _have_fields_ = true;
176  return &fields_;
177  }
178 
179 
186  void set_fields(const string& value) {
187  _have_fields_ = true;
188  fields_ = value;
189  }
190 
191 
192 
196  void clear_key() {
197  _have_key_ = false;
198  client::ClearCppValueHelper(&key_);
199  }
200 
201 
207  const string& get_key() const { return key_; }
208 
214  string* mutable_key() {
215  _have_key_ = true;
216  return &key_;
217  }
218 
219 
227  void set_key(const string& value) {
228  _have_key_ = true;
229  key_ = value;
230  }
231 
232 
233 
238  _have_oauth_token_ = false;
239  client::ClearCppValueHelper(&oauth_token_);
240  }
241 
242 
248  const string& get_oauth_token() const { return oauth_token_; }
249 
256  string* mutable_oauthToken() {
257  _have_oauth_token_ = true;
258  return &oauth_token_;
259  }
260 
261 
267  void set_oauth_token(const string& value) {
268  _have_oauth_token_ = true;
269  oauth_token_ = value;
270  }
271 
272 
273 
278  _have_pretty_print_ = false;
279  client::ClearCppValueHelper(&pretty_print_);
280  }
281 
282 
288  bool get_pretty_print() const { return pretty_print_; }
289 
295  void set_pretty_print(bool value) {
296  _have_pretty_print_ = true;
297  pretty_print_ = value;
298  }
299 
304  _have_quota_user_ = false;
305  client::ClearCppValueHelper(&quota_user_);
306  }
307 
308 
314  const string& get_quota_user() const { return quota_user_; }
315 
322  string* mutable_quotaUser() {
323  _have_quota_user_ = true;
324  return &quota_user_;
325  }
326 
327 
334  void set_quota_user(const string& value) {
335  _have_quota_user_ = true;
336  quota_user_ = value;
337  }
338 
339 
340 
344  void clear_user_ip() {
345  _have_user_ip_ = false;
346  client::ClearCppValueHelper(&user_ip_);
347  }
348 
349 
355  const string& get_user_ip() const { return user_ip_; }
356 
362  string* mutable_userIp() {
363  _have_user_ip_ = true;
364  return &user_ip_;
365  }
366 
367 
374  void set_user_ip(const string& value) {
375  _have_user_ip_ = true;
376  user_ip_ = value;
377  }
378 
389  virtual util::Status AppendVariable(
390  const StringPiece& variable_name,
391  const client::UriTemplateConfig& config,
392  string* target);
393 
399  virtual util::Status AppendOptionalQueryParameters(string* target);
400 
401 
402  protected:
408  void AddJsonContentToRequest(const client::JsonCppData *content);
409 
410  private:
411  string alt_;
412  string fields_;
413  string key_;
414  string oauth_token_;
415  bool pretty_print_;
416  string quota_user_;
417  string user_ip_;
418  bool _have_alt_ : 1;
419  bool _have_fields_ : 1;
420  bool _have_key_ : 1;
421  bool _have_oauth_token_ : 1;
422  bool _have_pretty_print_ : 1;
423  bool _have_quota_user_ : 1;
424  bool _have_user_ip_ : 1;
425 
426  DISALLOW_COPY_AND_ASSIGN(Oauth2ServiceBaseRequest);
427 };
428 
429 
430 
446  public:
455  const Oauth2Service* _service_,
456  client::AuthorizationCredential* _credential_);
457 
461  virtual ~UserinfoResource_GetMethod();
462 
474  Userinfo* data) {
475  return Oauth2ServiceBaseRequest::ExecuteAndParseResponse(data);
476  }
477 
478  private:
479  DISALLOW_COPY_AND_ASSIGN(UserinfoResource_GetMethod);
480 };
481 
482 
483 
484 
485 
486 
487 
503  public:
512  const Oauth2Service* _service_,
513  client::AuthorizationCredential* _credential_);
514 
519 
531  Userinfo* data) {
532  return Oauth2ServiceBaseRequest::ExecuteAndParseResponse(data);
533  }
534 
535  private:
536  DISALLOW_COPY_AND_ASSIGN(UserinfoResource_V2Resource_MeResource_GetMethod);
537 };
538 
551  public:
560  const Oauth2Service* _service_,
561  client::AuthorizationCredential* _credential_);
562 
566  virtual ~TokeninfoMethod();
567 
568 
573  _have_access_token_ = false;
574  client::ClearCppValueHelper(&access_token_);
575  }
576 
577 
583  const string& get_access_token() const { return access_token_; }
584 
592  _have_access_token_ = true;
593  return &access_token_;
594  }
595 
596 
602  void set_access_token(const string& value) {
603  _have_access_token_ = true;
604  access_token_ = value;
605  }
606 
607 
608 
612  void clear_id_token() {
613  _have_id_token_ = false;
614  client::ClearCppValueHelper(&id_token_);
615  }
616 
617 
623  const string& get_id_token() const { return id_token_; }
624 
631  string* mutable_idToken() {
632  _have_id_token_ = true;
633  return &id_token_;
634  }
635 
636 
642  void set_id_token(const string& value) {
643  _have_id_token_ = true;
644  id_token_ = value;
645  }
646 
656  virtual util::Status AppendVariable(
657  const StringPiece& variable_name,
658  const client::UriTemplateConfig& config,
659  string* target);
660 
666  virtual util::Status AppendOptionalQueryParameters(string* target);
667 
668 
680  Tokeninfo* data) {
681  return Oauth2ServiceBaseRequest::ExecuteAndParseResponse(data);
682  }
683 
684  private:
685  string access_token_;
686  string id_token_;
687  bool _have_access_token_ : 1;
688  bool _have_id_token_ : 1;
689  DISALLOW_COPY_AND_ASSIGN(TokeninfoMethod);
690 };
691 
700 class Oauth2Service : public client::ClientService {
701  public:
705  static const char googleapis_API_NAME[];
706 
710  static const char googleapis_API_VERSION[];
711 
715  static const char googleapis_API_GENERATOR[];
716 
717 
724  public:
732  explicit UserinfoResource(Oauth2Service* service);
733 
738 
744  class V2Resource {
745  public:
753  explicit V2Resource(Oauth2Service* service);
754 
759 
765  class MeResource {
766  public:
774  explicit MeResource(Oauth2Service* service);
775 
780 
781 
792  client::AuthorizationCredential* _credential_) const;
793 
794  private:
795  Oauth2Service* service_;
796 
797  DISALLOW_COPY_AND_ASSIGN(MeResource);
798  };
804  const MeResource& get_me() const {
805  return me_;
806  }
807 
808 
809 
810  private:
811  Oauth2Service* service_;
812  MeResource me_;
813 
814  DISALLOW_COPY_AND_ASSIGN(V2Resource);
815  };
821  const V2Resource& get_v2() const {
822  return v2_;
823  }
824 
825 
826 
835  UserinfoResource_GetMethod* NewGetMethod(
836  client::AuthorizationCredential* _credential_) const;
837 
838  private:
839  Oauth2Service* service_;
840  V2Resource v2_;
841 
842  DISALLOW_COPY_AND_ASSIGN(UserinfoResource);
843  };
844 
853 TokeninfoMethod* NewTokeninfoMethod(
854  client::AuthorizationCredential* _credential_) const;
855 
862  explicit Oauth2Service(client::HttpTransport* transport);
863 
867  virtual ~Oauth2Service();
868 
875  return userinfo_;
876  }
877 
884  class SCOPES {
885  public:
889  static const char USERINFO_EMAIL[];
890 
895  static const char USERINFO_PROFILE[];
896 
900  static const char OPENID[];
901 
902  private:
903  SCOPES(); // Never instantiated.
904  ~SCOPES(); // Never instantiated.
905  };
906 
907  private:
908  UserinfoResource userinfo_;
909 
910  DISALLOW_COPY_AND_ASSIGN(Oauth2Service);
911 };
912 
913 
944 } // namespace google_oauth2_api
945 #endif // GOOGLE_OAUTH2_API_OAUTH2_SERVICE_H_
string * mutable_alt()
Definition: oauth2_service.h:135
util::Status ExecuteAndParseResponse(Userinfo *data)
Definition: oauth2_service.h:530
void clear_quota_user()
Definition: oauth2_service.h:303
Definition: tokeninfo.h:51
const UserinfoResource & get_userinfo() const
Definition: oauth2_service.h:874
void set_quota_user(const string &value)
Definition: oauth2_service.h:334
const string & get_access_token() const
Definition: oauth2_service.h:583
const V2Resource & get_v2() const
Definition: oauth2_service.h:821
void clear_access_token()
Definition: oauth2_service.h:572
const string & get_key() const
Definition: oauth2_service.h:207
util::Status ExecuteAndParseResponse(Userinfo *data)
Definition: oauth2_service.h:473
void set_pretty_print(bool value)
Definition: oauth2_service.h:295
const MeResource & get_me() const
Definition: oauth2_service.h:804
bool get_pretty_print() const
Definition: oauth2_service.h:288
const string & get_user_ip() const
Definition: oauth2_service.h:355
string * mutable_idToken()
Definition: oauth2_service.h:631
void clear_alt()
Definition: oauth2_service.h:117
string * mutable_fields()
Definition: oauth2_service.h:174
string * mutable_oauthToken()
Definition: oauth2_service.h:256
const string & get_alt() const
Definition: oauth2_service.h:128
const string & get_quota_user() const
Definition: oauth2_service.h:314
const string & get_id_token() const
Definition: oauth2_service.h:623
Definition: oauth2_service.h:78
util::Status ExecuteAndParseResponse(Tokeninfo *data)
Definition: oauth2_service.h:679
void clear_pretty_print()
Definition: oauth2_service.h:277
void set_id_token(const string &value)
Definition: oauth2_service.h:642
string * mutable_key()
Definition: oauth2_service.h:214
~UserinfoResource()
Definition: oauth2_service.h:737
string * mutable_quotaUser()
Definition: oauth2_service.h:322
Definition: oauth2_service.h:445
void clear_fields()
Definition: oauth2_service.h:156
Definition: oauth2_service.h:884
void clear_oauth_token()
Definition: oauth2_service.h:237
void set_alt(const string &value)
Definition: oauth2_service.h:146
void set_user_ip(const string &value)
Definition: oauth2_service.h:374
void set_key(const string &value)
Definition: oauth2_service.h:227
void clear_id_token()
Definition: oauth2_service.h:612
const string & get_fields() const
Definition: oauth2_service.h:167
void set_oauth_token(const string &value)
Definition: oauth2_service.h:267
Definition: oauth2_service.h:700
Definition: oauth2_service.h:550
Definition: userinfo.h:50
void clear_key()
Definition: oauth2_service.h:196
string * mutable_userIp()
Definition: oauth2_service.h:362
void set_access_token(const string &value)
Definition: oauth2_service.h:602
string * mutable_accessToken()
Definition: oauth2_service.h:591
const string & get_oauth_token() const
Definition: oauth2_service.h:248
void clear_user_ip()
Definition: oauth2_service.h:344
Definition: oauth2_service.cc:40
void set_fields(const string &value)
Definition: oauth2_service.h:186