@@ -14,13 +14,15 @@ import com.tryfinch.api.core.checkRequired
1414import com.tryfinch.api.errors.FinchInvalidDataException
1515import java.util.Collections
1616import java.util.Objects
17+ import java.util.Optional
1718
1819class AutomatedCreateResponse
1920private constructor (
2021 private val allowedRefreshes: JsonField <Long >,
22+ private val remainingRefreshes: JsonField <Long >,
2123 private val jobId: JsonField <String >,
2224 private val jobUrl: JsonField <String >,
23- private val remainingRefreshes : JsonField <Long >,
25+ private val retryAt : JsonField <String >,
2426 private val additionalProperties: MutableMap <String , JsonValue >,
2527) {
2628
@@ -29,12 +31,13 @@ private constructor(
2931 @JsonProperty(" allowed_refreshes" )
3032 @ExcludeMissing
3133 allowedRefreshes: JsonField <Long > = JsonMissing .of(),
32- @JsonProperty(" job_id" ) @ExcludeMissing jobId: JsonField <String > = JsonMissing .of(),
33- @JsonProperty(" job_url" ) @ExcludeMissing jobUrl: JsonField <String > = JsonMissing .of(),
3434 @JsonProperty(" remaining_refreshes" )
3535 @ExcludeMissing
3636 remainingRefreshes: JsonField <Long > = JsonMissing .of(),
37- ) : this (allowedRefreshes, jobId, jobUrl, remainingRefreshes, mutableMapOf ())
37+ @JsonProperty(" job_id" ) @ExcludeMissing jobId: JsonField <String > = JsonMissing .of(),
38+ @JsonProperty(" job_url" ) @ExcludeMissing jobUrl: JsonField <String > = JsonMissing .of(),
39+ @JsonProperty(" retry_at" ) @ExcludeMissing retryAt: JsonField <String > = JsonMissing .of(),
40+ ) : this (allowedRefreshes, remainingRefreshes, jobId, jobUrl, retryAt, mutableMapOf ())
3841
3942 /* *
4043 * The number of allowed refreshes per hour (per hour, fixed window)
@@ -45,28 +48,36 @@ private constructor(
4548 fun allowedRefreshes (): Long = allowedRefreshes.getRequired(" allowed_refreshes" )
4649
4750 /* *
48- * The id of the job that has been created.
51+ * The number of remaining refreshes available (per hour, fixed window)
4952 *
5053 * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
5154 * missing or null (e.g. if the server responded with an unexpected value).
5255 */
53- fun jobId (): String = jobId.getRequired(" job_id" )
56+ fun remainingRefreshes (): Long = remainingRefreshes.getRequired(" remaining_refreshes" )
57+
58+ /* *
59+ * The id of the job that has been created.
60+ *
61+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
62+ * server responded with an unexpected value).
63+ */
64+ fun jobId (): Optional <String > = jobId.getOptional(" job_id" )
5465
5566 /* *
5667 * The url that can be used to retrieve the job status
5768 *
58- * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
59- * missing or null (e.g. if the server responded with an unexpected value).
69+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
70+ * server responded with an unexpected value).
6071 */
61- fun jobUrl (): String = jobUrl.getRequired (" job_url" )
72+ fun jobUrl (): Optional < String > = jobUrl.getOptional (" job_url" )
6273
6374 /* *
64- * The number of remaining refreshes available (per hour, fixed window)
75+ * ISO 8601 timestamp indicating when to retry the request
6576 *
66- * @throws FinchInvalidDataException if the JSON field has an unexpected type or is unexpectedly
67- * missing or null (e.g. if the server responded with an unexpected value).
77+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
78+ * server responded with an unexpected value).
6879 */
69- fun remainingRefreshes (): Long = remainingRefreshes.getRequired( " remaining_refreshes " )
80+ fun retryAt (): Optional < String > = retryAt.getOptional( " retry_at " )
7081
7182 /* *
7283 * Returns the raw JSON value of [allowedRefreshes].
@@ -78,6 +89,16 @@ private constructor(
7889 @ExcludeMissing
7990 fun _allowedRefreshes (): JsonField <Long > = allowedRefreshes
8091
92+ /* *
93+ * Returns the raw JSON value of [remainingRefreshes].
94+ *
95+ * Unlike [remainingRefreshes], this method doesn't throw if the JSON field has an unexpected
96+ * type.
97+ */
98+ @JsonProperty(" remaining_refreshes" )
99+ @ExcludeMissing
100+ fun _remainingRefreshes (): JsonField <Long > = remainingRefreshes
101+
81102 /* *
82103 * Returns the raw JSON value of [jobId].
83104 *
@@ -93,14 +114,11 @@ private constructor(
93114 @JsonProperty(" job_url" ) @ExcludeMissing fun _jobUrl (): JsonField <String > = jobUrl
94115
95116 /* *
96- * Returns the raw JSON value of [remainingRefreshes ].
117+ * Returns the raw JSON value of [retryAt ].
97118 *
98- * Unlike [remainingRefreshes], this method doesn't throw if the JSON field has an unexpected
99- * type.
119+ * Unlike [retryAt], this method doesn't throw if the JSON field has an unexpected type.
100120 */
101- @JsonProperty(" remaining_refreshes" )
102- @ExcludeMissing
103- fun _remainingRefreshes (): JsonField <Long > = remainingRefreshes
121+ @JsonProperty(" retry_at" ) @ExcludeMissing fun _retryAt (): JsonField <String > = retryAt
104122
105123 @JsonAnySetter
106124 private fun putAdditionalProperty (key : String , value : JsonValue ) {
@@ -122,8 +140,6 @@ private constructor(
122140 * The following fields are required:
123141 * ```java
124142 * .allowedRefreshes()
125- * .jobId()
126- * .jobUrl()
127143 * .remainingRefreshes()
128144 * ```
129145 */
@@ -134,17 +150,19 @@ private constructor(
134150 class Builder internal constructor() {
135151
136152 private var allowedRefreshes: JsonField <Long >? = null
137- private var jobId: JsonField <String >? = null
138- private var jobUrl: JsonField <String >? = null
139153 private var remainingRefreshes: JsonField <Long >? = null
154+ private var jobId: JsonField <String > = JsonMissing .of()
155+ private var jobUrl: JsonField <String > = JsonMissing .of()
156+ private var retryAt: JsonField <String > = JsonMissing .of()
140157 private var additionalProperties: MutableMap <String , JsonValue > = mutableMapOf ()
141158
142159 @JvmSynthetic
143160 internal fun from (automatedCreateResponse : AutomatedCreateResponse ) = apply {
144161 allowedRefreshes = automatedCreateResponse.allowedRefreshes
162+ remainingRefreshes = automatedCreateResponse.remainingRefreshes
145163 jobId = automatedCreateResponse.jobId
146164 jobUrl = automatedCreateResponse.jobUrl
147- remainingRefreshes = automatedCreateResponse.remainingRefreshes
165+ retryAt = automatedCreateResponse.retryAt
148166 additionalProperties = automatedCreateResponse.additionalProperties.toMutableMap()
149167 }
150168
@@ -163,6 +181,21 @@ private constructor(
163181 this .allowedRefreshes = allowedRefreshes
164182 }
165183
184+ /* * The number of remaining refreshes available (per hour, fixed window) */
185+ fun remainingRefreshes (remainingRefreshes : Long ) =
186+ remainingRefreshes(JsonField .of(remainingRefreshes))
187+
188+ /* *
189+ * Sets [Builder.remainingRefreshes] to an arbitrary JSON value.
190+ *
191+ * You should usually call [Builder.remainingRefreshes] with a well-typed [Long] value
192+ * instead. This method is primarily for setting the field to an undocumented or not yet
193+ * supported value.
194+ */
195+ fun remainingRefreshes (remainingRefreshes : JsonField <Long >) = apply {
196+ this .remainingRefreshes = remainingRefreshes
197+ }
198+
166199 /* * The id of the job that has been created. */
167200 fun jobId (jobId : String ) = jobId(JsonField .of(jobId))
168201
@@ -185,20 +218,16 @@ private constructor(
185218 */
186219 fun jobUrl (jobUrl : JsonField <String >) = apply { this .jobUrl = jobUrl }
187220
188- /* * The number of remaining refreshes available (per hour, fixed window) */
189- fun remainingRefreshes (remainingRefreshes : Long ) =
190- remainingRefreshes(JsonField .of(remainingRefreshes))
221+ /* * ISO 8601 timestamp indicating when to retry the request */
222+ fun retryAt (retryAt : String ) = retryAt(JsonField .of(retryAt))
191223
192224 /* *
193- * Sets [Builder.remainingRefreshes ] to an arbitrary JSON value.
225+ * Sets [Builder.retryAt ] to an arbitrary JSON value.
194226 *
195- * You should usually call [Builder.remainingRefreshes] with a well-typed [Long] value
196- * instead. This method is primarily for setting the field to an undocumented or not yet
197- * supported value.
227+ * You should usually call [Builder.retryAt] with a well-typed [String] value instead. This
228+ * method is primarily for setting the field to an undocumented or not yet supported value.
198229 */
199- fun remainingRefreshes (remainingRefreshes : JsonField <Long >) = apply {
200- this .remainingRefreshes = remainingRefreshes
201- }
230+ fun retryAt (retryAt : JsonField <String >) = apply { this .retryAt = retryAt }
202231
203232 fun additionalProperties (additionalProperties : Map <String , JsonValue >) = apply {
204233 this .additionalProperties.clear()
@@ -227,8 +256,6 @@ private constructor(
227256 * The following fields are required:
228257 * ```java
229258 * .allowedRefreshes()
230- * .jobId()
231- * .jobUrl()
232259 * .remainingRefreshes()
233260 * ```
234261 *
@@ -237,9 +264,10 @@ private constructor(
237264 fun build (): AutomatedCreateResponse =
238265 AutomatedCreateResponse (
239266 checkRequired(" allowedRefreshes" , allowedRefreshes),
240- checkRequired(" jobId" , jobId),
241- checkRequired(" jobUrl" , jobUrl),
242267 checkRequired(" remainingRefreshes" , remainingRefreshes),
268+ jobId,
269+ jobUrl,
270+ retryAt,
243271 additionalProperties.toMutableMap(),
244272 )
245273 }
@@ -252,9 +280,10 @@ private constructor(
252280 }
253281
254282 allowedRefreshes()
283+ remainingRefreshes()
255284 jobId()
256285 jobUrl()
257- remainingRefreshes ()
286+ retryAt ()
258287 validated = true
259288 }
260289
@@ -274,24 +303,25 @@ private constructor(
274303 @JvmSynthetic
275304 internal fun validity (): Int =
276305 (if (allowedRefreshes.asKnown().isPresent) 1 else 0 ) +
306+ (if (remainingRefreshes.asKnown().isPresent) 1 else 0 ) +
277307 (if (jobId.asKnown().isPresent) 1 else 0 ) +
278308 (if (jobUrl.asKnown().isPresent) 1 else 0 ) +
279- (if (remainingRefreshes .asKnown().isPresent) 1 else 0 )
309+ (if (retryAt .asKnown().isPresent) 1 else 0 )
280310
281311 override fun equals (other : Any? ): Boolean {
282312 if (this == = other) {
283313 return true
284314 }
285315
286- return /* spotless:off */ other is AutomatedCreateResponse && allowedRefreshes == other.allowedRefreshes && jobId == other.jobId && jobUrl == other.jobUrl && remainingRefreshes == other.remainingRefreshes && additionalProperties == other.additionalProperties /* spotless:on */
316+ return /* spotless:off */ other is AutomatedCreateResponse && allowedRefreshes == other.allowedRefreshes && remainingRefreshes == other.remainingRefreshes && jobId == other.jobId && jobUrl == other.jobUrl && retryAt == other.retryAt && additionalProperties == other.additionalProperties /* spotless:on */
287317 }
288318
289319 /* spotless:off */
290- private val hashCode: Int by lazy { Objects .hash(allowedRefreshes, jobId, jobUrl, remainingRefreshes , additionalProperties) }
320+ private val hashCode: Int by lazy { Objects .hash(allowedRefreshes, remainingRefreshes, jobId, jobUrl, retryAt , additionalProperties) }
291321 /* spotless:on */
292322
293323 override fun hashCode (): Int = hashCode
294324
295325 override fun toString () =
296- " AutomatedCreateResponse{allowedRefreshes=$allowedRefreshes , jobId=$jobId , jobUrl=$jobUrl , remainingRefreshes= $remainingRefreshes , additionalProperties=$additionalProperties }"
326+ " AutomatedCreateResponse{allowedRefreshes=$allowedRefreshes , remainingRefreshes= $remainingRefreshes , jobId=$jobId , jobUrl=$jobUrl , retryAt= $retryAt , additionalProperties=$additionalProperties }"
297327}
0 commit comments