NEC mBaaS Embedded SDK  6.2.0
 全て クラス ネームスペース ファイル 関数 変数 列挙型 列挙型の値
nb_user.h
説明を見る。
1 /*
2  * COPYRIGHT (C) 2017 NEC CORPORATION
3  *
4  * ALL RIGHTS RESERVED BY NEC CORPORATION, THIS PROGRAM
5  * MUST BE USED SOLELY FOR THE PURPOSE FOR WHICH IT WAS
6  * FURNISHED BY NEC CORPORATION, NO PART OF THIS PROGRAM
7  * MAY BE REPRODUCED OR DISCLOSED TO OTHERS, IN ANY FORM
8  * WITHOUT THE PRIOR WRITTEN PERMISSION OF NEC CORPORATION.
9  *
10  * NEC CONFIDENTIAL AND PROPRIETARY
11  */
12 
13 #ifndef NECBAAS_NBUSER_H
14 #define NECBAAS_NBUSER_H
15 
16 #include <string>
17 #include <memory>
18 #include <ctime>
19 #include "necbaas/nb_service.h"
20 #include "necbaas/nb_result.h"
21 #include "necbaas/nb_json_object.h"
22 #include "necbaas/internal/nb_user_entity.h"
23 
24 namespace necbaas {
25 
33 class NbUser {
34  public:
40  NbUser();
41 
46  explicit NbUser(const std::shared_ptr<NbService> &service);
47 
51  ~NbUser();
52 
66  static NbResult<NbUser> LoginWithUsername(const std::shared_ptr<NbService> &service, const std::string &username,
67  const std::string &password, int timeout = kRestTimeoutDefault);
81  static NbResult<NbUser> LoginWithEmail(const std::shared_ptr<NbService> &service, const std::string &email,
82  const std::string &password, int timeout = kRestTimeoutDefault);
83 
92  static NbResult<NbUser> Logout(const std::shared_ptr<NbService> &service, int timeout = kRestTimeoutDefault);
93 
103  static bool IsLoggedIn(const std::shared_ptr<NbService> &service);
104 
112  static std::time_t GetSessionTokenExpiration(const std::shared_ptr<NbService> &service);
113 
121  static const std::string GetSessionToken(const std::shared_ptr<NbService> &service);
122 
130  static NbUser GetCurrentUser(const std::shared_ptr<NbService> &service);
131 
138  static std::string ExportCurrentLogin(const std::shared_ptr<NbService> &service);
139 
153  static NbResultCode ImportCurrentLogin(const std::shared_ptr<NbService> &service, const std::string &import);
154 
161  void SetUserEntity(const NbUserEntity &entity);
162 
167  const std::string &GetUserName() const;
168 
173  const std::string &GetEmail() const;
174 
179  const NbJsonObject &GetOptions() const;
180 
185  std::vector<std::string> GetGroups() const;
186 
191  const std::string &GetUserId() const;
192 
198  std::tm GetCreatedTime() const;
199 
205  std::tm GetUpdatedTime() const;
206 
207  private:
208  std::shared_ptr<NbService> service_;
209  NbUserEntity user_entity_;
220  static NbResult<NbUser> Login(const std::shared_ptr<NbService> &service, const std::string &username,
221  const std::string &email, const std::string &password, int timeout);
222 
229  static void SetCurrentUser(const std::shared_ptr<NbService> &service, NbJsonObject json);
230 };
231 } // namespace necbaas
232 #endif // NECBAAS_NBUSER_H
~NbUser()
デストラクタ.
static std::string ExportCurrentLogin(const std::shared_ptr< NbService > &service)
ログインユーザのExport.
static NbUser GetCurrentUser(const std::shared_ptr< NbService > &service)
ログインユーザ情報取得.
const std::string & GetEmail() const
E-mail取得.
std::tm GetCreatedTime() const
ユーザ作成日時取得.
static NbResultCode ImportCurrentLogin(const std::shared_ptr< NbService > &service, const std::string &import)
ログインユーザのImport.
ユーザクラス.
Definition: nb_user.h:33
REST API処理結果クラス.
Definition: nb_result.h:32
static std::time_t GetSessionTokenExpiration(const std::shared_ptr< NbService > &service)
ログイン有効期限取得.
Jsonオブジェクト.
Definition: nb_json_object.h:34
const NbJsonObject & GetOptions() const
オプション取得.
std::vector< std::string > GetGroups() const
所属グループ取得.
static NbResult< NbUser > Logout(const std::shared_ptr< NbService > &service, int timeout=kRestTimeoutDefault)
ログアウト.
NbUser()
[内部処理用]
NbResultCode
処理結果コード.
Definition: nb_result_code.h:21
static const std::string GetSessionToken(const std::shared_ptr< NbService > &service)
セッショントークン取得.
const std::string & GetUserId() const
ユーザID取得.
static NbResult< NbUser > LoginWithUsername(const std::shared_ptr< NbService > &service, const std::string &username, const std::string &password, int timeout=kRestTimeoutDefault)
ログイン(ユーザ名).
static bool IsLoggedIn(const std::shared_ptr< NbService > &service)
ログイン状態確認.
const std::string & GetUserName() const
ユーザ名取得.
static NbResult< NbUser > LoginWithEmail(const std::shared_ptr< NbService > &service, const std::string &email, const std::string &password, int timeout=kRestTimeoutDefault)
ログイン(E-mail).
std::tm GetUpdatedTime() const
ユーザ更新日時取得.
void SetUserEntity(const NbUserEntity &entity)
[内部処理用]