@@ -28,28 +28,28 @@ private constructor(
2828) : Params {
2929
3030 /* *
31- * The client ID for your application
31+ * The authorization code received from the authorization server
3232 *
3333 * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
3434 * missing or null (e.g. if the server responded with an unexpected value).
3535 */
36- fun clientId (): String = body.clientId ()
36+ fun code (): String = body.code ()
3737
3838 /* *
39- * The client secret for your application
39+ * The client ID for your application
4040 *
41- * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
42- * missing or null (e.g. if the server responded with an unexpected value).
41+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
42+ * server responded with an unexpected value).
4343 */
44- fun clientSecret (): String = body.clientSecret ()
44+ fun clientId (): Optional < String > = body.clientId ()
4545
4646 /* *
47- * The authorization code received from the authorization server
47+ * The client secret for your application
4848 *
49- * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
50- * missing or null (e.g. if the server responded with an unexpected value).
49+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
50+ * server responded with an unexpected value).
5151 */
52- fun code (): String = body.code ()
52+ fun clientSecret (): Optional < String > = body.clientSecret ()
5353
5454 /* *
5555 * The redirect URI used in the authorization request (optional)
@@ -59,6 +59,13 @@ private constructor(
5959 */
6060 fun redirectUri (): Optional <String > = body.redirectUri()
6161
62+ /* *
63+ * Returns the raw JSON value of [code].
64+ *
65+ * Unlike [code], this method doesn't throw if the JSON field has an unexpected type.
66+ */
67+ fun _code (): JsonField <String > = body._code ()
68+
6269 /* *
6370 * Returns the raw JSON value of [clientId].
6471 *
@@ -73,13 +80,6 @@ private constructor(
7380 */
7481 fun _clientSecret (): JsonField <String > = body._clientSecret ()
7582
76- /* *
77- * Returns the raw JSON value of [code].
78- *
79- * Unlike [code], this method doesn't throw if the JSON field has an unexpected type.
80- */
81- fun _code (): JsonField <String > = body._code ()
82-
8383 /* *
8484 * Returns the raw JSON value of [redirectUri].
8585 *
@@ -104,8 +104,6 @@ private constructor(
104104 *
105105 * The following fields are required:
106106 * ```java
107- * .clientId()
108- * .clientSecret()
109107 * .code()
110108 * ```
111109 */
@@ -131,13 +129,24 @@ private constructor(
131129 *
132130 * This is generally only useful if you are already constructing the body separately.
133131 * Otherwise, it's more convenient to use the top-level setters instead:
132+ * - [code]
134133 * - [clientId]
135134 * - [clientSecret]
136- * - [code]
137135 * - [redirectUri]
138136 */
139137 fun body (body : CreateAccessTokenRequest ) = apply { this .body = body.toBuilder() }
140138
139+ /* * The authorization code received from the authorization server */
140+ fun code (code : String ) = apply { body.code(code) }
141+
142+ /* *
143+ * Sets [Builder.code] to an arbitrary JSON value.
144+ *
145+ * You should usually call [Builder.code] with a well-typed [String] value instead. This
146+ * method is primarily for setting the field to an undocumented or not yet supported value.
147+ */
148+ fun code (code : JsonField <String >) = apply { body.code(code) }
149+
141150 /* * The client ID for your application */
142151 fun clientId (clientId : String ) = apply { body.clientId(clientId) }
143152
@@ -163,17 +172,6 @@ private constructor(
163172 body.clientSecret(clientSecret)
164173 }
165174
166- /* * The authorization code received from the authorization server */
167- fun code (code : String ) = apply { body.code(code) }
168-
169- /* *
170- * Sets [Builder.code] to an arbitrary JSON value.
171- *
172- * You should usually call [Builder.code] with a well-typed [String] value instead. This
173- * method is primarily for setting the field to an undocumented or not yet supported value.
174- */
175- fun code (code : JsonField <String >) = apply { body.code(code) }
176-
177175 /* * The redirect URI used in the authorization request (optional) */
178176 fun redirectUri (redirectUri : String ) = apply { body.redirectUri(redirectUri) }
179177
@@ -310,8 +308,6 @@ private constructor(
310308 *
311309 * The following fields are required:
312310 * ```java
313- * .clientId()
314- * .clientSecret()
315311 * .code()
316312 * ```
317313 *
@@ -333,50 +329,50 @@ private constructor(
333329
334330 class CreateAccessTokenRequest
335331 private constructor (
332+ private val code: JsonField <String >,
336333 private val clientId: JsonField <String >,
337334 private val clientSecret: JsonField <String >,
338- private val code: JsonField <String >,
339335 private val redirectUri: JsonField <String >,
340336 private val additionalProperties: MutableMap <String , JsonValue >,
341337 ) {
342338
343339 @JsonCreator
344340 private constructor (
341+ @JsonProperty(" code" ) @ExcludeMissing code: JsonField <String > = JsonMissing .of(),
345342 @JsonProperty(" client_id" )
346343 @ExcludeMissing
347344 clientId: JsonField <String > = JsonMissing .of(),
348345 @JsonProperty(" client_secret" )
349346 @ExcludeMissing
350347 clientSecret: JsonField <String > = JsonMissing .of(),
351- @JsonProperty(" code" ) @ExcludeMissing code: JsonField <String > = JsonMissing .of(),
352348 @JsonProperty(" redirect_uri" )
353349 @ExcludeMissing
354350 redirectUri: JsonField <String > = JsonMissing .of(),
355- ) : this (clientId, clientSecret, code , redirectUri, mutableMapOf ())
351+ ) : this (code, clientId, clientSecret , redirectUri, mutableMapOf ())
356352
357353 /* *
358- * The client ID for your application
354+ * The authorization code received from the authorization server
359355 *
360356 * @throws FinchInvalidDataException if the JSON field has an unexpected type or is
361357 * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
362358 */
363- fun clientId (): String = clientId .getRequired(" client_id " )
359+ fun code (): String = code .getRequired(" code " )
364360
365361 /* *
366- * The client secret for your application
362+ * The client ID for your application
367363 *
368- * @throws FinchInvalidDataException if the JSON field has an unexpected type or is
369- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
364+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
365+ * server responded with an unexpected value).
370366 */
371- fun clientSecret (): String = clientSecret.getRequired( " client_secret " )
367+ fun clientId (): Optional < String > = clientId.getOptional( " client_id " )
372368
373369 /* *
374- * The authorization code received from the authorization server
370+ * The client secret for your application
375371 *
376- * @throws FinchInvalidDataException if the JSON field has an unexpected type or is
377- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
372+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
373+ * server responded with an unexpected value).
378374 */
379- fun code (): String = code.getRequired( " code " )
375+ fun clientSecret (): Optional < String > = clientSecret.getOptional( " client_secret " )
380376
381377 /* *
382378 * The redirect URI used in the authorization request (optional)
@@ -386,6 +382,13 @@ private constructor(
386382 */
387383 fun redirectUri (): Optional <String > = redirectUri.getOptional(" redirect_uri" )
388384
385+ /* *
386+ * Returns the raw JSON value of [code].
387+ *
388+ * Unlike [code], this method doesn't throw if the JSON field has an unexpected type.
389+ */
390+ @JsonProperty(" code" ) @ExcludeMissing fun _code (): JsonField <String > = code
391+
389392 /* *
390393 * Returns the raw JSON value of [clientId].
391394 *
@@ -403,13 +406,6 @@ private constructor(
403406 @ExcludeMissing
404407 fun _clientSecret (): JsonField <String > = clientSecret
405408
406- /* *
407- * Returns the raw JSON value of [code].
408- *
409- * Unlike [code], this method doesn't throw if the JSON field has an unexpected type.
410- */
411- @JsonProperty(" code" ) @ExcludeMissing fun _code (): JsonField <String > = code
412-
413409 /* *
414410 * Returns the raw JSON value of [redirectUri].
415411 *
@@ -438,8 +434,6 @@ private constructor(
438434 *
439435 * The following fields are required:
440436 * ```java
441- * .clientId()
442- * .clientSecret()
443437 * .code()
444438 * ```
445439 */
@@ -449,21 +443,33 @@ private constructor(
449443 /* * A builder for [CreateAccessTokenRequest]. */
450444 class Builder internal constructor() {
451445
452- private var clientId: JsonField <String >? = null
453- private var clientSecret: JsonField <String >? = null
454446 private var code: JsonField <String >? = null
447+ private var clientId: JsonField <String > = JsonMissing .of()
448+ private var clientSecret: JsonField <String > = JsonMissing .of()
455449 private var redirectUri: JsonField <String > = JsonMissing .of()
456450 private var additionalProperties: MutableMap <String , JsonValue > = mutableMapOf ()
457451
458452 @JvmSynthetic
459453 internal fun from (createAccessTokenRequest : CreateAccessTokenRequest ) = apply {
454+ code = createAccessTokenRequest.code
460455 clientId = createAccessTokenRequest.clientId
461456 clientSecret = createAccessTokenRequest.clientSecret
462- code = createAccessTokenRequest.code
463457 redirectUri = createAccessTokenRequest.redirectUri
464458 additionalProperties = createAccessTokenRequest.additionalProperties.toMutableMap()
465459 }
466460
461+ /* * The authorization code received from the authorization server */
462+ fun code (code : String ) = code(JsonField .of(code))
463+
464+ /* *
465+ * Sets [Builder.code] to an arbitrary JSON value.
466+ *
467+ * You should usually call [Builder.code] with a well-typed [String] value instead. This
468+ * method is primarily for setting the field to an undocumented or not yet supported
469+ * value.
470+ */
471+ fun code (code : JsonField <String >) = apply { this .code = code }
472+
467473 /* * The client ID for your application */
468474 fun clientId (clientId : String ) = clientId(JsonField .of(clientId))
469475
@@ -490,18 +496,6 @@ private constructor(
490496 this .clientSecret = clientSecret
491497 }
492498
493- /* * The authorization code received from the authorization server */
494- fun code (code : String ) = code(JsonField .of(code))
495-
496- /* *
497- * Sets [Builder.code] to an arbitrary JSON value.
498- *
499- * You should usually call [Builder.code] with a well-typed [String] value instead. This
500- * method is primarily for setting the field to an undocumented or not yet supported
501- * value.
502- */
503- fun code (code : JsonField <String >) = apply { this .code = code }
504-
505499 /* * The redirect URI used in the authorization request (optional) */
506500 fun redirectUri (redirectUri : String ) = redirectUri(JsonField .of(redirectUri))
507501
@@ -542,18 +536,16 @@ private constructor(
542536 *
543537 * The following fields are required:
544538 * ```java
545- * .clientId()
546- * .clientSecret()
547539 * .code()
548540 * ```
549541 *
550542 * @throws IllegalStateException if any required field is unset.
551543 */
552544 fun build (): CreateAccessTokenRequest =
553545 CreateAccessTokenRequest (
554- checkRequired(" clientId" , clientId),
555- checkRequired(" clientSecret" , clientSecret),
556546 checkRequired(" code" , code),
547+ clientId,
548+ clientSecret,
557549 redirectUri,
558550 additionalProperties.toMutableMap(),
559551 )
@@ -566,9 +558,9 @@ private constructor(
566558 return @apply
567559 }
568560
561+ code()
569562 clientId()
570563 clientSecret()
571- code()
572564 redirectUri()
573565 validated = true
574566 }
@@ -589,9 +581,9 @@ private constructor(
589581 */
590582 @JvmSynthetic
591583 internal fun validity (): Int =
592- (if (clientId.asKnown().isPresent) 1 else 0 ) +
584+ (if (code.asKnown().isPresent) 1 else 0 ) +
585+ (if (clientId.asKnown().isPresent) 1 else 0 ) +
593586 (if (clientSecret.asKnown().isPresent) 1 else 0 ) +
594- (if (code.asKnown().isPresent) 1 else 0 ) +
595587 (if (redirectUri.asKnown().isPresent) 1 else 0 )
596588
597589 override fun equals (other : Any? ): Boolean {
@@ -600,21 +592,21 @@ private constructor(
600592 }
601593
602594 return other is CreateAccessTokenRequest &&
595+ code == other.code &&
603596 clientId == other.clientId &&
604597 clientSecret == other.clientSecret &&
605- code == other.code &&
606598 redirectUri == other.redirectUri &&
607599 additionalProperties == other.additionalProperties
608600 }
609601
610602 private val hashCode: Int by lazy {
611- Objects .hash(clientId, clientSecret, code , redirectUri, additionalProperties)
603+ Objects .hash(code, clientId, clientSecret , redirectUri, additionalProperties)
612604 }
613605
614606 override fun hashCode (): Int = hashCode
615607
616608 override fun toString () =
617- " CreateAccessTokenRequest{clientId= $clientId , clientSecret= $clientSecret , code= $code , redirectUri=$redirectUri , additionalProperties=$additionalProperties }"
609+ " CreateAccessTokenRequest{code= $code , clientId= $clientId , clientSecret= $clientSecret , redirectUri=$redirectUri , additionalProperties=$additionalProperties }"
618610 }
619611
620612 override fun equals (other : Any? ): Boolean {
0 commit comments