diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d52d2b97..a26ebfc1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.13.0" + ".": "0.14.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 408b5808..b57e87a9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 19 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prelude/prelude-bceac2d798eb515f8fd14406ac6f50de2aa983a3674cecb63167c0d0d52cfbc9.yml -openapi_spec_hash: b9963276e8c0178b0c45bf2ea07f63fb +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prelude/prelude-86fc45f417e6468f6a6087f9e35b264b0a350e31385bc078a2027a1f1abd1d15.yml +openapi_spec_hash: fb72aba38ec55a3b6b5162c9f5b4228d config_hash: 3dbe79c14ecd9a153418249f9155d159 diff --git a/CHANGELOG.md b/CHANGELOG.md index 47d5edd8..2d26bd82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 0.14.0 (2026-09-15) + +Full Changelog: [v0.13.0...v0.14.0](https://github.com/prelude-so/java-sdk/compare/v0.13.0...v0.14.0) + +### Features + +* **api:** api update ([b704163](https://github.com/prelude-so/java-sdk/commit/b7041632f2221e53a08eee85c0ccde5d84ef1dec)) +* **api:** api update ([3b9b34c](https://github.com/prelude-so/java-sdk/commit/3b9b34cde0cbf3efa398cab5aedecd961cff745b)) +* **api:** api update ([cfa0c6f](https://github.com/prelude-so/java-sdk/commit/cfa0c6fb36fa1194af2434a1e28113e8dde2221f)) + + +### Bug Fixes + +* **docs:** link the javadoc badge so the version stays current after release ([fff8c05](https://github.com/prelude-so/java-sdk/commit/fff8c05b581f12c847f83dd2edea16c6adaebe77)) + + +### Chores + +* **internal:** allow the mock server port to be set with STAINLESS_MOCK_PORT ([8181844](https://github.com/prelude-so/java-sdk/commit/8181844928f29fe11414bff4423db2c6eabfb6b7)) +* **internal:** codegen related update ([775f43b](https://github.com/prelude-so/java-sdk/commit/775f43b7f440b730a8e71e913963eec408fac8a1)) + ## 0.13.0 (2026-08-07) Full Changelog: [v0.12.0...v0.13.0](https://github.com/prelude-so/java-sdk/compare/v0.12.0...v0.13.0) diff --git a/README.md b/README.md index 6d11dddc..efdba809 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/so.prelude.sdk/prelude-java)](https://central.sonatype.com/artifact/so.prelude.sdk/prelude-java/0.13.0) -[![javadoc](https://javadoc.io/badge2/so.prelude.sdk/prelude-java/0.13.0/javadoc.svg)](https://javadoc.io/doc/so.prelude.sdk/prelude-java/0.13.0) +[![Maven Central](https://img.shields.io/maven-central/v/so.prelude.sdk/prelude-java)](https://central.sonatype.com/artifact/so.prelude.sdk/prelude-java/0.14.0) +[![javadoc](https://javadoc.io/badge2/so.prelude.sdk/prelude-java/javadoc.svg)](https://javadoc.io/doc/so.prelude.sdk/prelude-java/0.14.0) @@ -13,7 +13,7 @@ It is generated with [Stainless](https://www.stainless.com/). -The REST API documentation can be found on [docs.prelude.so](https://docs.prelude.so). Javadocs are available on [javadoc.io](https://javadoc.io/doc/so.prelude.sdk/prelude-java/0.13.0). +The REST API documentation can be found on [docs.prelude.so](https://docs.prelude.so). Javadocs are available on [javadoc.io](https://javadoc.io/doc/so.prelude.sdk/prelude-java/0.14.0). @@ -24,7 +24,7 @@ The REST API documentation can be found on [docs.prelude.so](https://docs.prelud ### Gradle ```kotlin -implementation("so.prelude.sdk:prelude-java:0.13.0") +implementation("so.prelude.sdk:prelude-java:0.14.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("so.prelude.sdk:prelude-java:0.13.0") so.prelude.sdk prelude-java - 0.13.0 + 0.14.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 034e4da7..9913f290 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "so.prelude.sdk" - version = "0.13.0" // x-release-please-version + version = "0.14.0" // x-release-please-version } subprojects { diff --git a/prelude-java-core/build.gradle.kts b/prelude-java-core/build.gradle.kts index 31f51449..a7e9edc5 100644 --- a/prelude-java-core/build.gradle.kts +++ b/prelude-java-core/build.gradle.kts @@ -38,4 +38,5 @@ dependencies { testImplementation("org.mockito:mockito-core:5.14.2") testImplementation("org.mockito:mockito-junit-jupiter:5.14.2") testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0") + testImplementation("org.slf4j:slf4j-nop:1.7.36") } diff --git a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyGetSubscriptionConfigParams.kt b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyGetSubscriptionConfigParams.kt index 153c0e8a..0c885373 100644 --- a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyGetSubscriptionConfigParams.kt +++ b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyGetSubscriptionConfigParams.kt @@ -9,7 +9,11 @@ import so.prelude.sdk.core.Params import so.prelude.sdk.core.http.Headers import so.prelude.sdk.core.http.QueryParams -/** Retrieve a specific subscription management configuration by its ID. */ +/** + * Retrieve a specific subscription management configuration by its ID. + * + * In order to get access to this endpoint, contact our support team. + */ class NotifyGetSubscriptionConfigParams private constructor( private val configId: String?, diff --git a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyGetSubscriptionPhoneNumberParams.kt b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyGetSubscriptionPhoneNumberParams.kt index 147d98e5..23e24d5d 100644 --- a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyGetSubscriptionPhoneNumberParams.kt +++ b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyGetSubscriptionPhoneNumberParams.kt @@ -13,6 +13,8 @@ import so.prelude.sdk.core.http.QueryParams /** * Retrieve the current subscription status for a specific phone number within a subscription * configuration. + * + * In order to get access to this endpoint, contact our support team. */ class NotifyGetSubscriptionPhoneNumberParams private constructor( diff --git a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyListSubscriptionConfigsParams.kt b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyListSubscriptionConfigsParams.kt index c68ca563..03c02ad3 100644 --- a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyListSubscriptionConfigsParams.kt +++ b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyListSubscriptionConfigsParams.kt @@ -14,6 +14,8 @@ import so.prelude.sdk.core.http.QueryParams * * Each configuration represents a subscription management setup with phone numbers for receiving * opt-out/opt-in requests and a callback URL for webhook events. + * + * In order to get access to this endpoint, contact our support team. */ class NotifyListSubscriptionConfigsParams private constructor( diff --git a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyListSubscriptionPhoneNumberEventsParams.kt b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyListSubscriptionPhoneNumberEventsParams.kt index 5c0d3b76..347160a8 100644 --- a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyListSubscriptionPhoneNumberEventsParams.kt +++ b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyListSubscriptionPhoneNumberEventsParams.kt @@ -15,6 +15,8 @@ import so.prelude.sdk.core.http.QueryParams * within a subscription configuration. * * Events are ordered by timestamp in descending order (most recent first). + * + * In order to get access to this endpoint, contact our support team. */ class NotifyListSubscriptionPhoneNumberEventsParams private constructor( diff --git a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyListSubscriptionPhoneNumbersParams.kt b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyListSubscriptionPhoneNumbersParams.kt index 2ae701b0..9d552243 100644 --- a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyListSubscriptionPhoneNumbersParams.kt +++ b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/NotifyListSubscriptionPhoneNumbersParams.kt @@ -18,6 +18,8 @@ import so.prelude.sdk.errors.PreludeInvalidDataException * subscription configuration. * * You can optionally filter by subscription state (SUB or UNSUB). + * + * In order to get access to this endpoint, contact our support team. */ class NotifyListSubscriptionPhoneNumbersParams private constructor( diff --git a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/VerificationCreateParams.kt b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/VerificationCreateParams.kt index 976e6e51..8bd0ed53 100644 --- a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/VerificationCreateParams.kt +++ b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/VerificationCreateParams.kt @@ -3005,6 +3005,7 @@ private constructor( private val deviceId: JsonField, private val deviceModel: JsonField, private val devicePlatform: JsonField, + private val existingUser: JsonField, private val ip: JsonField, private val isTrustedUser: JsonField, private val ja4Fingerprint: JsonField, @@ -3027,6 +3028,9 @@ private constructor( @JsonProperty("device_platform") @ExcludeMissing devicePlatform: JsonField = JsonMissing.of(), + @JsonProperty("existing_user") + @ExcludeMissing + existingUser: JsonField = JsonMissing.of(), @JsonProperty("ip") @ExcludeMissing ip: JsonField = JsonMissing.of(), @JsonProperty("is_trusted_user") @ExcludeMissing @@ -3045,6 +3049,7 @@ private constructor( deviceId, deviceModel, devicePlatform, + existingUser, ip, isTrustedUser, ja4Fingerprint, @@ -3088,6 +3093,18 @@ private constructor( fun devicePlatform(): Optional = devicePlatform.getOptional("device_platform") + /** + * Whether the end-user already exists in your system, for example an existing account + * signing in again rather than a first-time signup. Unlike `is_trusted_user`, this signal + * does not bypass fraud checks; it is taken into account as one additional anti-fraud + * signal. For more details, refer to + * [Signals](/verify/v2/documentation/prevent-fraud#signals). + * + * @throws PreludeInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun existingUser(): Optional = existingUser.getOptional("existing_user") + /** * The public IP v4 or v6 address of the end-user's device. You should collect this from * your backend. If your backend is behind a proxy, use the `X-Forwarded-For`, `Forwarded`, @@ -3172,6 +3189,16 @@ private constructor( @ExcludeMissing fun _devicePlatform(): JsonField = devicePlatform + /** + * Returns the raw JSON value of [existingUser]. + * + * Unlike [existingUser], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("existing_user") + @ExcludeMissing + fun _existingUser(): JsonField = existingUser + /** * Returns the raw JSON value of [ip]. * @@ -3238,6 +3265,7 @@ private constructor( private var deviceId: JsonField = JsonMissing.of() private var deviceModel: JsonField = JsonMissing.of() private var devicePlatform: JsonField = JsonMissing.of() + private var existingUser: JsonField = JsonMissing.of() private var ip: JsonField = JsonMissing.of() private var isTrustedUser: JsonField = JsonMissing.of() private var ja4Fingerprint: JsonField = JsonMissing.of() @@ -3251,6 +3279,7 @@ private constructor( deviceId = signals.deviceId deviceModel = signals.deviceModel devicePlatform = signals.devicePlatform + existingUser = signals.existingUser ip = signals.ip isTrustedUser = signals.isTrustedUser ja4Fingerprint = signals.ja4Fingerprint @@ -3316,6 +3345,26 @@ private constructor( this.devicePlatform = devicePlatform } + /** + * Whether the end-user already exists in your system, for example an existing account + * signing in again rather than a first-time signup. Unlike `is_trusted_user`, this + * signal does not bypass fraud checks; it is taken into account as one additional + * anti-fraud signal. For more details, refer to + * [Signals](/verify/v2/documentation/prevent-fraud#signals). + */ + fun existingUser(existingUser: Boolean) = existingUser(JsonField.of(existingUser)) + + /** + * Sets [Builder.existingUser] to an arbitrary JSON value. + * + * You should usually call [Builder.existingUser] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun existingUser(existingUser: JsonField) = apply { + this.existingUser = existingUser + } + /** * The public IP v4 or v6 address of the end-user's device. You should collect this from * your backend. If your backend is behind a proxy, use the `X-Forwarded-For`, @@ -3428,6 +3477,7 @@ private constructor( deviceId, deviceModel, devicePlatform, + existingUser, ip, isTrustedUser, ja4Fingerprint, @@ -3457,6 +3507,7 @@ private constructor( deviceId() deviceModel() devicePlatform().ifPresent { it.validate() } + existingUser() ip() isTrustedUser() ja4Fingerprint() @@ -3485,6 +3536,7 @@ private constructor( (if (deviceId.asKnown().isPresent) 1 else 0) + (if (deviceModel.asKnown().isPresent) 1 else 0) + (devicePlatform.asKnown().getOrNull()?.validity() ?: 0) + + (if (existingUser.asKnown().isPresent) 1 else 0) + (if (ip.asKnown().isPresent) 1 else 0) + (if (isTrustedUser.asKnown().isPresent) 1 else 0) + (if (ja4Fingerprint.asKnown().isPresent) 1 else 0) + @@ -3662,6 +3714,7 @@ private constructor( deviceId == other.deviceId && deviceModel == other.deviceModel && devicePlatform == other.devicePlatform && + existingUser == other.existingUser && ip == other.ip && isTrustedUser == other.isTrustedUser && ja4Fingerprint == other.ja4Fingerprint && @@ -3676,6 +3729,7 @@ private constructor( deviceId, deviceModel, devicePlatform, + existingUser, ip, isTrustedUser, ja4Fingerprint, @@ -3688,7 +3742,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Signals{appVersion=$appVersion, deviceId=$deviceId, deviceModel=$deviceModel, devicePlatform=$devicePlatform, ip=$ip, isTrustedUser=$isTrustedUser, ja4Fingerprint=$ja4Fingerprint, osVersion=$osVersion, userAgent=$userAgent, additionalProperties=$additionalProperties}" + "Signals{appVersion=$appVersion, deviceId=$deviceId, deviceModel=$deviceModel, devicePlatform=$devicePlatform, existingUser=$existingUser, ip=$ip, isTrustedUser=$isTrustedUser, ja4Fingerprint=$ja4Fingerprint, osVersion=$osVersion, userAgent=$userAgent, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/WatchPredictParams.kt b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/WatchPredictParams.kt index b49584c3..eb21b53b 100644 --- a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/WatchPredictParams.kt +++ b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/WatchPredictParams.kt @@ -1144,6 +1144,7 @@ private constructor( private val deviceId: JsonField, private val deviceModel: JsonField, private val devicePlatform: JsonField, + private val existingUser: JsonField, private val ip: JsonField, private val isTrustedUser: JsonField, private val ja4Fingerprint: JsonField, @@ -1166,6 +1167,9 @@ private constructor( @JsonProperty("device_platform") @ExcludeMissing devicePlatform: JsonField = JsonMissing.of(), + @JsonProperty("existing_user") + @ExcludeMissing + existingUser: JsonField = JsonMissing.of(), @JsonProperty("ip") @ExcludeMissing ip: JsonField = JsonMissing.of(), @JsonProperty("is_trusted_user") @ExcludeMissing @@ -1184,6 +1188,7 @@ private constructor( deviceId, deviceModel, devicePlatform, + existingUser, ip, isTrustedUser, ja4Fingerprint, @@ -1227,6 +1232,18 @@ private constructor( fun devicePlatform(): Optional = devicePlatform.getOptional("device_platform") + /** + * Whether the end-user already exists in your system, for example an existing account + * signing in again rather than a first-time signup. Unlike `is_trusted_user`, this signal + * does not bypass fraud checks; it is taken into account as one additional anti-fraud + * signal. For more details, refer to + * [Signals](/verify/v2/documentation/prevent-fraud#signals). + * + * @throws PreludeInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun existingUser(): Optional = existingUser.getOptional("existing_user") + /** * The public IP v4 or v6 address of the end-user's device. You should collect this from * your backend. If your backend is behind a proxy, use the `X-Forwarded-For`, `Forwarded`, @@ -1311,6 +1328,16 @@ private constructor( @ExcludeMissing fun _devicePlatform(): JsonField = devicePlatform + /** + * Returns the raw JSON value of [existingUser]. + * + * Unlike [existingUser], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("existing_user") + @ExcludeMissing + fun _existingUser(): JsonField = existingUser + /** * Returns the raw JSON value of [ip]. * @@ -1377,6 +1404,7 @@ private constructor( private var deviceId: JsonField = JsonMissing.of() private var deviceModel: JsonField = JsonMissing.of() private var devicePlatform: JsonField = JsonMissing.of() + private var existingUser: JsonField = JsonMissing.of() private var ip: JsonField = JsonMissing.of() private var isTrustedUser: JsonField = JsonMissing.of() private var ja4Fingerprint: JsonField = JsonMissing.of() @@ -1390,6 +1418,7 @@ private constructor( deviceId = signals.deviceId deviceModel = signals.deviceModel devicePlatform = signals.devicePlatform + existingUser = signals.existingUser ip = signals.ip isTrustedUser = signals.isTrustedUser ja4Fingerprint = signals.ja4Fingerprint @@ -1455,6 +1484,26 @@ private constructor( this.devicePlatform = devicePlatform } + /** + * Whether the end-user already exists in your system, for example an existing account + * signing in again rather than a first-time signup. Unlike `is_trusted_user`, this + * signal does not bypass fraud checks; it is taken into account as one additional + * anti-fraud signal. For more details, refer to + * [Signals](/verify/v2/documentation/prevent-fraud#signals). + */ + fun existingUser(existingUser: Boolean) = existingUser(JsonField.of(existingUser)) + + /** + * Sets [Builder.existingUser] to an arbitrary JSON value. + * + * You should usually call [Builder.existingUser] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun existingUser(existingUser: JsonField) = apply { + this.existingUser = existingUser + } + /** * The public IP v4 or v6 address of the end-user's device. You should collect this from * your backend. If your backend is behind a proxy, use the `X-Forwarded-For`, @@ -1567,6 +1616,7 @@ private constructor( deviceId, deviceModel, devicePlatform, + existingUser, ip, isTrustedUser, ja4Fingerprint, @@ -1596,6 +1646,7 @@ private constructor( deviceId() deviceModel() devicePlatform().ifPresent { it.validate() } + existingUser() ip() isTrustedUser() ja4Fingerprint() @@ -1624,6 +1675,7 @@ private constructor( (if (deviceId.asKnown().isPresent) 1 else 0) + (if (deviceModel.asKnown().isPresent) 1 else 0) + (devicePlatform.asKnown().getOrNull()?.validity() ?: 0) + + (if (existingUser.asKnown().isPresent) 1 else 0) + (if (ip.asKnown().isPresent) 1 else 0) + (if (isTrustedUser.asKnown().isPresent) 1 else 0) + (if (ja4Fingerprint.asKnown().isPresent) 1 else 0) + @@ -1801,6 +1853,7 @@ private constructor( deviceId == other.deviceId && deviceModel == other.deviceModel && devicePlatform == other.devicePlatform && + existingUser == other.existingUser && ip == other.ip && isTrustedUser == other.isTrustedUser && ja4Fingerprint == other.ja4Fingerprint && @@ -1815,6 +1868,7 @@ private constructor( deviceId, deviceModel, devicePlatform, + existingUser, ip, isTrustedUser, ja4Fingerprint, @@ -1827,7 +1881,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Signals{appVersion=$appVersion, deviceId=$deviceId, deviceModel=$deviceModel, devicePlatform=$devicePlatform, ip=$ip, isTrustedUser=$isTrustedUser, ja4Fingerprint=$ja4Fingerprint, osVersion=$osVersion, userAgent=$userAgent, additionalProperties=$additionalProperties}" + "Signals{appVersion=$appVersion, deviceId=$deviceId, deviceModel=$deviceModel, devicePlatform=$devicePlatform, existingUser=$existingUser, ip=$ip, isTrustedUser=$isTrustedUser, ja4Fingerprint=$ja4Fingerprint, osVersion=$osVersion, userAgent=$userAgent, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/WatchPredictResponse.kt b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/WatchPredictResponse.kt index fbb69346..5e4f5c55 100644 --- a/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/WatchPredictResponse.kt +++ b/prelude-java-core/src/main/kotlin/so/prelude/sdk/models/WatchPredictResponse.kt @@ -70,6 +70,8 @@ private constructor( /** * The risk factors that contributed to the suspicious prediction. Only present when prediction * is "suspicious" and the anti-fraud system detected specific risk signals. + * * `account_risk_profile` - The target matches a risk profile derived from the outcomes + * reported on your own account, rather than from a signal shared across accounts. * * `behavioral_pattern` - The phone number past behavior during verification flows exhibits * suspicious patterns. * * `device_attribute` - The device exhibits characteristics associated with suspicious @@ -214,6 +216,8 @@ private constructor( /** * The risk factors that contributed to the suspicious prediction. Only present when * prediction is "suspicious" and the anti-fraud system detected specific risk signals. + * * `account_risk_profile` - The target matches a risk profile derived from the outcomes + * reported on your own account, rather than from a signal shared across accounts. * * `behavioral_pattern` - The phone number past behavior during verification flows * exhibits suspicious patterns. * * `device_attribute` - The device exhibits characteristics associated with suspicious @@ -496,6 +500,8 @@ private constructor( companion object { + @JvmField val ACCOUNT_RISK_PROFILE = of("account_risk_profile") + @JvmField val BEHAVIORAL_PATTERN = of("behavioral_pattern") @JvmField val DEVICE_ATTRIBUTE = of("device_attribute") @@ -521,6 +527,7 @@ private constructor( /** An enum containing [RiskFactor]'s known values. */ enum class Known { + ACCOUNT_RISK_PROFILE, BEHAVIORAL_PATTERN, DEVICE_ATTRIBUTE, FRAUD_DATABASE, @@ -543,6 +550,7 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { + ACCOUNT_RISK_PROFILE, BEHAVIORAL_PATTERN, DEVICE_ATTRIBUTE, FRAUD_DATABASE, @@ -568,6 +576,7 @@ private constructor( */ fun value(): Value = when (this) { + ACCOUNT_RISK_PROFILE -> Value.ACCOUNT_RISK_PROFILE BEHAVIORAL_PATTERN -> Value.BEHAVIORAL_PATTERN DEVICE_ATTRIBUTE -> Value.DEVICE_ATTRIBUTE FRAUD_DATABASE -> Value.FRAUD_DATABASE @@ -592,6 +601,7 @@ private constructor( */ fun known(): Known = when (this) { + ACCOUNT_RISK_PROFILE -> Known.ACCOUNT_RISK_PROFILE BEHAVIORAL_PATTERN -> Known.BEHAVIORAL_PATTERN DEVICE_ATTRIBUTE -> Known.DEVICE_ATTRIBUTE FRAUD_DATABASE -> Known.FRAUD_DATABASE diff --git a/prelude-java-core/src/main/kotlin/so/prelude/sdk/services/async/NotifyServiceAsync.kt b/prelude-java-core/src/main/kotlin/so/prelude/sdk/services/async/NotifyServiceAsync.kt index 04627945..7acfade2 100644 --- a/prelude-java-core/src/main/kotlin/so/prelude/sdk/services/async/NotifyServiceAsync.kt +++ b/prelude-java-core/src/main/kotlin/so/prelude/sdk/services/async/NotifyServiceAsync.kt @@ -37,7 +37,11 @@ interface NotifyServiceAsync { */ fun withOptions(modifier: Consumer): NotifyServiceAsync - /** Retrieve a specific subscription management configuration by its ID. */ + /** + * Retrieve a specific subscription management configuration by its ID. + * + * In order to get access to this endpoint, contact our support team. + */ fun getSubscriptionConfig( configId: String ): CompletableFuture = @@ -80,6 +84,8 @@ interface NotifyServiceAsync { /** * Retrieve the current subscription status for a specific phone number within a subscription * configuration. + * + * In order to get access to this endpoint, contact our support team. */ fun getSubscriptionPhoneNumber( phoneNumber: String, @@ -115,6 +121,8 @@ interface NotifyServiceAsync { * * Each configuration represents a subscription management setup with phone numbers for * receiving opt-out/opt-in requests and a callback URL for webhook events. + * + * In order to get access to this endpoint, contact our support team. */ fun listSubscriptionConfigs(): CompletableFuture = listSubscriptionConfigs(NotifyListSubscriptionConfigsParams.none()) @@ -142,6 +150,8 @@ interface NotifyServiceAsync { * within a subscription configuration. * * Events are ordered by timestamp in descending order (most recent first). + * + * In order to get access to this endpoint, contact our support team. */ fun listSubscriptionPhoneNumberEvents( phoneNumber: String, @@ -177,6 +187,8 @@ interface NotifyServiceAsync { * subscription configuration. * * You can optionally filter by subscription state (SUB or UNSUB). + * + * In order to get access to this endpoint, contact our support team. */ fun listSubscriptionPhoneNumbers( configId: String diff --git a/prelude-java-core/src/main/kotlin/so/prelude/sdk/services/blocking/NotifyService.kt b/prelude-java-core/src/main/kotlin/so/prelude/sdk/services/blocking/NotifyService.kt index 4da07157..92fecfbf 100644 --- a/prelude-java-core/src/main/kotlin/so/prelude/sdk/services/blocking/NotifyService.kt +++ b/prelude-java-core/src/main/kotlin/so/prelude/sdk/services/blocking/NotifyService.kt @@ -37,7 +37,11 @@ interface NotifyService { */ fun withOptions(modifier: Consumer): NotifyService - /** Retrieve a specific subscription management configuration by its ID. */ + /** + * Retrieve a specific subscription management configuration by its ID. + * + * In order to get access to this endpoint, contact our support team. + */ fun getSubscriptionConfig(configId: String): NotifyGetSubscriptionConfigResponse = getSubscriptionConfig(configId, NotifyGetSubscriptionConfigParams.none()) @@ -77,6 +81,8 @@ interface NotifyService { /** * Retrieve the current subscription status for a specific phone number within a subscription * configuration. + * + * In order to get access to this endpoint, contact our support team. */ fun getSubscriptionPhoneNumber( phoneNumber: String, @@ -112,6 +118,8 @@ interface NotifyService { * * Each configuration represents a subscription management setup with phone numbers for * receiving opt-out/opt-in requests and a callback URL for webhook events. + * + * In order to get access to this endpoint, contact our support team. */ fun listSubscriptionConfigs(): NotifyListSubscriptionConfigsResponse = listSubscriptionConfigs(NotifyListSubscriptionConfigsParams.none()) @@ -139,6 +147,8 @@ interface NotifyService { * within a subscription configuration. * * Events are ordered by timestamp in descending order (most recent first). + * + * In order to get access to this endpoint, contact our support team. */ fun listSubscriptionPhoneNumberEvents( phoneNumber: String, @@ -174,6 +184,8 @@ interface NotifyService { * subscription configuration. * * You can optionally filter by subscription state (SUB or UNSUB). + * + * In order to get access to this endpoint, contact our support team. */ fun listSubscriptionPhoneNumbers(configId: String): NotifyListSubscriptionPhoneNumbersResponse = listSubscriptionPhoneNumbers(configId, NotifyListSubscriptionPhoneNumbersParams.none()) diff --git a/prelude-java-core/src/test/kotlin/so/prelude/sdk/models/VerificationCreateParamsTest.kt b/prelude-java-core/src/test/kotlin/so/prelude/sdk/models/VerificationCreateParamsTest.kt index 7849508a..391e9e34 100644 --- a/prelude-java-core/src/test/kotlin/so/prelude/sdk/models/VerificationCreateParamsTest.kt +++ b/prelude-java-core/src/test/kotlin/so/prelude/sdk/models/VerificationCreateParamsTest.kt @@ -54,6 +54,7 @@ internal class VerificationCreateParamsTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -117,6 +118,7 @@ internal class VerificationCreateParamsTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -177,6 +179,7 @@ internal class VerificationCreateParamsTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") diff --git a/prelude-java-core/src/test/kotlin/so/prelude/sdk/models/WatchPredictParamsTest.kt b/prelude-java-core/src/test/kotlin/so/prelude/sdk/models/WatchPredictParamsTest.kt index 52df9bbb..362cff8d 100644 --- a/prelude-java-core/src/test/kotlin/so/prelude/sdk/models/WatchPredictParamsTest.kt +++ b/prelude-java-core/src/test/kotlin/so/prelude/sdk/models/WatchPredictParamsTest.kt @@ -24,6 +24,7 @@ internal class WatchPredictParamsTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(WatchPredictParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -56,6 +57,7 @@ internal class WatchPredictParamsTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(WatchPredictParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -86,6 +88,7 @@ internal class WatchPredictParamsTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(WatchPredictParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") diff --git a/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/ErrorHandlingTest.kt b/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/ErrorHandlingTest.kt index 1faa96e0..4e027818 100644 --- a/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/ErrorHandlingTest.kt +++ b/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/ErrorHandlingTest.kt @@ -122,6 +122,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -204,6 +205,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -286,6 +288,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -368,6 +371,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -450,6 +454,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -532,6 +537,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -614,6 +620,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -696,6 +703,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -778,6 +786,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -860,6 +869,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -942,6 +952,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -1024,6 +1035,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -1106,6 +1118,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -1188,6 +1201,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -1270,6 +1284,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -1352,6 +1367,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") @@ -1432,6 +1448,7 @@ internal class ErrorHandlingTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") diff --git a/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/ServiceParamsTest.kt b/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/ServiceParamsTest.kt index d93d0b33..460f418b 100644 --- a/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/ServiceParamsTest.kt +++ b/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/ServiceParamsTest.kt @@ -89,6 +89,7 @@ internal class ServiceParamsTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") diff --git a/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/async/VerificationServiceAsyncTest.kt b/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/async/VerificationServiceAsyncTest.kt index a6620fcf..fac0dab0 100644 --- a/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/async/VerificationServiceAsyncTest.kt +++ b/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/async/VerificationServiceAsyncTest.kt @@ -72,6 +72,7 @@ internal class VerificationServiceAsyncTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") diff --git a/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/async/WatchServiceAsyncTest.kt b/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/async/WatchServiceAsyncTest.kt index ec141ca1..b30e19a3 100644 --- a/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/async/WatchServiceAsyncTest.kt +++ b/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/async/WatchServiceAsyncTest.kt @@ -43,6 +43,7 @@ internal class WatchServiceAsyncTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(WatchPredictParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") diff --git a/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/blocking/VerificationServiceTest.kt b/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/blocking/VerificationServiceTest.kt index 6f78064b..0001a2d2 100644 --- a/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/blocking/VerificationServiceTest.kt +++ b/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/blocking/VerificationServiceTest.kt @@ -72,6 +72,7 @@ internal class VerificationServiceTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(VerificationCreateParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") diff --git a/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/blocking/WatchServiceTest.kt b/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/blocking/WatchServiceTest.kt index 8c4511a7..7bee3348 100644 --- a/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/blocking/WatchServiceTest.kt +++ b/prelude-java-core/src/test/kotlin/so/prelude/sdk/services/blocking/WatchServiceTest.kt @@ -43,6 +43,7 @@ internal class WatchServiceTest { .deviceId("8F0B8FDD-C2CB-4387-B20A-56E9B2E5A0D2") .deviceModel("iPhone17,2") .devicePlatform(WatchPredictParams.Signals.DevicePlatform.IOS) + .existingUser(false) .ip("203.0.113.123") .isTrustedUser(false) .ja4Fingerprint("t13d1516h2_8daaf6152771_e5627efa2ab1") diff --git a/scripts/mock b/scripts/mock index feebe5ed..984e1c00 100755 --- a/scripts/mock +++ b/scripts/mock @@ -4,6 +4,11 @@ set -e cd "$(dirname "$0")/.." +if [ "$1" == "--install" ]; then + npm exec --package=@stdy/cli@0.22.1 -- steady --version + exit 0 +fi + if [[ -n "$1" && "$1" != '--'* ]]; then URL="$1" shift @@ -20,16 +25,18 @@ fi echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec +MOCK_PORT="${STAINLESS_MOCK_PORT:-4010}" + if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout npm exec --package=@stdy/cli@0.22.1 -- steady --version - npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p "$MOCK_PORT" --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" attempts=0 - while ! curl --silent --fail "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1; do + while ! curl --silent --fail "http://127.0.0.1:$MOCK_PORT/_x-steady/health" >/dev/null 2>&1; do if ! kill -0 $! 2>/dev/null; then echo cat .stdy.log @@ -48,5 +55,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p "$MOCK_PORT" --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 7d7f08e3..29eb2fa9 100755 --- a/scripts/test +++ b/scripts/test @@ -9,8 +9,10 @@ GREEN='\033[0;32m' YELLOW='\033[0;33m' NC='\033[0m' # No Color +MOCK_PORT="${STAINLESS_MOCK_PORT:-4010}" + function steady_is_running() { - curl --silent "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1 + curl --silent "http://127.0.0.1:$MOCK_PORT/_x-steady/health" >/dev/null 2>&1 } kill_server_on_port() { @@ -27,7 +29,7 @@ function is_overriding_api_base_url() { if ! is_overriding_api_base_url && ! steady_is_running ; then # When we exit this script, make sure to kill the background mock server process - trap 'kill_server_on_port 4010' EXIT + trap 'kill_server_on_port "$MOCK_PORT"' EXIT # Start the dev server ./scripts/mock --daemon @@ -43,7 +45,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.22.1 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.22.1 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p $MOCK_PORT --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" echo exit 1 @@ -52,5 +54,9 @@ else echo fi +if [ -n "${STAINLESS_MOCK_PORT:-}" ] && ! is_overriding_api_base_url ; then + export TEST_API_BASE_URL="http://127.0.0.1:$MOCK_PORT" +fi + echo "==> Running tests" ./gradlew test "$@"