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
// MIT License
//
// Copyright (c) 2020 Ankur Srivastava
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Deserialize, Serialize, Debug, Default)]
pub struct UserAuth {
	pub state: String,
	pub token: String,
	pub user_email: String,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct ResUserPasswordChange {
	// pub message: Option<String>,
	pub token: String,
	// pub user_email: String,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct ResCompleteOTPConfig {
	// pub message: Option<String>,
	pub token: String,
	pub method: String,
	// pub user_email: String,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct ResConfigure2fa {
	// pub message: Option<String>,
	pub qrcode: String,
	pub uri: String,
	pub method: String,
	// pub user_email: String,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct ResConfirmUseremailAddress {
	// pub message: Option<String>,
	pub invite_details: UserEmail,
	// pub user_email: String,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct ResConfirmPasswordReset {
	// pub message: Option<String>,
	pub invite_details: UserEmail,
	// pub user_email: String,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct UserEmail {
	pub user_email: String,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct UserAuthLoginOptions {
	pub action: String,
	pub method: Option<String>,
	pub name: Option<String>,
	pub redirect_url: Option<String>,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct UserInfo {
	pub user: User,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct Invitation {
	pub invite_code: String,
	pub invite_time: String,
	pub inviting_user_email: String,
	pub project_name: String,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct User {
	pub auth: Vec<String>,
	pub create_time: String,
	pub features: Option<HashMap<String, String>>,
	pub intercom: Option<HashMap<String, String>>,
	pub invitations: Vec<Invitation>,
	pub project_membership: HashMap<String, String>,
	pub projects: Vec<String>,
	pub real_name: String,
	pub state: String,
	pub token_validity_begin: String,
	pub user: String,
	pub user_id: String,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct AccessToken {
	pub create_time: String,
	pub created_manually: bool,
	pub currently_active: bool,
	pub description: Option<String>,
	pub expiry_time: Option<String>,
	pub extend_when_used: bool,
	pub full_token: Option<String>,
	pub last_ip: Option<String>,
	pub last_used_time: Option<String>,
	pub last_user_agent: Option<String>,
	pub last_user_agent_human_readable: Option<String>,
	pub max_age_seconds: Option<i64>,
	pub token_prefix: Option<String>,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct AccessTokens {
	pub tokens: Vec<AccessToken>,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct AuthenticationMethod {
	pub authentication_method_account_id: String,
	pub create_time: String,
	pub currently_active: bool,
	pub delete_time: String,
	pub last_used_time: String,
	pub method_id: String,
	pub name: String,
	pub public_remote_identity: String,
	pub remote_provider_id: String,
	pub state: String,
	pub update_time: String,
	pub user_email: String,
}
#[derive(Deserialize, Serialize, Debug, Default)]
pub struct AuthenticationMethods {
	pub authentication_methods: Vec<AuthenticationMethod>,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct ResUserCreate {
	pub state: String,
	pub token: String,
	pub user: User,
	pub user_email: String,
}

#[derive(Deserialize, Serialize, Debug, Default)]
pub struct UserCreateConfig {
	pub credit_code: String,
	pub email: String,
	pub email_communication_categories: Vec<String>,
	pub origin: String,
	pub password: String,
	pub real_name: String,
	pub token: String,
}