· 6 years ago · Mar 18, 2019, 07:36 AM
1/*
2 *
3 * _________MOBSTING S.A.L. STRICTLY CONFIDENTIAL_____________
4 *
5 * Copyright (C) 2015-2019, Mobsting S.A.L. - All Rights Reserved - Proprietary
6 * and Strictly Confidential
7 * www.mobsting.com (mobsting@mobsting.com)
8 * This file is part of the Mobsting AnchorTV project
9 * Unauthorized copying of this file, via any medium is strictly prohibited
10 * *****************************************************************************
11 * Redistribution and use in source and/or in binary forms, with or without
12 * modification, are not permitted in any way.
13 * NOTICE: All information contained herein is, and remains the property of
14 * Mobsting S.A.L and its subsidiaries, if any.
15 * The intellectual and technical concepts contained herein are proprietary to
16 * Mobsting S.A.L and its subsidiaries, if any, and may be covered by U.S. and
17 * Foreign Patents, patents in process, and are protected by trade secret or
18 * copyright law. Dissemination of this information or reproduction of this
19 * material is strictly forbidden unless prior written permission is obtained
20 * from Mobsting S.A.L.
21 * *****************************************************************************
22 *
23 * THIS FILE IS AUTOMATICALLY GENERATED BY TOOLS
24 * DO NOT EDIT THIS FILE!
25 *
26 * *****************************************************************************
27 */
28@file:Suppress("unused")
29
30package com.mobsting.anchortv.api.entities.outer
31
32enum class ErrorCodes(val v: Int) {
33
34 UnknownError(-1),
35 Succeeded(0),
36
37 ;
38
39 operator fun invoke(): Int = ordinal
40
41 companion object {
42 fun find(index: Int): ErrorCodes? = when (index) {
43
44 -1 -> UnknownError
45 0 -> Succeeded
46
47 else -> null
48 }
49 }
50
51}
52
53
54/*
55 * This is the base entity of all entities that support session.
56 * The "res" section defines the default response entity.
57 *
58 * signature types could be one of:
59 * "ac" - for account name login
60 * "em" - for email login
61 * "ph" - for phone login
62 * "sns-*" - for SNS login
63 *
64 * signature = SHA( timestamp + content + secretKey )
65 * secretKey = signatureType + ":" + identity + ":" + secret
66 *
67 * | sig type | identity | secret
68 * --------+----------+-------------------+-----------
69 * account | 'ac' | user account name | user password
70 * email | 'em' | email address | user password
71 * phone | 'ph' | phone number | verify code
72 * SNS_* | 'sns-*' | SNS identity | SNS token
73
74 */
75data class ReqSessioned(
76
77 val protocolVersion: Int = 1,
78 val acceptlan: String,
79 val senttime: String,
80 val clientType: String,
81 val userID: String,
82 val signatureType: String,
83 val signature: String,
84 val content: String?
85)
86
87/*
88 * This is the base entity of all entities that support session.
89 * The "res" section defines the default response entity.
90 *
91 * signature types could be one of:
92 * "ac" - for account name login
93 * "em" - for email login
94 * "ph" - for phone login
95 * "sns-*" - for SNS login
96 *
97 * signature = SHA( timestamp + content + secretKey )
98 * secretKey = signatureType + ":" + identity + ":" + secret
99 *
100 * | sig type | identity | secret
101 * --------+----------+-------------------+-----------
102 * account | 'ac' | user account name | user password
103 * email | 'em' | email address | user password
104 * phone | 'ph' | phone number | verify code
105 * SNS_* | 'sns-*' | SNS identity | SNS token
106
107 */
108data class ResSessioned(
109
110 val protocolVersion: Int = 1,
111 val code: Int,
112 val msglan: String?,
113 val message: String?,
114 val senttime: String,
115 val content: String?
116)
117
118/*
119 * This is a dummy response, result reply on outer code and message.
120 */
121data class ResDummy(
122
123 val protocolVersion: Int = 1,
124 val code: Int,
125 val msglan: String?,
126 val message: String?,
127 val senttime: String
128)
129
130data class SplashPage(
131
132 val text1: String,
133 val text2: String,
134 val lan: String?,
135 val picture: String,
136 val pictureId: String,
137 var isLoaded: Boolean = false
138)
139
140/*
141 * A simple process to retrieve splash screen infos.
142 * This process shall be used in [splash screens]
143
144 */
145data class ReqGetSplash(
146
147 val protocolVersion: Int = 1,
148 val acceptlan: String,
149 val senttime: String,
150 val clientType: String
151)
152
153/*
154 * A simple process to retrieve splash screen infos.
155 * This process shall be used in [splash screens]
156 * Client shall:
157 * 1) Store ID of this package locally, after displayed this package.
158 * 2) After downloading from the server, the client shall compare the ID of the new package and
159 * the old package stored locally.
160 * *) If they are the same, client shall skip the splash screen.
161 * *) If they are not the same, client shall show the splash screen.
162 */
163data class ResGetSplash(
164 val protocolVersion: Int = 1,
165 val code: Int,
166 val msglan: String?,
167 val message: String?,
168 val senttime: String,
169 val id: String,
170 val pages: List<SplashPage>,
171 var isShown: Boolean = false
172)
173
174/*
175 * Client sent this entity to server to request server to send a verify code to client's phone through SMS.
176 * This process shall be used in
177 * [login screen],
178 * [sign-up screen],
179 * [forgot password screen],
180 * [bind SNS screen]
181 *
182 * NOTE:
183 * - When server received this package, it will update the verify code associated with this phone
184 * number immediately.
185 * - If the server didn't receive valid verify code in 60 seconds, the verify code will expire.
186 */
187data class ReqRequestVerifyCode(
188
189 var protocolVersion: Int = 1,
190 val acceptlan: String,
191 val senttime: String,
192 val clientType: String,
193 val phoneNumber: String
194)
195
196/*
197 * After:
198 * - User inputted username/email + password
199 * - User inputted phone number + verify code
200 * - User authenticated using 3rd party SNS application.
201 *
202 * The client will generate a secret key and send to server.
203 * For more details about secret key, please refer to entity ReqSessioned.
204 *
205 * This process shall be used in [login screen].
206 */
207data class ReqLogin(
208
209 val protocolVersion: Int = 1,
210 val acceptlan: String,
211 val senttime: String,
212 val clientType: String,
213 val encrypted: Boolean = false,
214 val secretkey: String
215)
216
217/*
218 * After:
219 * - User inputted username/email + password
220 * - User inputted phone number + verify code
221 * - User authenticated using 3rd party SNS application.
222 *
223 * The client will generate a secret key and send to server.
224 * For more details about secret key, please refer to entity ReqSessioned.
225 *
226 * This process shall be used in [login screen].
227 */
228data class ResLogin(
229
230 val protocolVersion: Int = 1,
231 val code: Int,
232 val msglan: String?,
233 val message: String?,
234 val senttime: String,
235 val userID: String
236)
237
238/*
239 * Verify phone number for sign-up process.
240 * This process shall be used in [sign-up screen]
241 *
242 * This entity is the same like the login entity, except that the secretKey field must start with "ac"
243 * After successfully verified the phone number, instead of returning the userID, the server will return
244 * a temporary userID.
245 *
246 * Client can use this temporary userID, just like the permanent userID, to finish next sign-up processes.
247 * - to choose account name
248 * - to create password
249 * - to bind SNS
250 * To find details of those steps, please refer to inner packages' API docs.
251 */
252data class ReqVerifyPhoneForSignUp(
253
254 val protocolVersion: Int = 1,
255 val acceptlan: String,
256 val senttime: String,
257 val clientType: String,
258 val encrypted: Boolean = false,
259 val secretkey: String
260)
261
262/*
263 * Verify phone number for sign-up process.
264 * This process shall be used in [sign-up screen]
265 *
266 * This entity is the same like the login entity, except that the secretKey field must start with "ac"
267 * After successfully verified the phone number, instead of returning the userID, the server will return
268 * a temporary userID.
269 *
270 * Client can use this temporary userID, just like the permanent userID, to finish next sign-up processes.
271 * - to choose account name
272 * - to create password
273 * - to bind SNS
274 * To find details of those steps, please refer to inner packages' API docs.
275 */
276data class ResVerifyPhoneForSignUp(
277
278 val protocolVersion: Int = 1,
279 val code: Int,
280 val msglan: String?,
281 val message: String?,
282 val senttime: String,
283 val userID: String
284)
285
286val OUTER_PATH_TO_ENTITY_MAP = mapOf<String, Class<*>>(
287
288 "/login" to ReqLogin::class.java,
289 "/request_verify_code" to ReqRequestVerifyCode::class.java,
290 "/get_splash" to ReqGetSplash::class.java,
291 "/verify_phone_for_sign_up" to ReqVerifyPhoneForSignUp::class.java
292)
293val OUTER_ENTITY_TO_PATH = mapOf<Class<*>, String>(
294
295 ReqLogin::class.java to "/login",
296 ReqRequestVerifyCode::class.java to "/request_verify_code",
297 ReqGetSplash::class.java to "/get_splash",
298 ReqVerifyPhoneForSignUp::class.java to "/verify_phone_for_sign_up"
299)
300val OUTER_REQ_MAP = mapOf<Class<*>, Class<*>>(
301
302 ReqLogin::class.java to ResLogin::class.java,
303 ReqSessioned::class.java to ResSessioned::class.java,
304 ReqRequestVerifyCode::class.java to ResDummy::class.java,
305 ReqGetSplash::class.java to ResGetSplash::class.java,
306 ReqVerifyPhoneForSignUp::class.java to ResVerifyPhoneForSignUp::class.java
307)