Skip to content

Commit b51f6a8

Browse files
committed
Merge branch '42-generate-user-api' into 'master'
Resolve "Generate User API" Closes #42 See merge request pace/mobile/android/pace-cloud-sdk!43
2 parents 2fb1983 + 8cc07be commit b51f6a8

37 files changed

+2122
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* PLEASE DO NOT EDIT!
3+
*
4+
* Generated by SwagGen with Kotlin template.
5+
* https://github.com/pace/SwagGen
6+
*/
7+
8+
package cloud.pace.sdk.api.user
9+
10+
import cloud.pace.sdk.api.API
11+
12+
/** Welcome to the PACE User Management API documentation. This API is responsible for user related actions.
13+
# Handling Terms of Service
14+
PACE services often require the acceptance of *Terms of Service* to execute API actions. The terms are required for legal reasons. Some of the API surface may not require the acceptance of terms. Usually, the terms need to be accepted before doing manipulations like `DELETE`, `PUT`, `POST` and similar. If a service requires a user to accept the terms of service a `451 Unavailable For Legal Reasons` status code will be returned together with a `Location` header that indicates the terms that need to be accepted. The URL points to the [GetTerms](#operation/GetTerms) and can then be followed by the [AcceptTerms](#operation/AcceptTerms). The terms can be viewed and accepted with a regular browser.
15+
A simple way to assure that the *terms of service* are accepted, before the user does any action is, to call the [CheckTerms](#operation/CheckTerms) API before the application, together with a `redirectUri` to the next step of the application process.
16+
*/
17+
object UserAPI {
18+
19+
const val VERSION = "2020-4"
20+
internal val baseUrl = "${API.baseUrl}/user/$VERSION/"
21+
22+
class CredentialsAPI
23+
class PhoneAPI
24+
class PreferencesAPI
25+
class SessionsAPI
26+
class TOTPAPI
27+
class TermsAPI
28+
class UserAPI
29+
30+
val API.credentials: CredentialsAPI by lazy { CredentialsAPI() }
31+
val API.phone: PhoneAPI by lazy { PhoneAPI() }
32+
val API.preferences: PreferencesAPI by lazy { PreferencesAPI() }
33+
val API.sessions: SessionsAPI by lazy { SessionsAPI() }
34+
val API.totp: TOTPAPI by lazy { TOTPAPI() }
35+
val API.terms: TermsAPI by lazy { TermsAPI() }
36+
val API.user: UserAPI by lazy { UserAPI() }
37+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* PLEASE DO NOT EDIT!
3+
*
4+
* Generated by SwagGen with Kotlin template.
5+
* https://github.com/pace/SwagGen
6+
*/
7+
8+
package cloud.pace.sdk.api.user.generated.model
9+
10+
import com.google.gson.annotations.SerializedName
11+
import com.squareup.moshi.Json
12+
import moe.banana.jsonapi2.HasMany
13+
import moe.banana.jsonapi2.HasOne
14+
import moe.banana.jsonapi2.JsonApi
15+
import moe.banana.jsonapi2.Resource
16+
import java.util.*
17+
18+
class CreateOTP {
19+
20+
var expiresAt: Date? = null
21+
/* one time password */
22+
var otp: String? = null
23+
/* user account password */
24+
var password: String? = null
25+
/* user account PIN */
26+
var pin: String? = null
27+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* PLEASE DO NOT EDIT!
3+
*
4+
* Generated by SwagGen with Kotlin template.
5+
* https://github.com/pace/SwagGen
6+
*/
7+
8+
package cloud.pace.sdk.api.user.generated.model
9+
10+
import com.google.gson.annotations.SerializedName
11+
import com.squareup.moshi.Json
12+
import moe.banana.jsonapi2.HasMany
13+
import moe.banana.jsonapi2.HasOne
14+
import moe.banana.jsonapi2.JsonApi
15+
import moe.banana.jsonapi2.Resource
16+
import java.util.*
17+
18+
@JsonApi(type = "deviceTOTP")
19+
class DeviceTOTP : Resource() {
20+
21+
/* Algorithm to use for HMAC */
22+
var algorithm: Algorithm? = null
23+
/* Required length of the generated OTP */
24+
var digits: Int? = null
25+
/* user otp */
26+
var otp: String? = null
27+
/* user account password */
28+
var password: String? = null
29+
/* Number of seconds a TOTP hash is valid for. */
30+
var period: Int? = null
31+
/* user account PIN */
32+
var pin: String? = null
33+
/* TOTP secret to generate TOTP tokens (encoded base32) */
34+
var secret: String? = null
35+
36+
/* Algorithm to use for HMAC */
37+
enum class Algorithm(val value: String) {
38+
@SerializedName("SHA1")
39+
@Json(name = "SHA1")
40+
SHA1("SHA1"),
41+
@SerializedName("SHA256")
42+
@Json(name = "SHA256")
43+
SHA256("SHA256"),
44+
@SerializedName("SHA512")
45+
@Json(name = "SHA512")
46+
SHA512("SHA512"),
47+
@SerializedName("MD5")
48+
@Json(name = "MD5")
49+
MD5("MD5")
50+
}
51+
52+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
* PLEASE DO NOT EDIT!
3+
*
4+
* Generated by SwagGen with Kotlin template.
5+
* https://github.com/pace/SwagGen
6+
*/
7+
8+
package cloud.pace.sdk.api.user.generated.model
9+
10+
import com.google.gson.annotations.SerializedName
11+
import com.squareup.moshi.Json
12+
import moe.banana.jsonapi2.HasMany
13+
import moe.banana.jsonapi2.HasOne
14+
import moe.banana.jsonapi2.JsonApi
15+
import moe.banana.jsonapi2.Resource
16+
import java.util.*
17+
18+
/* Error objects provide additional information about problems encountered while performing an operation.
19+
Errors also contain codes besides title and message which can be used for checks even if the detailed messages might change.
20+
* code `1000`: generic error
21+
* code `1001`: payment processing temporarily unavailable
22+
* code `1002`: requested amount exceeds the authorized amount of the provided token
23+
* code `1003`: implicit payment methods cannot be modified
24+
* code `1004`: payment method rejected by provider
25+
*/
26+
class Error {
27+
28+
var errors: List<Errors>? = null
29+
30+
/* Error objects provide additional information about problems encountered while performing an operation.
31+
Errors also contain codes besides title and message which can be used for checks even if the detailed messages might change.
32+
* code `1000`: generic error
33+
* code `1001`: payment processing temporarily unavailable
34+
* code `1002`: requested amount exceeds the authorized amount of the provided token
35+
* code `1003`: implicit payment methods cannot be modified
36+
* code `1004`: payment method rejected by provider
37+
*/
38+
class Errors {
39+
40+
/* an application-specific error code, expressed as a string value.
41+
*/
42+
var code: String? = null
43+
/* a human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be localized.
44+
*/
45+
var detail: String? = null
46+
var links: Links? = null
47+
/* a meta object containing non-standard meta-information about the error.
48+
*/
49+
var meta: Map<String, Any>? = null
50+
/* An object containing references to the source of the error.
51+
*/
52+
var source: Source? = null
53+
/* the HTTP status code applicable to this problem, expressed as a string value.
54+
*/
55+
var status: String? = null
56+
/* A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
57+
*/
58+
var title: String? = null
59+
60+
/* Error objects provide additional information about problems encountered while performing an operation.
61+
Errors also contain codes besides title and message which can be used for checks even if the detailed messages might change.
62+
* code `1000`: generic error
63+
* code `1001`: payment processing temporarily unavailable
64+
* code `1002`: requested amount exceeds the authorized amount of the provided token
65+
* code `1003`: implicit payment methods cannot be modified
66+
* code `1004`: payment method rejected by provider
67+
*/
68+
class Links {
69+
70+
/* A link that leads to further details about this particular occurrence of the problem.
71+
*/
72+
var about: String? = null
73+
}
74+
75+
/* An object containing references to the source of the error.
76+
*/
77+
class Source {
78+
79+
/* A string indicating which URI query parameter caused the error.
80+
*/
81+
var parameter: String? = null
82+
/* A JSON Pointer [RFC6901] to the associated entity in the request document [e.g. "/data" for a primary data object, or "/data/attributes/title" for a specific attribute].
83+
*/
84+
var pointer: String? = null
85+
}
86+
}
87+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* PLEASE DO NOT EDIT!
3+
*
4+
* Generated by SwagGen with Kotlin template.
5+
* https://github.com/pace/SwagGen
6+
*/
7+
8+
package cloud.pace.sdk.api.user.generated.model
9+
10+
import com.google.gson.annotations.SerializedName
11+
import com.squareup.moshi.Json
12+
import moe.banana.jsonapi2.HasMany
13+
import moe.banana.jsonapi2.HasOne
14+
import moe.banana.jsonapi2.JsonApi
15+
import moe.banana.jsonapi2.Resource
16+
import java.util.*
17+
18+
class OTP {
19+
20+
/* one time password */
21+
var otp: String? = null
22+
/* the one time password type to validate against. If none provided all default types are checked.
23+
* `login` login otp ([created and send via email](#operation/SendUsersLoginOTP))
24+
* `account` user account otp ([created on demand via pin / password](#operation/CreateOTP).)
25+
* `totp` user provided TOTP (authenticator)
26+
* `device-totp` device TOTP ([e.g. PACE Drive App, PACE Car App](#operation/CreateTOTP))
27+
*/
28+
var types: List<Types>? = null
29+
30+
/* the one time password type to validate against. If none provided all default types are checked.
31+
* `login` login otp ([created and send via email](#operation/SendUsersLoginOTP))
32+
* `account` user account otp ([created on demand via pin / password](#operation/CreateOTP).)
33+
* `totp` user provided TOTP (authenticator)
34+
* `device-totp` device TOTP ([e.g. PACE Drive App, PACE Car App](#operation/CreateTOTP))
35+
*/
36+
enum class Types(val value: String) {
37+
@SerializedName("login")
38+
@Json(name = "login")
39+
LOGIN("login"),
40+
@SerializedName("account")
41+
@Json(name = "account")
42+
ACCOUNT("account"),
43+
@SerializedName("totp")
44+
@Json(name = "totp")
45+
TOTP("totp"),
46+
@SerializedName("device-totp")
47+
@Json(name = "device-totp")
48+
DEVICETOTP("device-totp")
49+
}
50+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* PLEASE DO NOT EDIT!
3+
*
4+
* Generated by SwagGen with Kotlin template.
5+
* https://github.com/pace/SwagGen
6+
*/
7+
8+
package cloud.pace.sdk.api.user.generated.model
9+
10+
import com.google.gson.annotations.SerializedName
11+
import com.squareup.moshi.Json
12+
import moe.banana.jsonapi2.HasMany
13+
import moe.banana.jsonapi2.HasOne
14+
import moe.banana.jsonapi2.JsonApi
15+
import moe.banana.jsonapi2.Resource
16+
import java.util.*
17+
18+
class PinOrPassword {
19+
20+
/* indicates if password is set and validated */
21+
var password: Boolean? = null
22+
/* indicates if PIN is set and validated */
23+
var pin: Boolean? = null
24+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* PLEASE DO NOT EDIT!
3+
*
4+
* Generated by SwagGen with Kotlin template.
5+
* https://github.com/pace/SwagGen
6+
*/
7+
8+
package cloud.pace.sdk.api.user.generated.model
9+
10+
import com.google.gson.annotations.SerializedName
11+
import com.squareup.moshi.Json
12+
import moe.banana.jsonapi2.HasMany
13+
import moe.banana.jsonapi2.HasOne
14+
import moe.banana.jsonapi2.JsonApi
15+
import moe.banana.jsonapi2.Resource
16+
import java.util.*
17+
18+
class PlainOTP {
19+
20+
/* one time password */
21+
var otp: String? = null
22+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* PLEASE DO NOT EDIT!
3+
*
4+
* Generated by SwagGen with Kotlin template.
5+
* https://github.com/pace/SwagGen
6+
*/
7+
8+
package cloud.pace.sdk.api.user.generated.model
9+
10+
import com.google.gson.annotations.SerializedName
11+
import com.squareup.moshi.Json
12+
import moe.banana.jsonapi2.HasMany
13+
import moe.banana.jsonapi2.HasOne
14+
import moe.banana.jsonapi2.JsonApi
15+
import moe.banana.jsonapi2.Resource
16+
import java.util.*
17+
18+
class Session {
19+
20+
/* sets the login otp to true (passed) or false (not passed) */
21+
var passedLoginOTP: Boolean? = null
22+
/* The ID of the user that owns the session */
23+
var userId: String? = null
24+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* PLEASE DO NOT EDIT!
3+
*
4+
* Generated by SwagGen with Kotlin template.
5+
* https://github.com/pace/SwagGen
6+
*/
7+
8+
package cloud.pace.sdk.api.user.generated.model
9+
10+
import com.google.gson.annotations.SerializedName
11+
import com.squareup.moshi.Json
12+
import moe.banana.jsonapi2.HasMany
13+
import moe.banana.jsonapi2.HasOne
14+
import moe.banana.jsonapi2.JsonApi
15+
import moe.banana.jsonapi2.Resource
16+
import java.util.*
17+
18+
@JsonApi(type = "terms")
19+
class Terms : Resource() {
20+
21+
/* Location to the terms of service that need to be accepted */
22+
var acceptUrl: String? = null
23+
/* Terms of service formatted as markdown */
24+
var markdown: String? = null
25+
var version: Double? = null
26+
27+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* PLEASE DO NOT EDIT!
3+
*
4+
* Generated by SwagGen with Kotlin template.
5+
* https://github.com/pace/SwagGen
6+
*/
7+
8+
package cloud.pace.sdk.api.user.generated.model
9+
10+
import com.google.gson.annotations.SerializedName
11+
import com.squareup.moshi.Json
12+
import moe.banana.jsonapi2.HasMany
13+
import moe.banana.jsonapi2.HasOne
14+
import moe.banana.jsonapi2.JsonApi
15+
import moe.banana.jsonapi2.Resource
16+
import java.util.*
17+
18+
@JsonApi(type = "updateUserPhone")
19+
class UpdateUserPhone : Resource() {
20+
21+
/* complete phone number of the user */
22+
lateinit var phoneNumber: String
23+
24+
}

0 commit comments

Comments
 (0)