From 210ab8c3f739ba985d644c099a910d491c4302f9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 25 Jun 2026 20:37:47 +0000 Subject: [PATCH 1/5] docs(openapi): add full response examples to every endpoint --- .stats.yml | 6 +- .../com/courier/client/CourierClient.kt | 6 +- .../com/courier/client/CourierClientAsync.kt | 6 +- .../courier/client/CourierClientAsyncImpl.kt | 18 +- .../com/courier/client/CourierClientImpl.kt | 18 +- .../PublishPreferencesResponse.kt | 2 +- .../WorkspacePreferenceArchiveParams.kt} | 40 +- .../WorkspacePreferenceCreateParams.kt} | 68 +-- .../WorkspacePreferenceCreateRequest.kt} | 47 +- .../WorkspacePreferenceGetResponse.kt} | 89 ++-- .../WorkspacePreferenceListParams.kt} | 31 +- .../WorkspacePreferenceListResponse.kt} | 54 +-- .../WorkspacePreferencePublishParams.kt} | 40 +- .../WorkspacePreferenceReplaceParams.kt} | 75 +-- .../WorkspacePreferenceReplaceRequest.kt} | 56 +-- .../WorkspacePreferenceRetrieveParams.kt} | 30 +- .../WorkspacePreferenceTopicCreateRequest.kt} | 42 +- .../WorkspacePreferenceTopicGetResponse.kt} | 51 ++- .../WorkspacePreferenceTopicListResponse.kt} | 55 ++- ...WorkspacePreferenceTopicReplaceRequest.kt} | 41 +- .../topics/TopicArchiveParams.kt | 4 +- .../topics/TopicCreateParams.kt | 46 +- .../topics/TopicListParams.kt | 4 +- .../topics/TopicReplaceParams.kt | 49 +- .../topics/TopicRetrieveParams.kt | 6 +- .../async/PreferenceSectionServiceAsync.kt | 428 ----------------- .../async/WorkspacePreferenceServiceAsync.kt | 428 +++++++++++++++++ ...=> WorkspacePreferenceServiceAsyncImpl.kt} | 99 ++-- .../TopicServiceAsync.kt | 109 ++--- .../TopicServiceAsyncImpl.kt | 48 +- .../blocking/PreferenceSectionService.kt | 427 ----------------- .../blocking/WorkspacePreferenceService.kt | 431 ++++++++++++++++++ ...l.kt => WorkspacePreferenceServiceImpl.kt} | 98 ++-- .../TopicService.kt | 118 ++--- .../TopicServiceImpl.kt | 48 +- .../PreferenceSectionListParamsTest.kt | 13 - .../PreferenceSectionPublishParamsTest.kt | 13 - .../PreferenceSectionReplaceRequestTest.kt | 48 -- .../PreferenceTopicCreateRequestTest.kt | 72 --- .../PreferenceTopicGetResponseTest.kt | 86 ---- .../PreferenceTopicReplaceRequestTest.kt | 73 --- .../PublishPreferencesResponseTest.kt | 2 +- .../WorkspacePreferenceArchiveParamsTest.kt} | 8 +- .../WorkspacePreferenceCreateParamsTest.kt} | 26 +- .../WorkspacePreferenceCreateRequestTest.kt} | 28 +- .../WorkspacePreferenceGetResponseTest.kt} | 69 +-- .../WorkspacePreferenceListParamsTest.kt | 13 + .../WorkspacePreferenceListResponseTest.kt} | 60 +-- .../WorkspacePreferencePublishParamsTest.kt | 13 + .../WorkspacePreferenceReplaceParamsTest.kt} | 32 +- .../WorkspacePreferenceReplaceRequestTest.kt | 48 ++ .../WorkspacePreferenceRetrieveParamsTest.kt} | 8 +- ...rkspacePreferenceTopicCreateRequestTest.kt | 77 ++++ ...WorkspacePreferenceTopicGetResponseTest.kt | 87 ++++ ...rkspacePreferenceTopicListResponseTest.kt} | 53 ++- ...kspacePreferenceTopicReplaceRequestTest.kt | 77 ++++ .../topics/TopicArchiveParamsTest.kt | 2 +- .../topics/TopicCreateParamsTest.kt | 60 ++- .../topics/TopicListParamsTest.kt | 2 +- .../topics/TopicReplaceParamsTest.kt | 58 ++- .../topics/TopicRetrieveParamsTest.kt | 2 +- .../PreferenceSectionServiceAsyncTest.kt | 105 ----- .../WorkspacePreferenceServiceAsyncTest.kt | 105 +++++ .../TopicServiceAsyncTest.kt | 72 +-- ...t.kt => WorkspacePreferenceServiceTest.kt} | 52 +-- .../TopicServiceTest.kt | 64 +-- .../proguard/ProGuardCompatibilityTest.kt | 2 +- 67 files changed, 2345 insertions(+), 2203 deletions(-) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections => workspacepreferences}/PublishPreferencesResponse.kt (99%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections/PreferenceSectionArchiveParams.kt => workspacepreferences/WorkspacePreferenceArchiveParams.kt} (84%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections/PreferenceSectionCreateParams.kt => workspacepreferences/WorkspacePreferenceCreateParams.kt} (70%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections/PreferenceSectionReplaceRequest.kt => workspacepreferences/WorkspacePreferenceCreateRequest.kt} (86%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections/PreferenceSectionGetResponse.kt => workspacepreferences/WorkspacePreferenceGetResponse.kt} (84%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections/PreferenceSectionListParams.kt => workspacepreferences/WorkspacePreferenceListParams.kt} (83%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections/PreferenceSectionListResponse.kt => workspacepreferences/WorkspacePreferenceListResponse.kt} (73%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections/PreferenceSectionPublishParams.kt => workspacepreferences/WorkspacePreferencePublishParams.kt} (84%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections/PreferenceSectionReplaceParams.kt => workspacepreferences/WorkspacePreferenceReplaceParams.kt} (71%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections/PreferenceSectionCreateRequest.kt => workspacepreferences/WorkspacePreferenceReplaceRequest.kt} (85%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections/PreferenceSectionRetrieveParams.kt => workspacepreferences/WorkspacePreferenceRetrieveParams.kt} (85%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections/PreferenceTopicCreateRequest.kt => workspacepreferences/WorkspacePreferenceTopicCreateRequest.kt} (95%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections/PreferenceTopicGetResponse.kt => workspacepreferences/WorkspacePreferenceTopicGetResponse.kt} (95%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections/PreferenceTopicListResponse.kt => workspacepreferences/WorkspacePreferenceTopicListResponse.kt} (72%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections/PreferenceTopicReplaceRequest.kt => workspacepreferences/WorkspacePreferenceTopicReplaceRequest.kt} (95%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections => workspacepreferences}/topics/TopicArchiveParams.kt (98%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections => workspacepreferences}/topics/TopicCreateParams.kt (79%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections => workspacepreferences}/topics/TopicListParams.kt (98%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections => workspacepreferences}/topics/TopicReplaceParams.kt (81%) rename courier-java-core/src/main/kotlin/com/courier/models/{preferencesections => workspacepreferences}/topics/TopicRetrieveParams.kt (96%) delete mode 100644 courier-java-core/src/main/kotlin/com/courier/services/async/PreferenceSectionServiceAsync.kt create mode 100644 courier-java-core/src/main/kotlin/com/courier/services/async/WorkspacePreferenceServiceAsync.kt rename courier-java-core/src/main/kotlin/com/courier/services/async/{PreferenceSectionServiceAsyncImpl.kt => WorkspacePreferenceServiceAsyncImpl.kt} (76%) rename courier-java-core/src/main/kotlin/com/courier/services/async/{preferencesections => workspacepreferences}/TopicServiceAsync.kt (69%) rename courier-java-core/src/main/kotlin/com/courier/services/async/{preferencesections => workspacepreferences}/TopicServiceAsyncImpl.kt (85%) delete mode 100644 courier-java-core/src/main/kotlin/com/courier/services/blocking/PreferenceSectionService.kt create mode 100644 courier-java-core/src/main/kotlin/com/courier/services/blocking/WorkspacePreferenceService.kt rename courier-java-core/src/main/kotlin/com/courier/services/blocking/{PreferenceSectionServiceImpl.kt => WorkspacePreferenceServiceImpl.kt} (74%) rename courier-java-core/src/main/kotlin/com/courier/services/blocking/{preferencesections => workspacepreferences}/TopicService.kt (69%) rename courier-java-core/src/main/kotlin/com/courier/services/blocking/{preferencesections => workspacepreferences}/TopicServiceImpl.kt (84%) delete mode 100644 courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionListParamsTest.kt delete mode 100644 courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionPublishParamsTest.kt delete mode 100644 courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionReplaceRequestTest.kt delete mode 100644 courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceTopicCreateRequestTest.kt delete mode 100644 courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceTopicGetResponseTest.kt delete mode 100644 courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceTopicReplaceRequestTest.kt rename courier-java-core/src/test/kotlin/com/courier/models/{preferencesections => workspacepreferences}/PublishPreferencesResponseTest.kt (97%) rename courier-java-core/src/test/kotlin/com/courier/models/{preferencesections/PreferenceSectionArchiveParamsTest.kt => workspacepreferences/WorkspacePreferenceArchiveParamsTest.kt} (57%) rename courier-java-core/src/test/kotlin/com/courier/models/{preferencesections/PreferenceSectionCreateParamsTest.kt => workspacepreferences/WorkspacePreferenceCreateParamsTest.kt} (62%) rename courier-java-core/src/test/kotlin/com/courier/models/{preferencesections/PreferenceSectionCreateRequestTest.kt => workspacepreferences/WorkspacePreferenceCreateRequestTest.kt} (50%) rename courier-java-core/src/test/kotlin/com/courier/models/{preferencesections/PreferenceSectionGetResponseTest.kt => workspacepreferences/WorkspacePreferenceGetResponseTest.kt} (55%) create mode 100644 courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceListParamsTest.kt rename courier-java-core/src/test/kotlin/com/courier/models/{preferencesections/PreferenceSectionListResponseTest.kt => workspacepreferences/WorkspacePreferenceListResponseTest.kt} (66%) create mode 100644 courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferencePublishParamsTest.kt rename courier-java-core/src/test/kotlin/com/courier/models/{preferencesections/PreferenceSectionReplaceParamsTest.kt => workspacepreferences/WorkspacePreferenceReplaceParamsTest.kt} (62%) create mode 100644 courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceReplaceRequestTest.kt rename courier-java-core/src/test/kotlin/com/courier/models/{preferencesections/PreferenceSectionRetrieveParamsTest.kt => workspacepreferences/WorkspacePreferenceRetrieveParamsTest.kt} (56%) create mode 100644 courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicCreateRequestTest.kt create mode 100644 courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicGetResponseTest.kt rename courier-java-core/src/test/kotlin/com/courier/models/{preferencesections/PreferenceTopicListResponseTest.kt => workspacepreferences/WorkspacePreferenceTopicListResponseTest.kt} (55%) create mode 100644 courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicReplaceRequestTest.kt rename courier-java-core/src/test/kotlin/com/courier/models/{preferencesections => workspacepreferences}/topics/TopicArchiveParamsTest.kt (92%) rename courier-java-core/src/test/kotlin/com/courier/models/{preferencesections => workspacepreferences}/topics/TopicCreateParamsTest.kt (54%) rename courier-java-core/src/test/kotlin/com/courier/models/{preferencesections => workspacepreferences}/topics/TopicListParamsTest.kt (91%) rename courier-java-core/src/test/kotlin/com/courier/models/{preferencesections => workspacepreferences}/topics/TopicReplaceParamsTest.kt (57%) rename courier-java-core/src/test/kotlin/com/courier/models/{preferencesections => workspacepreferences}/topics/TopicRetrieveParamsTest.kt (92%) delete mode 100644 courier-java-core/src/test/kotlin/com/courier/services/async/PreferenceSectionServiceAsyncTest.kt create mode 100644 courier-java-core/src/test/kotlin/com/courier/services/async/WorkspacePreferenceServiceAsyncTest.kt rename courier-java-core/src/test/kotlin/com/courier/services/async/{preferencesections => workspacepreferences}/TopicServiceAsyncTest.kt (52%) rename courier-java-core/src/test/kotlin/com/courier/services/blocking/{PreferenceSectionServiceTest.kt => WorkspacePreferenceServiceTest.kt} (52%) rename courier-java-core/src/test/kotlin/com/courier/services/blocking/{preferencesections => workspacepreferences}/TopicServiceTest.kt (55%) diff --git a/.stats.yml b/.stats.yml index f3898c2..d5483cd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 134 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-43eec5d4d385a6c770298238ca0e4f708c8ff9fffe5e219ff5d78c6cdfe41fce.yml -openapi_spec_hash: a3e0abc4d8caed45f43ee83d50e5cb95 -config_hash: 83c79a6ad0a0b5dcce3b85208026343b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-ce444e85aa0c52b8598fa416a43acc05e079904f2ed523fc61b2c86d133f2a94.yml +openapi_spec_hash: 554fe5462296f1734b2a0a9545c0a16e +config_hash: 74aad10d1512ec69541ece3ca51cf7fa diff --git a/courier-java-core/src/main/kotlin/com/courier/client/CourierClient.kt b/courier-java-core/src/main/kotlin/com/courier/client/CourierClient.kt index 392b1f9..ac03c4a 100644 --- a/courier-java-core/src/main/kotlin/com/courier/client/CourierClient.kt +++ b/courier-java-core/src/main/kotlin/com/courier/client/CourierClient.kt @@ -15,7 +15,6 @@ import com.courier.services.blocking.JourneyService import com.courier.services.blocking.ListService import com.courier.services.blocking.MessageService import com.courier.services.blocking.NotificationService -import com.courier.services.blocking.PreferenceSectionService import com.courier.services.blocking.ProfileService import com.courier.services.blocking.ProviderService import com.courier.services.blocking.RequestService @@ -24,6 +23,7 @@ import com.courier.services.blocking.SendService import com.courier.services.blocking.TenantService import com.courier.services.blocking.TranslationService import com.courier.services.blocking.UserService +import com.courier.services.blocking.WorkspacePreferenceService import java.util.function.Consumer /** @@ -94,7 +94,7 @@ interface CourierClient { fun routingStrategies(): RoutingStrategyService - fun preferenceSections(): PreferenceSectionService + fun workspacePreferences(): WorkspacePreferenceService fun profiles(): ProfileService @@ -159,7 +159,7 @@ interface CourierClient { fun routingStrategies(): RoutingStrategyService.WithRawResponse - fun preferenceSections(): PreferenceSectionService.WithRawResponse + fun workspacePreferences(): WorkspacePreferenceService.WithRawResponse fun profiles(): ProfileService.WithRawResponse diff --git a/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsync.kt b/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsync.kt index 8070b04..49c95d6 100644 --- a/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsync.kt +++ b/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsync.kt @@ -15,7 +15,6 @@ import com.courier.services.async.JourneyServiceAsync import com.courier.services.async.ListServiceAsync import com.courier.services.async.MessageServiceAsync import com.courier.services.async.NotificationServiceAsync -import com.courier.services.async.PreferenceSectionServiceAsync import com.courier.services.async.ProfileServiceAsync import com.courier.services.async.ProviderServiceAsync import com.courier.services.async.RequestServiceAsync @@ -24,6 +23,7 @@ import com.courier.services.async.SendServiceAsync import com.courier.services.async.TenantServiceAsync import com.courier.services.async.TranslationServiceAsync import com.courier.services.async.UserServiceAsync +import com.courier.services.async.WorkspacePreferenceServiceAsync import java.util.function.Consumer /** @@ -94,7 +94,7 @@ interface CourierClientAsync { fun routingStrategies(): RoutingStrategyServiceAsync - fun preferenceSections(): PreferenceSectionServiceAsync + fun workspacePreferences(): WorkspacePreferenceServiceAsync fun profiles(): ProfileServiceAsync @@ -163,7 +163,7 @@ interface CourierClientAsync { fun routingStrategies(): RoutingStrategyServiceAsync.WithRawResponse - fun preferenceSections(): PreferenceSectionServiceAsync.WithRawResponse + fun workspacePreferences(): WorkspacePreferenceServiceAsync.WithRawResponse fun profiles(): ProfileServiceAsync.WithRawResponse diff --git a/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsyncImpl.kt b/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsyncImpl.kt index a242769..7ed9cb0 100644 --- a/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsyncImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/client/CourierClientAsyncImpl.kt @@ -28,8 +28,6 @@ import com.courier.services.async.MessageServiceAsync import com.courier.services.async.MessageServiceAsyncImpl import com.courier.services.async.NotificationServiceAsync import com.courier.services.async.NotificationServiceAsyncImpl -import com.courier.services.async.PreferenceSectionServiceAsync -import com.courier.services.async.PreferenceSectionServiceAsyncImpl import com.courier.services.async.ProfileServiceAsync import com.courier.services.async.ProfileServiceAsyncImpl import com.courier.services.async.ProviderServiceAsync @@ -46,6 +44,8 @@ import com.courier.services.async.TranslationServiceAsync import com.courier.services.async.TranslationServiceAsyncImpl import com.courier.services.async.UserServiceAsync import com.courier.services.async.UserServiceAsyncImpl +import com.courier.services.async.WorkspacePreferenceServiceAsync +import com.courier.services.async.WorkspacePreferenceServiceAsyncImpl import java.util.function.Consumer class CourierClientAsyncImpl(private val clientOptions: ClientOptions) : CourierClientAsync { @@ -121,8 +121,8 @@ class CourierClientAsyncImpl(private val clientOptions: ClientOptions) : Courier RoutingStrategyServiceAsyncImpl(clientOptionsWithUserAgent) } - private val preferenceSections: PreferenceSectionServiceAsync by lazy { - PreferenceSectionServiceAsyncImpl(clientOptionsWithUserAgent) + private val workspacePreferences: WorkspacePreferenceServiceAsync by lazy { + WorkspacePreferenceServiceAsyncImpl(clientOptionsWithUserAgent) } private val profiles: ProfileServiceAsync by lazy { @@ -178,7 +178,7 @@ class CourierClientAsyncImpl(private val clientOptions: ClientOptions) : Courier override fun routingStrategies(): RoutingStrategyServiceAsync = routingStrategies - override fun preferenceSections(): PreferenceSectionServiceAsync = preferenceSections + override fun workspacePreferences(): WorkspacePreferenceServiceAsync = workspacePreferences override fun profiles(): ProfileServiceAsync = profiles @@ -257,8 +257,8 @@ class CourierClientAsyncImpl(private val clientOptions: ClientOptions) : Courier RoutingStrategyServiceAsyncImpl.WithRawResponseImpl(clientOptions) } - private val preferenceSections: PreferenceSectionServiceAsync.WithRawResponse by lazy { - PreferenceSectionServiceAsyncImpl.WithRawResponseImpl(clientOptions) + private val workspacePreferences: WorkspacePreferenceServiceAsync.WithRawResponse by lazy { + WorkspacePreferenceServiceAsyncImpl.WithRawResponseImpl(clientOptions) } private val profiles: ProfileServiceAsync.WithRawResponse by lazy { @@ -317,8 +317,8 @@ class CourierClientAsyncImpl(private val clientOptions: ClientOptions) : Courier override fun routingStrategies(): RoutingStrategyServiceAsync.WithRawResponse = routingStrategies - override fun preferenceSections(): PreferenceSectionServiceAsync.WithRawResponse = - preferenceSections + override fun workspacePreferences(): WorkspacePreferenceServiceAsync.WithRawResponse = + workspacePreferences override fun profiles(): ProfileServiceAsync.WithRawResponse = profiles diff --git a/courier-java-core/src/main/kotlin/com/courier/client/CourierClientImpl.kt b/courier-java-core/src/main/kotlin/com/courier/client/CourierClientImpl.kt index b1383bb..235fe76 100644 --- a/courier-java-core/src/main/kotlin/com/courier/client/CourierClientImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/client/CourierClientImpl.kt @@ -28,8 +28,6 @@ import com.courier.services.blocking.MessageService import com.courier.services.blocking.MessageServiceImpl import com.courier.services.blocking.NotificationService import com.courier.services.blocking.NotificationServiceImpl -import com.courier.services.blocking.PreferenceSectionService -import com.courier.services.blocking.PreferenceSectionServiceImpl import com.courier.services.blocking.ProfileService import com.courier.services.blocking.ProfileServiceImpl import com.courier.services.blocking.ProviderService @@ -46,6 +44,8 @@ import com.courier.services.blocking.TranslationService import com.courier.services.blocking.TranslationServiceImpl import com.courier.services.blocking.UserService import com.courier.services.blocking.UserServiceImpl +import com.courier.services.blocking.WorkspacePreferenceService +import com.courier.services.blocking.WorkspacePreferenceServiceImpl import java.util.function.Consumer class CourierClientImpl(private val clientOptions: ClientOptions) : CourierClient { @@ -109,8 +109,8 @@ class CourierClientImpl(private val clientOptions: ClientOptions) : CourierClien RoutingStrategyServiceImpl(clientOptionsWithUserAgent) } - private val preferenceSections: PreferenceSectionService by lazy { - PreferenceSectionServiceImpl(clientOptionsWithUserAgent) + private val workspacePreferences: WorkspacePreferenceService by lazy { + WorkspacePreferenceServiceImpl(clientOptionsWithUserAgent) } private val profiles: ProfileService by lazy { ProfileServiceImpl(clientOptionsWithUserAgent) } @@ -162,7 +162,7 @@ class CourierClientImpl(private val clientOptions: ClientOptions) : CourierClien override fun routingStrategies(): RoutingStrategyService = routingStrategies - override fun preferenceSections(): PreferenceSectionService = preferenceSections + override fun workspacePreferences(): WorkspacePreferenceService = workspacePreferences override fun profiles(): ProfileService = profiles @@ -241,8 +241,8 @@ class CourierClientImpl(private val clientOptions: ClientOptions) : CourierClien RoutingStrategyServiceImpl.WithRawResponseImpl(clientOptions) } - private val preferenceSections: PreferenceSectionService.WithRawResponse by lazy { - PreferenceSectionServiceImpl.WithRawResponseImpl(clientOptions) + private val workspacePreferences: WorkspacePreferenceService.WithRawResponse by lazy { + WorkspacePreferenceServiceImpl.WithRawResponseImpl(clientOptions) } private val profiles: ProfileService.WithRawResponse by lazy { @@ -300,8 +300,8 @@ class CourierClientImpl(private val clientOptions: ClientOptions) : CourierClien override fun routingStrategies(): RoutingStrategyService.WithRawResponse = routingStrategies - override fun preferenceSections(): PreferenceSectionService.WithRawResponse = - preferenceSections + override fun workspacePreferences(): WorkspacePreferenceService.WithRawResponse = + workspacePreferences override fun profiles(): ProfileService.WithRawResponse = profiles diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PublishPreferencesResponse.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/PublishPreferencesResponse.kt similarity index 99% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PublishPreferencesResponse.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/PublishPreferencesResponse.kt index 780a0ea..6949c46 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PublishPreferencesResponse.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/PublishPreferencesResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.ExcludeMissing import com.courier.core.JsonField diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionArchiveParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceArchiveParams.kt similarity index 84% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionArchiveParams.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceArchiveParams.kt index 2fcbc96..853b512 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionArchiveParams.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceArchiveParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.JsonValue import com.courier.core.Params @@ -12,10 +12,10 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Archive a preference section. The section must be empty: delete its topics first, otherwise the - * request fails with 409. + * Archive a workspace preference. The workspace preference must be empty: delete its topics first, + * otherwise the request fails with 409. */ -class PreferenceSectionArchiveParams +class WorkspacePreferenceArchiveParams private constructor( private val sectionId: String?, private val additionalHeaders: Headers, @@ -38,16 +38,16 @@ private constructor( companion object { - @JvmStatic fun none(): PreferenceSectionArchiveParams = builder().build() + @JvmStatic fun none(): WorkspacePreferenceArchiveParams = builder().build() /** * Returns a mutable builder for constructing an instance of - * [PreferenceSectionArchiveParams]. + * [WorkspacePreferenceArchiveParams]. */ @JvmStatic fun builder() = Builder() } - /** A builder for [PreferenceSectionArchiveParams]. */ + /** A builder for [WorkspacePreferenceArchiveParams]. */ class Builder internal constructor() { private var sectionId: String? = null @@ -56,13 +56,15 @@ private constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(preferenceSectionArchiveParams: PreferenceSectionArchiveParams) = apply { - sectionId = preferenceSectionArchiveParams.sectionId - additionalHeaders = preferenceSectionArchiveParams.additionalHeaders.toBuilder() - additionalQueryParams = preferenceSectionArchiveParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - preferenceSectionArchiveParams.additionalBodyProperties.toMutableMap() - } + internal fun from(workspacePreferenceArchiveParams: WorkspacePreferenceArchiveParams) = + apply { + sectionId = workspacePreferenceArchiveParams.sectionId + additionalHeaders = workspacePreferenceArchiveParams.additionalHeaders.toBuilder() + additionalQueryParams = + workspacePreferenceArchiveParams.additionalQueryParams.toBuilder() + additionalBodyProperties = + workspacePreferenceArchiveParams.additionalBodyProperties.toMutableMap() + } fun sectionId(sectionId: String?) = apply { this.sectionId = sectionId } @@ -190,12 +192,12 @@ private constructor( } /** - * Returns an immutable instance of [PreferenceSectionArchiveParams]. + * Returns an immutable instance of [WorkspacePreferenceArchiveParams]. * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): PreferenceSectionArchiveParams = - PreferenceSectionArchiveParams( + fun build(): WorkspacePreferenceArchiveParams = + WorkspacePreferenceArchiveParams( sectionId, additionalHeaders.build(), additionalQueryParams.build(), @@ -221,7 +223,7 @@ private constructor( return true } - return other is PreferenceSectionArchiveParams && + return other is WorkspacePreferenceArchiveParams && sectionId == other.sectionId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && @@ -232,5 +234,5 @@ private constructor( Objects.hash(sectionId, additionalHeaders, additionalQueryParams, additionalBodyProperties) override fun toString() = - "PreferenceSectionArchiveParams{sectionId=$sectionId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "WorkspacePreferenceArchiveParams{sectionId=$sectionId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionCreateParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceCreateParams.kt similarity index 70% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionCreateParams.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceCreateParams.kt index a175a88..307c594 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionCreateParams.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceCreateParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.JsonValue import com.courier.core.Params @@ -10,22 +10,22 @@ import com.courier.core.http.QueryParams import java.util.Objects /** - * Create a preference section in your workspace. The section id is generated and returned. Topics - * are created inside a section via POST /preferences/sections/{section_id}/topics. + * Create a workspace preference. The workspace preference id is generated and returned. Topics are + * created inside a workspace preference via POST /preferences/sections/{section_id}/topics. */ -class PreferenceSectionCreateParams +class WorkspacePreferenceCreateParams private constructor( - private val preferenceSectionCreateRequest: PreferenceSectionCreateRequest, + private val workspacePreferenceCreateRequest: WorkspacePreferenceCreateRequest, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - /** Request body for creating a preference section. */ - fun preferenceSectionCreateRequest(): PreferenceSectionCreateRequest = - preferenceSectionCreateRequest + /** Request body for creating a workspace preference. */ + fun workspacePreferenceCreateRequest(): WorkspacePreferenceCreateRequest = + workspacePreferenceCreateRequest fun _additionalBodyProperties(): Map = - preferenceSectionCreateRequest._additionalProperties() + workspacePreferenceCreateRequest._additionalProperties() /** Additional headers to send with the request. */ fun _additionalHeaders(): Headers = additionalHeaders @@ -39,35 +39,37 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PreferenceSectionCreateParams]. + * [WorkspacePreferenceCreateParams]. * * The following fields are required: * ```java - * .preferenceSectionCreateRequest() + * .workspacePreferenceCreateRequest() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [PreferenceSectionCreateParams]. */ + /** A builder for [WorkspacePreferenceCreateParams]. */ class Builder internal constructor() { - private var preferenceSectionCreateRequest: PreferenceSectionCreateRequest? = null + private var workspacePreferenceCreateRequest: WorkspacePreferenceCreateRequest? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic - internal fun from(preferenceSectionCreateParams: PreferenceSectionCreateParams) = apply { - preferenceSectionCreateRequest = - preferenceSectionCreateParams.preferenceSectionCreateRequest - additionalHeaders = preferenceSectionCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = preferenceSectionCreateParams.additionalQueryParams.toBuilder() - } + internal fun from(workspacePreferenceCreateParams: WorkspacePreferenceCreateParams) = + apply { + workspacePreferenceCreateRequest = + workspacePreferenceCreateParams.workspacePreferenceCreateRequest + additionalHeaders = workspacePreferenceCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = + workspacePreferenceCreateParams.additionalQueryParams.toBuilder() + } - /** Request body for creating a preference section. */ - fun preferenceSectionCreateRequest( - preferenceSectionCreateRequest: PreferenceSectionCreateRequest - ) = apply { this.preferenceSectionCreateRequest = preferenceSectionCreateRequest } + /** Request body for creating a workspace preference. */ + fun workspacePreferenceCreateRequest( + workspacePreferenceCreateRequest: WorkspacePreferenceCreateRequest + ) = apply { this.workspacePreferenceCreateRequest = workspacePreferenceCreateRequest } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -168,26 +170,26 @@ private constructor( } /** - * Returns an immutable instance of [PreferenceSectionCreateParams]. + * Returns an immutable instance of [WorkspacePreferenceCreateParams]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .preferenceSectionCreateRequest() + * .workspacePreferenceCreateRequest() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): PreferenceSectionCreateParams = - PreferenceSectionCreateParams( - checkRequired("preferenceSectionCreateRequest", preferenceSectionCreateRequest), + fun build(): WorkspacePreferenceCreateParams = + WorkspacePreferenceCreateParams( + checkRequired("workspacePreferenceCreateRequest", workspacePreferenceCreateRequest), additionalHeaders.build(), additionalQueryParams.build(), ) } - fun _body(): PreferenceSectionCreateRequest = preferenceSectionCreateRequest + fun _body(): WorkspacePreferenceCreateRequest = workspacePreferenceCreateRequest override fun _headers(): Headers = additionalHeaders @@ -198,15 +200,15 @@ private constructor( return true } - return other is PreferenceSectionCreateParams && - preferenceSectionCreateRequest == other.preferenceSectionCreateRequest && + return other is WorkspacePreferenceCreateParams && + workspacePreferenceCreateRequest == other.workspacePreferenceCreateRequest && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams } override fun hashCode(): Int = - Objects.hash(preferenceSectionCreateRequest, additionalHeaders, additionalQueryParams) + Objects.hash(workspacePreferenceCreateRequest, additionalHeaders, additionalQueryParams) override fun toString() = - "PreferenceSectionCreateParams{preferenceSectionCreateRequest=$preferenceSectionCreateRequest, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "WorkspacePreferenceCreateParams{workspacePreferenceCreateRequest=$workspacePreferenceCreateRequest, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionReplaceRequest.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceCreateRequest.kt similarity index 86% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionReplaceRequest.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceCreateRequest.kt index 5dd8264..c4a7c5b 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionReplaceRequest.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceCreateRequest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.ExcludeMissing import com.courier.core.JsonField @@ -20,11 +20,8 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** - * Request body for replacing a preference section. Full document replacement; missing optional - * fields are cleared. - */ -class PreferenceSectionReplaceRequest +/** Request body for creating a workspace preference. */ +class WorkspacePreferenceCreateRequest @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val name: JsonField, @@ -45,7 +42,7 @@ private constructor( ) : this(name, hasCustomRouting, routingOptions, mutableMapOf()) /** - * Human-readable name for the section. + * Human-readable name for the workspace preference. * * @throws CourierInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -53,7 +50,7 @@ private constructor( fun name(): String = name.getRequired("name") /** - * Whether the section defines custom routing for its topics. + * Whether the workspace preference defines custom routing for its topics. * * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -61,7 +58,7 @@ private constructor( fun hasCustomRouting(): Optional = hasCustomRouting.getOptional("has_custom_routing") /** - * Default channels for the section. Omit to clear. + * Default channels for the workspace preference. Defaults to empty if omitted. * * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -111,7 +108,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PreferenceSectionReplaceRequest]. + * [WorkspacePreferenceCreateRequest]. * * The following fields are required: * ```java @@ -121,7 +118,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PreferenceSectionReplaceRequest]. */ + /** A builder for [WorkspacePreferenceCreateRequest]. */ class Builder internal constructor() { private var name: JsonField? = null @@ -130,17 +127,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(preferenceSectionReplaceRequest: PreferenceSectionReplaceRequest) = + internal fun from(workspacePreferenceCreateRequest: WorkspacePreferenceCreateRequest) = apply { - name = preferenceSectionReplaceRequest.name - hasCustomRouting = preferenceSectionReplaceRequest.hasCustomRouting + name = workspacePreferenceCreateRequest.name + hasCustomRouting = workspacePreferenceCreateRequest.hasCustomRouting routingOptions = - preferenceSectionReplaceRequest.routingOptions.map { it.toMutableList() } + workspacePreferenceCreateRequest.routingOptions.map { it.toMutableList() } additionalProperties = - preferenceSectionReplaceRequest.additionalProperties.toMutableMap() + workspacePreferenceCreateRequest.additionalProperties.toMutableMap() } - /** Human-readable name for the section. */ + /** Human-readable name for the workspace preference. */ fun name(name: String) = name(JsonField.of(name)) /** @@ -151,7 +148,7 @@ private constructor( */ fun name(name: JsonField) = apply { this.name = name } - /** Whether the section defines custom routing for its topics. */ + /** Whether the workspace preference defines custom routing for its topics. */ fun hasCustomRouting(hasCustomRouting: Boolean?) = hasCustomRouting(JsonField.ofNullable(hasCustomRouting)) @@ -178,7 +175,7 @@ private constructor( this.hasCustomRouting = hasCustomRouting } - /** Default channels for the section. Omit to clear. */ + /** Default channels for the workspace preference. Defaults to empty if omitted. */ fun routingOptions(routingOptions: List?) = routingOptions(JsonField.ofNullable(routingOptions)) @@ -229,7 +226,7 @@ private constructor( } /** - * Returns an immutable instance of [PreferenceSectionReplaceRequest]. + * Returns an immutable instance of [WorkspacePreferenceCreateRequest]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -240,8 +237,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PreferenceSectionReplaceRequest = - PreferenceSectionReplaceRequest( + fun build(): WorkspacePreferenceCreateRequest = + WorkspacePreferenceCreateRequest( checkRequired("name", name), hasCustomRouting, (routingOptions ?: JsonMissing.of()).map { it.toImmutable() }, @@ -259,7 +256,7 @@ private constructor( * @throws CourierInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): PreferenceSectionReplaceRequest = apply { + fun validate(): WorkspacePreferenceCreateRequest = apply { if (validated) { return@apply } @@ -294,7 +291,7 @@ private constructor( return true } - return other is PreferenceSectionReplaceRequest && + return other is WorkspacePreferenceCreateRequest && name == other.name && hasCustomRouting == other.hasCustomRouting && routingOptions == other.routingOptions && @@ -308,5 +305,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PreferenceSectionReplaceRequest{name=$name, hasCustomRouting=$hasCustomRouting, routingOptions=$routingOptions, additionalProperties=$additionalProperties}" + "WorkspacePreferenceCreateRequest{name=$name, hasCustomRouting=$hasCustomRouting, routingOptions=$routingOptions, additionalProperties=$additionalProperties}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionGetResponse.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceGetResponse.kt similarity index 84% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionGetResponse.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceGetResponse.kt index 2b200ea..517d171 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionGetResponse.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceGetResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.ExcludeMissing import com.courier.core.JsonField @@ -20,8 +20,8 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** A preference section in your workspace, including its topics. */ -class PreferenceSectionGetResponse +/** A workspace preference in your workspace, including its topics. */ +class WorkspacePreferenceGetResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val id: JsonField, @@ -29,7 +29,7 @@ private constructor( private val hasCustomRouting: JsonField, private val name: JsonField, private val routingOptions: JsonField>, - private val topics: JsonField>, + private val topics: JsonField>, private val creator: JsonField, private val updated: JsonField, private val updater: JsonField, @@ -49,7 +49,7 @@ private constructor( routingOptions: JsonField> = JsonMissing.of(), @JsonProperty("topics") @ExcludeMissing - topics: JsonField> = JsonMissing.of(), + topics: JsonField> = JsonMissing.of(), @JsonProperty("creator") @ExcludeMissing creator: JsonField = JsonMissing.of(), @JsonProperty("updated") @ExcludeMissing updated: JsonField = JsonMissing.of(), @JsonProperty("updater") @ExcludeMissing updater: JsonField = JsonMissing.of(), @@ -67,7 +67,7 @@ private constructor( ) /** - * The preference section id. + * The workspace preference id. * * @throws CourierInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -75,7 +75,7 @@ private constructor( fun id(): String = id.getRequired("id") /** - * ISO-8601 timestamp of when the section was created. + * ISO-8601 timestamp of when the workspace preference was created. * * @throws CourierInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -83,7 +83,7 @@ private constructor( fun created(): String = created.getRequired("created") /** - * Whether the section defines custom routing for its topics. + * Whether the workspace preference defines custom routing for its topics. * * @throws CourierInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -99,7 +99,7 @@ private constructor( fun name(): String = name.getRequired("name") /** - * Default channels for the section. May be empty. + * Default channels for the workspace preference. May be empty. * * @throws CourierInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -108,12 +108,12 @@ private constructor( routingOptions.getRequired("routing_options") /** - * The topics contained in this section. + * The topics contained in this workspace preference. * * @throws CourierInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun topics(): List = topics.getRequired("topics") + fun topics(): List = topics.getRequired("topics") /** * Id of the creator. @@ -186,7 +186,7 @@ private constructor( */ @JsonProperty("topics") @ExcludeMissing - fun _topics(): JsonField> = topics + fun _topics(): JsonField> = topics /** * Returns the raw JSON value of [creator]. @@ -224,7 +224,8 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [PreferenceSectionGetResponse]. + * Returns a mutable builder for constructing an instance of + * [WorkspacePreferenceGetResponse]. * * The following fields are required: * ```java @@ -239,7 +240,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PreferenceSectionGetResponse]. */ + /** A builder for [WorkspacePreferenceGetResponse]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -247,27 +248,29 @@ private constructor( private var hasCustomRouting: JsonField? = null private var name: JsonField? = null private var routingOptions: JsonField>? = null - private var topics: JsonField>? = null + private var topics: JsonField>? = null private var creator: JsonField = JsonMissing.of() private var updated: JsonField = JsonMissing.of() private var updater: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(preferenceSectionGetResponse: PreferenceSectionGetResponse) = apply { - id = preferenceSectionGetResponse.id - created = preferenceSectionGetResponse.created - hasCustomRouting = preferenceSectionGetResponse.hasCustomRouting - name = preferenceSectionGetResponse.name - routingOptions = preferenceSectionGetResponse.routingOptions.map { it.toMutableList() } - topics = preferenceSectionGetResponse.topics.map { it.toMutableList() } - creator = preferenceSectionGetResponse.creator - updated = preferenceSectionGetResponse.updated - updater = preferenceSectionGetResponse.updater - additionalProperties = preferenceSectionGetResponse.additionalProperties.toMutableMap() + internal fun from(workspacePreferenceGetResponse: WorkspacePreferenceGetResponse) = apply { + id = workspacePreferenceGetResponse.id + created = workspacePreferenceGetResponse.created + hasCustomRouting = workspacePreferenceGetResponse.hasCustomRouting + name = workspacePreferenceGetResponse.name + routingOptions = + workspacePreferenceGetResponse.routingOptions.map { it.toMutableList() } + topics = workspacePreferenceGetResponse.topics.map { it.toMutableList() } + creator = workspacePreferenceGetResponse.creator + updated = workspacePreferenceGetResponse.updated + updater = workspacePreferenceGetResponse.updater + additionalProperties = + workspacePreferenceGetResponse.additionalProperties.toMutableMap() } - /** The preference section id. */ + /** The workspace preference id. */ fun id(id: String) = id(JsonField.of(id)) /** @@ -278,7 +281,7 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - /** ISO-8601 timestamp of when the section was created. */ + /** ISO-8601 timestamp of when the workspace preference was created. */ fun created(created: String) = created(JsonField.of(created)) /** @@ -289,7 +292,7 @@ private constructor( */ fun created(created: JsonField) = apply { this.created = created } - /** Whether the section defines custom routing for its topics. */ + /** Whether the workspace preference defines custom routing for its topics. */ fun hasCustomRouting(hasCustomRouting: Boolean) = hasCustomRouting(JsonField.of(hasCustomRouting)) @@ -315,7 +318,7 @@ private constructor( */ fun name(name: JsonField) = apply { this.name = name } - /** Default channels for the section. May be empty. */ + /** Default channels for the workspace preference. May be empty. */ fun routingOptions(routingOptions: List) = routingOptions(JsonField.of(routingOptions)) @@ -342,26 +345,26 @@ private constructor( } } - /** The topics contained in this section. */ - fun topics(topics: List) = topics(JsonField.of(topics)) + /** The topics contained in this workspace preference. */ + fun topics(topics: List) = topics(JsonField.of(topics)) /** * Sets [Builder.topics] to an arbitrary JSON value. * * You should usually call [Builder.topics] with a well-typed - * `List` value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * `List` value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. */ - fun topics(topics: JsonField>) = apply { + fun topics(topics: JsonField>) = apply { this.topics = topics.map { it.toMutableList() } } /** - * Adds a single [PreferenceTopicGetResponse] to [topics]. + * Adds a single [WorkspacePreferenceTopicGetResponse] to [topics]. * * @throws IllegalStateException if the field was previously set to a non-list. */ - fun addTopic(topic: PreferenceTopicGetResponse) = apply { + fun addTopic(topic: WorkspacePreferenceTopicGetResponse) = apply { topics = (topics ?: JsonField.of(mutableListOf())).also { checkKnown("topics", it).add(topic) @@ -430,7 +433,7 @@ private constructor( } /** - * Returns an immutable instance of [PreferenceSectionGetResponse]. + * Returns an immutable instance of [WorkspacePreferenceGetResponse]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -446,8 +449,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PreferenceSectionGetResponse = - PreferenceSectionGetResponse( + fun build(): WorkspacePreferenceGetResponse = + WorkspacePreferenceGetResponse( checkRequired("id", id), checkRequired("created", created), checkRequired("hasCustomRouting", hasCustomRouting), @@ -471,7 +474,7 @@ private constructor( * @throws CourierInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): PreferenceSectionGetResponse = apply { + fun validate(): WorkspacePreferenceGetResponse = apply { if (validated) { return@apply } @@ -518,7 +521,7 @@ private constructor( return true } - return other is PreferenceSectionGetResponse && + return other is WorkspacePreferenceGetResponse && id == other.id && created == other.created && hasCustomRouting == other.hasCustomRouting && @@ -549,5 +552,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PreferenceSectionGetResponse{id=$id, created=$created, hasCustomRouting=$hasCustomRouting, name=$name, routingOptions=$routingOptions, topics=$topics, creator=$creator, updated=$updated, updater=$updater, additionalProperties=$additionalProperties}" + "WorkspacePreferenceGetResponse{id=$id, created=$created, hasCustomRouting=$hasCustomRouting, name=$name, routingOptions=$routingOptions, topics=$topics, creator=$creator, updated=$updated, updater=$updater, additionalProperties=$additionalProperties}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionListParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceListParams.kt similarity index 83% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionListParams.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceListParams.kt index a6117e0..df73392 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionListParams.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceListParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.Params import com.courier.core.http.Headers @@ -8,10 +8,10 @@ import com.courier.core.http.QueryParams import java.util.Objects /** - * List the workspace's preference sections. Each section embeds its topics. Scoped to the workspace - * of the API key. + * List the workspace's preferences. Each workspace preference embeds its topics. Scoped to the + * workspace of the API key. */ -class PreferenceSectionListParams +class WorkspacePreferenceListParams private constructor( private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, @@ -27,24 +27,25 @@ private constructor( companion object { - @JvmStatic fun none(): PreferenceSectionListParams = builder().build() + @JvmStatic fun none(): WorkspacePreferenceListParams = builder().build() /** - * Returns a mutable builder for constructing an instance of [PreferenceSectionListParams]. + * Returns a mutable builder for constructing an instance of + * [WorkspacePreferenceListParams]. */ @JvmStatic fun builder() = Builder() } - /** A builder for [PreferenceSectionListParams]. */ + /** A builder for [WorkspacePreferenceListParams]. */ class Builder internal constructor() { private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic - internal fun from(preferenceSectionListParams: PreferenceSectionListParams) = apply { - additionalHeaders = preferenceSectionListParams.additionalHeaders.toBuilder() - additionalQueryParams = preferenceSectionListParams.additionalQueryParams.toBuilder() + internal fun from(workspacePreferenceListParams: WorkspacePreferenceListParams) = apply { + additionalHeaders = workspacePreferenceListParams.additionalHeaders.toBuilder() + additionalQueryParams = workspacePreferenceListParams.additionalQueryParams.toBuilder() } fun additionalHeaders(additionalHeaders: Headers) = apply { @@ -146,12 +147,12 @@ private constructor( } /** - * Returns an immutable instance of [PreferenceSectionListParams]. + * Returns an immutable instance of [WorkspacePreferenceListParams]. * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): PreferenceSectionListParams = - PreferenceSectionListParams(additionalHeaders.build(), additionalQueryParams.build()) + fun build(): WorkspacePreferenceListParams = + WorkspacePreferenceListParams(additionalHeaders.build(), additionalQueryParams.build()) } override fun _headers(): Headers = additionalHeaders @@ -163,7 +164,7 @@ private constructor( return true } - return other is PreferenceSectionListParams && + return other is WorkspacePreferenceListParams && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams } @@ -171,5 +172,5 @@ private constructor( override fun hashCode(): Int = Objects.hash(additionalHeaders, additionalQueryParams) override fun toString() = - "PreferenceSectionListParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "WorkspacePreferenceListParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionListResponse.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceListResponse.kt similarity index 73% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionListResponse.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceListResponse.kt index 3a73db2..73cc4da 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionListResponse.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceListResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.ExcludeMissing import com.courier.core.JsonField @@ -18,11 +18,11 @@ import java.util.Collections import java.util.Objects import kotlin.jvm.optionals.getOrNull -/** The workspace's preference sections, each with its topics. */ -class PreferenceSectionListResponse +/** The workspace's preferences, each with its topics. */ +class WorkspacePreferenceListResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val results: JsonField>, + private val results: JsonField>, private val additionalProperties: MutableMap, ) { @@ -30,14 +30,14 @@ private constructor( private constructor( @JsonProperty("results") @ExcludeMissing - results: JsonField> = JsonMissing.of() + results: JsonField> = JsonMissing.of() ) : this(results, mutableMapOf()) /** * @throws CourierInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun results(): List = results.getRequired("results") + fun results(): List = results.getRequired("results") /** * Returns the raw JSON value of [results]. @@ -46,7 +46,7 @@ private constructor( */ @JsonProperty("results") @ExcludeMissing - fun _results(): JsonField> = results + fun _results(): JsonField> = results @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -64,7 +64,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PreferenceSectionListResponse]. + * [WorkspacePreferenceListResponse]. * * The following fields are required: * ```java @@ -74,37 +74,39 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PreferenceSectionListResponse]. */ + /** A builder for [WorkspacePreferenceListResponse]. */ class Builder internal constructor() { - private var results: JsonField>? = null + private var results: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(preferenceSectionListResponse: PreferenceSectionListResponse) = apply { - results = preferenceSectionListResponse.results.map { it.toMutableList() } - additionalProperties = preferenceSectionListResponse.additionalProperties.toMutableMap() - } + internal fun from(workspacePreferenceListResponse: WorkspacePreferenceListResponse) = + apply { + results = workspacePreferenceListResponse.results.map { it.toMutableList() } + additionalProperties = + workspacePreferenceListResponse.additionalProperties.toMutableMap() + } - fun results(results: List) = results(JsonField.of(results)) + fun results(results: List) = results(JsonField.of(results)) /** * Sets [Builder.results] to an arbitrary JSON value. * * You should usually call [Builder.results] with a well-typed - * `List` value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * `List` value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. */ - fun results(results: JsonField>) = apply { + fun results(results: JsonField>) = apply { this.results = results.map { it.toMutableList() } } /** - * Adds a single [PreferenceSectionGetResponse] to [results]. + * Adds a single [WorkspacePreferenceGetResponse] to [results]. * * @throws IllegalStateException if the field was previously set to a non-list. */ - fun addResult(result: PreferenceSectionGetResponse) = apply { + fun addResult(result: WorkspacePreferenceGetResponse) = apply { results = (results ?: JsonField.of(mutableListOf())).also { checkKnown("results", it).add(result) @@ -131,7 +133,7 @@ private constructor( } /** - * Returns an immutable instance of [PreferenceSectionListResponse]. + * Returns an immutable instance of [WorkspacePreferenceListResponse]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -142,8 +144,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PreferenceSectionListResponse = - PreferenceSectionListResponse( + fun build(): WorkspacePreferenceListResponse = + WorkspacePreferenceListResponse( checkRequired("results", results).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) @@ -159,7 +161,7 @@ private constructor( * @throws CourierInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): PreferenceSectionListResponse = apply { + fun validate(): WorkspacePreferenceListResponse = apply { if (validated) { return@apply } @@ -190,7 +192,7 @@ private constructor( return true } - return other is PreferenceSectionListResponse && + return other is WorkspacePreferenceListResponse && results == other.results && additionalProperties == other.additionalProperties } @@ -200,5 +202,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PreferenceSectionListResponse{results=$results, additionalProperties=$additionalProperties}" + "WorkspacePreferenceListResponse{results=$results, additionalProperties=$additionalProperties}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionPublishParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferencePublishParams.kt similarity index 84% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionPublishParams.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferencePublishParams.kt index 78f7c82..72b744b 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionPublishParams.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferencePublishParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.JsonValue import com.courier.core.Params @@ -11,11 +11,11 @@ import java.util.Objects import java.util.Optional /** - * Publish the workspace's preferences page. Takes a snapshot of every section with its topics under - * a new published version, making the current state visible on the hosted preferences page - * (non-draft). + * Publish the workspace's preferences page. Takes a snapshot of every workspace preference with its + * topics under a new published version, making the current state visible on the hosted preferences + * page (non-draft). */ -class PreferenceSectionPublishParams +class WorkspacePreferencePublishParams private constructor( private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, @@ -35,16 +35,16 @@ private constructor( companion object { - @JvmStatic fun none(): PreferenceSectionPublishParams = builder().build() + @JvmStatic fun none(): WorkspacePreferencePublishParams = builder().build() /** * Returns a mutable builder for constructing an instance of - * [PreferenceSectionPublishParams]. + * [WorkspacePreferencePublishParams]. */ @JvmStatic fun builder() = Builder() } - /** A builder for [PreferenceSectionPublishParams]. */ + /** A builder for [WorkspacePreferencePublishParams]. */ class Builder internal constructor() { private var additionalHeaders: Headers.Builder = Headers.builder() @@ -52,12 +52,14 @@ private constructor( private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(preferenceSectionPublishParams: PreferenceSectionPublishParams) = apply { - additionalHeaders = preferenceSectionPublishParams.additionalHeaders.toBuilder() - additionalQueryParams = preferenceSectionPublishParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - preferenceSectionPublishParams.additionalBodyProperties.toMutableMap() - } + internal fun from(workspacePreferencePublishParams: WorkspacePreferencePublishParams) = + apply { + additionalHeaders = workspacePreferencePublishParams.additionalHeaders.toBuilder() + additionalQueryParams = + workspacePreferencePublishParams.additionalQueryParams.toBuilder() + additionalBodyProperties = + workspacePreferencePublishParams.additionalBodyProperties.toMutableMap() + } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -180,12 +182,12 @@ private constructor( } /** - * Returns an immutable instance of [PreferenceSectionPublishParams]. + * Returns an immutable instance of [WorkspacePreferencePublishParams]. * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): PreferenceSectionPublishParams = - PreferenceSectionPublishParams( + fun build(): WorkspacePreferencePublishParams = + WorkspacePreferencePublishParams( additionalHeaders.build(), additionalQueryParams.build(), additionalBodyProperties.toImmutable(), @@ -204,7 +206,7 @@ private constructor( return true } - return other is PreferenceSectionPublishParams && + return other is WorkspacePreferencePublishParams && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams && additionalBodyProperties == other.additionalBodyProperties @@ -214,5 +216,5 @@ private constructor( Objects.hash(additionalHeaders, additionalQueryParams, additionalBodyProperties) override fun toString() = - "PreferenceSectionPublishParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "WorkspacePreferencePublishParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionReplaceParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceReplaceParams.kt similarity index 71% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionReplaceParams.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceReplaceParams.kt index 77d4d0f..b4a7f83 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionReplaceParams.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceReplaceParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.JsonValue import com.courier.core.Params @@ -12,13 +12,13 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Replace a preference section. Full document replacement; missing optional fields are cleared. - * Topics attached to the section are unaffected. + * Replace a workspace preference. Full document replacement; missing optional fields are cleared. + * Topics attached to the workspace preference are unaffected. */ -class PreferenceSectionReplaceParams +class WorkspacePreferenceReplaceParams private constructor( private val sectionId: String?, - private val preferenceSectionReplaceRequest: PreferenceSectionReplaceRequest, + private val workspacePreferenceReplaceRequest: WorkspacePreferenceReplaceRequest, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -26,14 +26,14 @@ private constructor( fun sectionId(): Optional = Optional.ofNullable(sectionId) /** - * Request body for replacing a preference section. Full document replacement; missing optional - * fields are cleared. + * Request body for replacing a workspace preference. Full document replacement; missing + * optional fields are cleared. */ - fun preferenceSectionReplaceRequest(): PreferenceSectionReplaceRequest = - preferenceSectionReplaceRequest + fun workspacePreferenceReplaceRequest(): WorkspacePreferenceReplaceRequest = + workspacePreferenceReplaceRequest fun _additionalBodyProperties(): Map = - preferenceSectionReplaceRequest._additionalProperties() + workspacePreferenceReplaceRequest._additionalProperties() /** Additional headers to send with the request. */ fun _additionalHeaders(): Headers = additionalHeaders @@ -47,32 +47,34 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PreferenceSectionReplaceParams]. + * [WorkspacePreferenceReplaceParams]. * * The following fields are required: * ```java - * .preferenceSectionReplaceRequest() + * .workspacePreferenceReplaceRequest() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [PreferenceSectionReplaceParams]. */ + /** A builder for [WorkspacePreferenceReplaceParams]. */ class Builder internal constructor() { private var sectionId: String? = null - private var preferenceSectionReplaceRequest: PreferenceSectionReplaceRequest? = null + private var workspacePreferenceReplaceRequest: WorkspacePreferenceReplaceRequest? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic - internal fun from(preferenceSectionReplaceParams: PreferenceSectionReplaceParams) = apply { - sectionId = preferenceSectionReplaceParams.sectionId - preferenceSectionReplaceRequest = - preferenceSectionReplaceParams.preferenceSectionReplaceRequest - additionalHeaders = preferenceSectionReplaceParams.additionalHeaders.toBuilder() - additionalQueryParams = preferenceSectionReplaceParams.additionalQueryParams.toBuilder() - } + internal fun from(workspacePreferenceReplaceParams: WorkspacePreferenceReplaceParams) = + apply { + sectionId = workspacePreferenceReplaceParams.sectionId + workspacePreferenceReplaceRequest = + workspacePreferenceReplaceParams.workspacePreferenceReplaceRequest + additionalHeaders = workspacePreferenceReplaceParams.additionalHeaders.toBuilder() + additionalQueryParams = + workspacePreferenceReplaceParams.additionalQueryParams.toBuilder() + } fun sectionId(sectionId: String?) = apply { this.sectionId = sectionId } @@ -80,12 +82,12 @@ private constructor( fun sectionId(sectionId: Optional) = sectionId(sectionId.getOrNull()) /** - * Request body for replacing a preference section. Full document replacement; missing + * Request body for replacing a workspace preference. Full document replacement; missing * optional fields are cleared. */ - fun preferenceSectionReplaceRequest( - preferenceSectionReplaceRequest: PreferenceSectionReplaceRequest - ) = apply { this.preferenceSectionReplaceRequest = preferenceSectionReplaceRequest } + fun workspacePreferenceReplaceRequest( + workspacePreferenceReplaceRequest: WorkspacePreferenceReplaceRequest + ) = apply { this.workspacePreferenceReplaceRequest = workspacePreferenceReplaceRequest } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -186,27 +188,30 @@ private constructor( } /** - * Returns an immutable instance of [PreferenceSectionReplaceParams]. + * Returns an immutable instance of [WorkspacePreferenceReplaceParams]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .preferenceSectionReplaceRequest() + * .workspacePreferenceReplaceRequest() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): PreferenceSectionReplaceParams = - PreferenceSectionReplaceParams( + fun build(): WorkspacePreferenceReplaceParams = + WorkspacePreferenceReplaceParams( sectionId, - checkRequired("preferenceSectionReplaceRequest", preferenceSectionReplaceRequest), + checkRequired( + "workspacePreferenceReplaceRequest", + workspacePreferenceReplaceRequest, + ), additionalHeaders.build(), additionalQueryParams.build(), ) } - fun _body(): PreferenceSectionReplaceRequest = preferenceSectionReplaceRequest + fun _body(): WorkspacePreferenceReplaceRequest = workspacePreferenceReplaceRequest fun _pathParam(index: Int): String = when (index) { @@ -223,9 +228,9 @@ private constructor( return true } - return other is PreferenceSectionReplaceParams && + return other is WorkspacePreferenceReplaceParams && sectionId == other.sectionId && - preferenceSectionReplaceRequest == other.preferenceSectionReplaceRequest && + workspacePreferenceReplaceRequest == other.workspacePreferenceReplaceRequest && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams } @@ -233,11 +238,11 @@ private constructor( override fun hashCode(): Int = Objects.hash( sectionId, - preferenceSectionReplaceRequest, + workspacePreferenceReplaceRequest, additionalHeaders, additionalQueryParams, ) override fun toString() = - "PreferenceSectionReplaceParams{sectionId=$sectionId, preferenceSectionReplaceRequest=$preferenceSectionReplaceRequest, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "WorkspacePreferenceReplaceParams{sectionId=$sectionId, workspacePreferenceReplaceRequest=$workspacePreferenceReplaceRequest, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionCreateRequest.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceReplaceRequest.kt similarity index 85% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionCreateRequest.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceReplaceRequest.kt index 700d10c..4f52362 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionCreateRequest.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceReplaceRequest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.ExcludeMissing import com.courier.core.JsonField @@ -20,8 +20,11 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Request body for creating a preference section. */ -class PreferenceSectionCreateRequest +/** + * Request body for replacing a workspace preference. Full document replacement; missing optional + * fields are cleared. + */ +class WorkspacePreferenceReplaceRequest @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val name: JsonField, @@ -42,7 +45,7 @@ private constructor( ) : this(name, hasCustomRouting, routingOptions, mutableMapOf()) /** - * Human-readable name for the section. + * Human-readable name for the workspace preference. * * @throws CourierInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -50,7 +53,7 @@ private constructor( fun name(): String = name.getRequired("name") /** - * Whether the section defines custom routing for its topics. + * Whether the workspace preference defines custom routing for its topics. * * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -58,7 +61,7 @@ private constructor( fun hasCustomRouting(): Optional = hasCustomRouting.getOptional("has_custom_routing") /** - * Default channels for the section. Defaults to empty if omitted. + * Default channels for the workspace preference. Omit to clear. * * @throws CourierInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -108,7 +111,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PreferenceSectionCreateRequest]. + * [WorkspacePreferenceReplaceRequest]. * * The following fields are required: * ```java @@ -118,7 +121,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PreferenceSectionCreateRequest]. */ + /** A builder for [WorkspacePreferenceReplaceRequest]. */ class Builder internal constructor() { private var name: JsonField? = null @@ -127,16 +130,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(preferenceSectionCreateRequest: PreferenceSectionCreateRequest) = apply { - name = preferenceSectionCreateRequest.name - hasCustomRouting = preferenceSectionCreateRequest.hasCustomRouting - routingOptions = - preferenceSectionCreateRequest.routingOptions.map { it.toMutableList() } - additionalProperties = - preferenceSectionCreateRequest.additionalProperties.toMutableMap() - } - - /** Human-readable name for the section. */ + internal fun from(workspacePreferenceReplaceRequest: WorkspacePreferenceReplaceRequest) = + apply { + name = workspacePreferenceReplaceRequest.name + hasCustomRouting = workspacePreferenceReplaceRequest.hasCustomRouting + routingOptions = + workspacePreferenceReplaceRequest.routingOptions.map { it.toMutableList() } + additionalProperties = + workspacePreferenceReplaceRequest.additionalProperties.toMutableMap() + } + + /** Human-readable name for the workspace preference. */ fun name(name: String) = name(JsonField.of(name)) /** @@ -147,7 +151,7 @@ private constructor( */ fun name(name: JsonField) = apply { this.name = name } - /** Whether the section defines custom routing for its topics. */ + /** Whether the workspace preference defines custom routing for its topics. */ fun hasCustomRouting(hasCustomRouting: Boolean?) = hasCustomRouting(JsonField.ofNullable(hasCustomRouting)) @@ -174,7 +178,7 @@ private constructor( this.hasCustomRouting = hasCustomRouting } - /** Default channels for the section. Defaults to empty if omitted. */ + /** Default channels for the workspace preference. Omit to clear. */ fun routingOptions(routingOptions: List?) = routingOptions(JsonField.ofNullable(routingOptions)) @@ -225,7 +229,7 @@ private constructor( } /** - * Returns an immutable instance of [PreferenceSectionCreateRequest]. + * Returns an immutable instance of [WorkspacePreferenceReplaceRequest]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -236,8 +240,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PreferenceSectionCreateRequest = - PreferenceSectionCreateRequest( + fun build(): WorkspacePreferenceReplaceRequest = + WorkspacePreferenceReplaceRequest( checkRequired("name", name), hasCustomRouting, (routingOptions ?: JsonMissing.of()).map { it.toImmutable() }, @@ -255,7 +259,7 @@ private constructor( * @throws CourierInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): PreferenceSectionCreateRequest = apply { + fun validate(): WorkspacePreferenceReplaceRequest = apply { if (validated) { return@apply } @@ -290,7 +294,7 @@ private constructor( return true } - return other is PreferenceSectionCreateRequest && + return other is WorkspacePreferenceReplaceRequest && name == other.name && hasCustomRouting == other.hasCustomRouting && routingOptions == other.routingOptions && @@ -304,5 +308,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PreferenceSectionCreateRequest{name=$name, hasCustomRouting=$hasCustomRouting, routingOptions=$routingOptions, additionalProperties=$additionalProperties}" + "WorkspacePreferenceReplaceRequest{name=$name, hasCustomRouting=$hasCustomRouting, routingOptions=$routingOptions, additionalProperties=$additionalProperties}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionRetrieveParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceRetrieveParams.kt similarity index 85% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionRetrieveParams.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceRetrieveParams.kt index 7f9504d..bd38e27 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceSectionRetrieveParams.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceRetrieveParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.Params import com.courier.core.http.Headers @@ -9,8 +9,8 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Retrieve a preference section by id, including its topics. */ -class PreferenceSectionRetrieveParams +/** Retrieve a workspace preference by id, including its topics. */ +class WorkspacePreferenceRetrieveParams private constructor( private val sectionId: String?, private val additionalHeaders: Headers, @@ -29,16 +29,16 @@ private constructor( companion object { - @JvmStatic fun none(): PreferenceSectionRetrieveParams = builder().build() + @JvmStatic fun none(): WorkspacePreferenceRetrieveParams = builder().build() /** * Returns a mutable builder for constructing an instance of - * [PreferenceSectionRetrieveParams]. + * [WorkspacePreferenceRetrieveParams]. */ @JvmStatic fun builder() = Builder() } - /** A builder for [PreferenceSectionRetrieveParams]. */ + /** A builder for [WorkspacePreferenceRetrieveParams]. */ class Builder internal constructor() { private var sectionId: String? = null @@ -46,12 +46,12 @@ private constructor( private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic - internal fun from(preferenceSectionRetrieveParams: PreferenceSectionRetrieveParams) = + internal fun from(workspacePreferenceRetrieveParams: WorkspacePreferenceRetrieveParams) = apply { - sectionId = preferenceSectionRetrieveParams.sectionId - additionalHeaders = preferenceSectionRetrieveParams.additionalHeaders.toBuilder() + sectionId = workspacePreferenceRetrieveParams.sectionId + additionalHeaders = workspacePreferenceRetrieveParams.additionalHeaders.toBuilder() additionalQueryParams = - preferenceSectionRetrieveParams.additionalQueryParams.toBuilder() + workspacePreferenceRetrieveParams.additionalQueryParams.toBuilder() } fun sectionId(sectionId: String?) = apply { this.sectionId = sectionId } @@ -158,12 +158,12 @@ private constructor( } /** - * Returns an immutable instance of [PreferenceSectionRetrieveParams]. + * Returns an immutable instance of [WorkspacePreferenceRetrieveParams]. * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): PreferenceSectionRetrieveParams = - PreferenceSectionRetrieveParams( + fun build(): WorkspacePreferenceRetrieveParams = + WorkspacePreferenceRetrieveParams( sectionId, additionalHeaders.build(), additionalQueryParams.build(), @@ -185,7 +185,7 @@ private constructor( return true } - return other is PreferenceSectionRetrieveParams && + return other is WorkspacePreferenceRetrieveParams && sectionId == other.sectionId && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams @@ -194,5 +194,5 @@ private constructor( override fun hashCode(): Int = Objects.hash(sectionId, additionalHeaders, additionalQueryParams) override fun toString() = - "PreferenceSectionRetrieveParams{sectionId=$sectionId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "WorkspacePreferenceRetrieveParams{sectionId=$sectionId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceTopicCreateRequest.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicCreateRequest.kt similarity index 95% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceTopicCreateRequest.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicCreateRequest.kt index a76bd6b..4a4d2f6 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceTopicCreateRequest.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicCreateRequest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.Enum import com.courier.core.ExcludeMissing @@ -22,7 +22,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** Request body for creating a preference topic. */ -class PreferenceTopicCreateRequest +class WorkspacePreferenceTopicCreateRequest @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val defaultStatus: JsonField, @@ -180,7 +180,8 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [PreferenceTopicCreateRequest]. + * Returns a mutable builder for constructing an instance of + * [WorkspacePreferenceTopicCreateRequest]. * * The following fields are required: * ```java @@ -191,7 +192,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PreferenceTopicCreateRequest]. */ + /** A builder for [WorkspacePreferenceTopicCreateRequest]. */ class Builder internal constructor() { private var defaultStatus: JsonField? = null @@ -203,15 +204,20 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(preferenceTopicCreateRequest: PreferenceTopicCreateRequest) = apply { - defaultStatus = preferenceTopicCreateRequest.defaultStatus - name = preferenceTopicCreateRequest.name + internal fun from( + workspacePreferenceTopicCreateRequest: WorkspacePreferenceTopicCreateRequest + ) = apply { + defaultStatus = workspacePreferenceTopicCreateRequest.defaultStatus + name = workspacePreferenceTopicCreateRequest.name allowedPreferences = - preferenceTopicCreateRequest.allowedPreferences.map { it.toMutableList() } - includeUnsubscribeHeader = preferenceTopicCreateRequest.includeUnsubscribeHeader - routingOptions = preferenceTopicCreateRequest.routingOptions.map { it.toMutableList() } - topicData = preferenceTopicCreateRequest.topicData - additionalProperties = preferenceTopicCreateRequest.additionalProperties.toMutableMap() + workspacePreferenceTopicCreateRequest.allowedPreferences.map { it.toMutableList() } + includeUnsubscribeHeader = + workspacePreferenceTopicCreateRequest.includeUnsubscribeHeader + routingOptions = + workspacePreferenceTopicCreateRequest.routingOptions.map { it.toMutableList() } + topicData = workspacePreferenceTopicCreateRequest.topicData + additionalProperties = + workspacePreferenceTopicCreateRequest.additionalProperties.toMutableMap() } /** The default subscription status applied when a recipient has not set their own. */ @@ -371,7 +377,7 @@ private constructor( } /** - * Returns an immutable instance of [PreferenceTopicCreateRequest]. + * Returns an immutable instance of [WorkspacePreferenceTopicCreateRequest]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -383,8 +389,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PreferenceTopicCreateRequest = - PreferenceTopicCreateRequest( + fun build(): WorkspacePreferenceTopicCreateRequest = + WorkspacePreferenceTopicCreateRequest( checkRequired("defaultStatus", defaultStatus), checkRequired("name", name), (allowedPreferences ?: JsonMissing.of()).map { it.toImmutable() }, @@ -405,7 +411,7 @@ private constructor( * @throws CourierInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): PreferenceTopicCreateRequest = apply { + fun validate(): WorkspacePreferenceTopicCreateRequest = apply { if (validated) { return@apply } @@ -839,7 +845,7 @@ private constructor( return true } - return other is PreferenceTopicCreateRequest && + return other is WorkspacePreferenceTopicCreateRequest && defaultStatus == other.defaultStatus && name == other.name && allowedPreferences == other.allowedPreferences && @@ -864,5 +870,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PreferenceTopicCreateRequest{defaultStatus=$defaultStatus, name=$name, allowedPreferences=$allowedPreferences, includeUnsubscribeHeader=$includeUnsubscribeHeader, routingOptions=$routingOptions, topicData=$topicData, additionalProperties=$additionalProperties}" + "WorkspacePreferenceTopicCreateRequest{defaultStatus=$defaultStatus, name=$name, allowedPreferences=$allowedPreferences, includeUnsubscribeHeader=$includeUnsubscribeHeader, routingOptions=$routingOptions, topicData=$topicData, additionalProperties=$additionalProperties}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceTopicGetResponse.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicGetResponse.kt similarity index 95% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceTopicGetResponse.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicGetResponse.kt index de27c6d..f512e0b 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceTopicGetResponse.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicGetResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.Enum import com.courier.core.ExcludeMissing @@ -22,7 +22,7 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** A subscription preference topic in your workspace. */ -class PreferenceTopicGetResponse +class WorkspacePreferenceTopicGetResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val id: JsonField, @@ -270,7 +270,8 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [PreferenceTopicGetResponse]. + * Returns a mutable builder for constructing an instance of + * [WorkspacePreferenceTopicGetResponse]. * * The following fields are required: * ```java @@ -288,7 +289,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PreferenceTopicGetResponse]. */ + /** A builder for [WorkspacePreferenceTopicGetResponse]. */ class Builder internal constructor() { private var id: JsonField? = null @@ -305,20 +306,24 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(preferenceTopicGetResponse: PreferenceTopicGetResponse) = apply { - id = preferenceTopicGetResponse.id + internal fun from( + workspacePreferenceTopicGetResponse: WorkspacePreferenceTopicGetResponse + ) = apply { + id = workspacePreferenceTopicGetResponse.id allowedPreferences = - preferenceTopicGetResponse.allowedPreferences.map { it.toMutableList() } - created = preferenceTopicGetResponse.created - defaultStatus = preferenceTopicGetResponse.defaultStatus - includeUnsubscribeHeader = preferenceTopicGetResponse.includeUnsubscribeHeader - name = preferenceTopicGetResponse.name - routingOptions = preferenceTopicGetResponse.routingOptions.map { it.toMutableList() } - topicData = preferenceTopicGetResponse.topicData - updated = preferenceTopicGetResponse.updated - creator = preferenceTopicGetResponse.creator - updater = preferenceTopicGetResponse.updater - additionalProperties = preferenceTopicGetResponse.additionalProperties.toMutableMap() + workspacePreferenceTopicGetResponse.allowedPreferences.map { it.toMutableList() } + created = workspacePreferenceTopicGetResponse.created + defaultStatus = workspacePreferenceTopicGetResponse.defaultStatus + includeUnsubscribeHeader = workspacePreferenceTopicGetResponse.includeUnsubscribeHeader + name = workspacePreferenceTopicGetResponse.name + routingOptions = + workspacePreferenceTopicGetResponse.routingOptions.map { it.toMutableList() } + topicData = workspacePreferenceTopicGetResponse.topicData + updated = workspacePreferenceTopicGetResponse.updated + creator = workspacePreferenceTopicGetResponse.creator + updater = workspacePreferenceTopicGetResponse.updater + additionalProperties = + workspacePreferenceTopicGetResponse.additionalProperties.toMutableMap() } /** The preference topic id. */ @@ -508,7 +513,7 @@ private constructor( } /** - * Returns an immutable instance of [PreferenceTopicGetResponse]. + * Returns an immutable instance of [WorkspacePreferenceTopicGetResponse]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -527,8 +532,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PreferenceTopicGetResponse = - PreferenceTopicGetResponse( + fun build(): WorkspacePreferenceTopicGetResponse = + WorkspacePreferenceTopicGetResponse( checkRequired("id", id), checkRequired("allowedPreferences", allowedPreferences).map { it.toImmutable() }, checkRequired("created", created), @@ -554,7 +559,7 @@ private constructor( * @throws CourierInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): PreferenceTopicGetResponse = apply { + fun validate(): WorkspacePreferenceTopicGetResponse = apply { if (validated) { return@apply } @@ -998,7 +1003,7 @@ private constructor( return true } - return other is PreferenceTopicGetResponse && + return other is WorkspacePreferenceTopicGetResponse && id == other.id && allowedPreferences == other.allowedPreferences && created == other.created && @@ -1033,5 +1038,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PreferenceTopicGetResponse{id=$id, allowedPreferences=$allowedPreferences, created=$created, defaultStatus=$defaultStatus, includeUnsubscribeHeader=$includeUnsubscribeHeader, name=$name, routingOptions=$routingOptions, topicData=$topicData, updated=$updated, creator=$creator, updater=$updater, additionalProperties=$additionalProperties}" + "WorkspacePreferenceTopicGetResponse{id=$id, allowedPreferences=$allowedPreferences, created=$created, defaultStatus=$defaultStatus, includeUnsubscribeHeader=$includeUnsubscribeHeader, name=$name, routingOptions=$routingOptions, topicData=$topicData, updated=$updated, creator=$creator, updater=$updater, additionalProperties=$additionalProperties}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceTopicListResponse.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicListResponse.kt similarity index 72% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceTopicListResponse.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicListResponse.kt index b628a2b..c8a0890 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceTopicListResponse.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicListResponse.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.ExcludeMissing import com.courier.core.JsonField @@ -18,11 +18,11 @@ import java.util.Collections import java.util.Objects import kotlin.jvm.optionals.getOrNull -/** Topics contained in a preference section. */ -class PreferenceTopicListResponse +/** Topics contained in a workspace preference. */ +class WorkspacePreferenceTopicListResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val results: JsonField>, + private val results: JsonField>, private val additionalProperties: MutableMap, ) { @@ -30,14 +30,14 @@ private constructor( private constructor( @JsonProperty("results") @ExcludeMissing - results: JsonField> = JsonMissing.of() + results: JsonField> = JsonMissing.of() ) : this(results, mutableMapOf()) /** * @throws CourierInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun results(): List = results.getRequired("results") + fun results(): List = results.getRequired("results") /** * Returns the raw JSON value of [results]. @@ -46,7 +46,7 @@ private constructor( */ @JsonProperty("results") @ExcludeMissing - fun _results(): JsonField> = results + fun _results(): JsonField> = results @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -63,7 +63,8 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [PreferenceTopicListResponse]. + * Returns a mutable builder for constructing an instance of + * [WorkspacePreferenceTopicListResponse]. * * The following fields are required: * ```java @@ -73,37 +74,41 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PreferenceTopicListResponse]. */ + /** A builder for [WorkspacePreferenceTopicListResponse]. */ class Builder internal constructor() { - private var results: JsonField>? = null + private var results: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(preferenceTopicListResponse: PreferenceTopicListResponse) = apply { - results = preferenceTopicListResponse.results.map { it.toMutableList() } - additionalProperties = preferenceTopicListResponse.additionalProperties.toMutableMap() + internal fun from( + workspacePreferenceTopicListResponse: WorkspacePreferenceTopicListResponse + ) = apply { + results = workspacePreferenceTopicListResponse.results.map { it.toMutableList() } + additionalProperties = + workspacePreferenceTopicListResponse.additionalProperties.toMutableMap() } - fun results(results: List) = results(JsonField.of(results)) + fun results(results: List) = + results(JsonField.of(results)) /** * Sets [Builder.results] to an arbitrary JSON value. * * You should usually call [Builder.results] with a well-typed - * `List` value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * `List` value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. */ - fun results(results: JsonField>) = apply { + fun results(results: JsonField>) = apply { this.results = results.map { it.toMutableList() } } /** - * Adds a single [PreferenceTopicGetResponse] to [results]. + * Adds a single [WorkspacePreferenceTopicGetResponse] to [results]. * * @throws IllegalStateException if the field was previously set to a non-list. */ - fun addResult(result: PreferenceTopicGetResponse) = apply { + fun addResult(result: WorkspacePreferenceTopicGetResponse) = apply { results = (results ?: JsonField.of(mutableListOf())).also { checkKnown("results", it).add(result) @@ -130,7 +135,7 @@ private constructor( } /** - * Returns an immutable instance of [PreferenceTopicListResponse]. + * Returns an immutable instance of [WorkspacePreferenceTopicListResponse]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -141,8 +146,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PreferenceTopicListResponse = - PreferenceTopicListResponse( + fun build(): WorkspacePreferenceTopicListResponse = + WorkspacePreferenceTopicListResponse( checkRequired("results", results).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) @@ -158,7 +163,7 @@ private constructor( * @throws CourierInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): PreferenceTopicListResponse = apply { + fun validate(): WorkspacePreferenceTopicListResponse = apply { if (validated) { return@apply } @@ -189,7 +194,7 @@ private constructor( return true } - return other is PreferenceTopicListResponse && + return other is WorkspacePreferenceTopicListResponse && results == other.results && additionalProperties == other.additionalProperties } @@ -199,5 +204,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PreferenceTopicListResponse{results=$results, additionalProperties=$additionalProperties}" + "WorkspacePreferenceTopicListResponse{results=$results, additionalProperties=$additionalProperties}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceTopicReplaceRequest.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicReplaceRequest.kt similarity index 95% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceTopicReplaceRequest.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicReplaceRequest.kt index 0f4c49d..cc2c78d 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/PreferenceTopicReplaceRequest.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicReplaceRequest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.Enum import com.courier.core.ExcludeMissing @@ -25,7 +25,7 @@ import kotlin.jvm.optionals.getOrNull * Request body for replacing a preference topic. Full document replacement; missing optional fields * are cleared. */ -class PreferenceTopicReplaceRequest +class WorkspacePreferenceTopicReplaceRequest @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val defaultStatus: JsonField, @@ -184,7 +184,7 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [PreferenceTopicReplaceRequest]. + * [WorkspacePreferenceTopicReplaceRequest]. * * The following fields are required: * ```java @@ -195,7 +195,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [PreferenceTopicReplaceRequest]. */ + /** A builder for [WorkspacePreferenceTopicReplaceRequest]. */ class Builder internal constructor() { private var defaultStatus: JsonField? = null @@ -207,15 +207,20 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(preferenceTopicReplaceRequest: PreferenceTopicReplaceRequest) = apply { - defaultStatus = preferenceTopicReplaceRequest.defaultStatus - name = preferenceTopicReplaceRequest.name + internal fun from( + workspacePreferenceTopicReplaceRequest: WorkspacePreferenceTopicReplaceRequest + ) = apply { + defaultStatus = workspacePreferenceTopicReplaceRequest.defaultStatus + name = workspacePreferenceTopicReplaceRequest.name allowedPreferences = - preferenceTopicReplaceRequest.allowedPreferences.map { it.toMutableList() } - includeUnsubscribeHeader = preferenceTopicReplaceRequest.includeUnsubscribeHeader - routingOptions = preferenceTopicReplaceRequest.routingOptions.map { it.toMutableList() } - topicData = preferenceTopicReplaceRequest.topicData - additionalProperties = preferenceTopicReplaceRequest.additionalProperties.toMutableMap() + workspacePreferenceTopicReplaceRequest.allowedPreferences.map { it.toMutableList() } + includeUnsubscribeHeader = + workspacePreferenceTopicReplaceRequest.includeUnsubscribeHeader + routingOptions = + workspacePreferenceTopicReplaceRequest.routingOptions.map { it.toMutableList() } + topicData = workspacePreferenceTopicReplaceRequest.topicData + additionalProperties = + workspacePreferenceTopicReplaceRequest.additionalProperties.toMutableMap() } /** The default subscription status applied when a recipient has not set their own. */ @@ -372,7 +377,7 @@ private constructor( } /** - * Returns an immutable instance of [PreferenceTopicReplaceRequest]. + * Returns an immutable instance of [WorkspacePreferenceTopicReplaceRequest]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -384,8 +389,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): PreferenceTopicReplaceRequest = - PreferenceTopicReplaceRequest( + fun build(): WorkspacePreferenceTopicReplaceRequest = + WorkspacePreferenceTopicReplaceRequest( checkRequired("defaultStatus", defaultStatus), checkRequired("name", name), (allowedPreferences ?: JsonMissing.of()).map { it.toImmutable() }, @@ -406,7 +411,7 @@ private constructor( * @throws CourierInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): PreferenceTopicReplaceRequest = apply { + fun validate(): WorkspacePreferenceTopicReplaceRequest = apply { if (validated) { return@apply } @@ -840,7 +845,7 @@ private constructor( return true } - return other is PreferenceTopicReplaceRequest && + return other is WorkspacePreferenceTopicReplaceRequest && defaultStatus == other.defaultStatus && name == other.name && allowedPreferences == other.allowedPreferences && @@ -865,5 +870,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "PreferenceTopicReplaceRequest{defaultStatus=$defaultStatus, name=$name, allowedPreferences=$allowedPreferences, includeUnsubscribeHeader=$includeUnsubscribeHeader, routingOptions=$routingOptions, topicData=$topicData, additionalProperties=$additionalProperties}" + "WorkspacePreferenceTopicReplaceRequest{defaultStatus=$defaultStatus, name=$name, allowedPreferences=$allowedPreferences, includeUnsubscribeHeader=$includeUnsubscribeHeader, routingOptions=$routingOptions, topicData=$topicData, additionalProperties=$additionalProperties}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/topics/TopicArchiveParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/topics/TopicArchiveParams.kt similarity index 98% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/topics/TopicArchiveParams.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/topics/TopicArchiveParams.kt index b5bdccf..b63d6d1 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/topics/TopicArchiveParams.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/topics/TopicArchiveParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections.topics +package com.courier.models.workspacepreferences.topics import com.courier.core.JsonValue import com.courier.core.Params @@ -12,7 +12,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Archive a topic and remove it from its section. Same 404 rules as GET. */ +/** Archive a topic and remove it from its workspace preference. Same 404 rules as GET. */ class TopicArchiveParams private constructor( private val sectionId: String, diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/topics/TopicCreateParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/topics/TopicCreateParams.kt similarity index 79% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/topics/TopicCreateParams.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/topics/TopicCreateParams.kt index 6d9f818..aa4e061 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/topics/TopicCreateParams.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/topics/TopicCreateParams.kt @@ -1,25 +1,25 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections.topics +package com.courier.models.workspacepreferences.topics import com.courier.core.JsonValue import com.courier.core.Params import com.courier.core.checkRequired import com.courier.core.http.Headers import com.courier.core.http.QueryParams -import com.courier.models.preferencesections.PreferenceTopicCreateRequest +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicCreateRequest import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Create a subscription preference topic inside a section. Fails with 404 if the section does not - * exist. The topic id is generated and returned. + * Create a subscription preference topic inside a workspace preference. Fails with 404 if the + * workspace preference does not exist. The topic id is generated and returned. */ class TopicCreateParams private constructor( private val sectionId: String?, - private val preferenceTopicCreateRequest: PreferenceTopicCreateRequest, + private val workspacePreferenceTopicCreateRequest: WorkspacePreferenceTopicCreateRequest, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -27,10 +27,11 @@ private constructor( fun sectionId(): Optional = Optional.ofNullable(sectionId) /** Request body for creating a preference topic. */ - fun preferenceTopicCreateRequest(): PreferenceTopicCreateRequest = preferenceTopicCreateRequest + fun workspacePreferenceTopicCreateRequest(): WorkspacePreferenceTopicCreateRequest = + workspacePreferenceTopicCreateRequest fun _additionalBodyProperties(): Map = - preferenceTopicCreateRequest._additionalProperties() + workspacePreferenceTopicCreateRequest._additionalProperties() /** Additional headers to send with the request. */ fun _additionalHeaders(): Headers = additionalHeaders @@ -47,7 +48,7 @@ private constructor( * * The following fields are required: * ```java - * .preferenceTopicCreateRequest() + * .workspacePreferenceTopicCreateRequest() * ``` */ @JvmStatic fun builder() = Builder() @@ -57,14 +58,16 @@ private constructor( class Builder internal constructor() { private var sectionId: String? = null - private var preferenceTopicCreateRequest: PreferenceTopicCreateRequest? = null + private var workspacePreferenceTopicCreateRequest: WorkspacePreferenceTopicCreateRequest? = + null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic internal fun from(topicCreateParams: TopicCreateParams) = apply { sectionId = topicCreateParams.sectionId - preferenceTopicCreateRequest = topicCreateParams.preferenceTopicCreateRequest + workspacePreferenceTopicCreateRequest = + topicCreateParams.workspacePreferenceTopicCreateRequest additionalHeaders = topicCreateParams.additionalHeaders.toBuilder() additionalQueryParams = topicCreateParams.additionalQueryParams.toBuilder() } @@ -75,9 +78,11 @@ private constructor( fun sectionId(sectionId: Optional) = sectionId(sectionId.getOrNull()) /** Request body for creating a preference topic. */ - fun preferenceTopicCreateRequest( - preferenceTopicCreateRequest: PreferenceTopicCreateRequest - ) = apply { this.preferenceTopicCreateRequest = preferenceTopicCreateRequest } + fun workspacePreferenceTopicCreateRequest( + workspacePreferenceTopicCreateRequest: WorkspacePreferenceTopicCreateRequest + ) = apply { + this.workspacePreferenceTopicCreateRequest = workspacePreferenceTopicCreateRequest + } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -184,7 +189,7 @@ private constructor( * * The following fields are required: * ```java - * .preferenceTopicCreateRequest() + * .workspacePreferenceTopicCreateRequest() * ``` * * @throws IllegalStateException if any required field is unset. @@ -192,13 +197,16 @@ private constructor( fun build(): TopicCreateParams = TopicCreateParams( sectionId, - checkRequired("preferenceTopicCreateRequest", preferenceTopicCreateRequest), + checkRequired( + "workspacePreferenceTopicCreateRequest", + workspacePreferenceTopicCreateRequest, + ), additionalHeaders.build(), additionalQueryParams.build(), ) } - fun _body(): PreferenceTopicCreateRequest = preferenceTopicCreateRequest + fun _body(): WorkspacePreferenceTopicCreateRequest = workspacePreferenceTopicCreateRequest fun _pathParam(index: Int): String = when (index) { @@ -217,7 +225,7 @@ private constructor( return other is TopicCreateParams && sectionId == other.sectionId && - preferenceTopicCreateRequest == other.preferenceTopicCreateRequest && + workspacePreferenceTopicCreateRequest == other.workspacePreferenceTopicCreateRequest && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams } @@ -225,11 +233,11 @@ private constructor( override fun hashCode(): Int = Objects.hash( sectionId, - preferenceTopicCreateRequest, + workspacePreferenceTopicCreateRequest, additionalHeaders, additionalQueryParams, ) override fun toString() = - "TopicCreateParams{sectionId=$sectionId, preferenceTopicCreateRequest=$preferenceTopicCreateRequest, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "TopicCreateParams{sectionId=$sectionId, workspacePreferenceTopicCreateRequest=$workspacePreferenceTopicCreateRequest, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/topics/TopicListParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/topics/TopicListParams.kt similarity index 98% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/topics/TopicListParams.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/topics/TopicListParams.kt index 53e51fb..1a22b57 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/topics/TopicListParams.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/topics/TopicListParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections.topics +package com.courier.models.workspacepreferences.topics import com.courier.core.Params import com.courier.core.http.Headers @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** List the topics in a preference section. */ +/** List the topics in a workspace preference. */ class TopicListParams private constructor( private val sectionId: String?, diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/topics/TopicReplaceParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/topics/TopicReplaceParams.kt similarity index 81% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/topics/TopicReplaceParams.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/topics/TopicReplaceParams.kt index e66216f..2f69d55 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/topics/TopicReplaceParams.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/topics/TopicReplaceParams.kt @@ -1,26 +1,26 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections.topics +package com.courier.models.workspacepreferences.topics import com.courier.core.JsonValue import com.courier.core.Params import com.courier.core.checkRequired import com.courier.core.http.Headers import com.courier.core.http.QueryParams -import com.courier.models.preferencesections.PreferenceTopicReplaceRequest +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicReplaceRequest import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Replace a topic within a section. Full document replacement; missing optional fields are cleared. - * Same 404 rules as GET. + * Replace a topic within a workspace preference. Full document replacement; missing optional fields + * are cleared. Same 404 rules as GET. */ class TopicReplaceParams private constructor( private val sectionId: String, private val topicId: String?, - private val preferenceTopicReplaceRequest: PreferenceTopicReplaceRequest, + private val workspacePreferenceTopicReplaceRequest: WorkspacePreferenceTopicReplaceRequest, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -33,11 +33,11 @@ private constructor( * Request body for replacing a preference topic. Full document replacement; missing optional * fields are cleared. */ - fun preferenceTopicReplaceRequest(): PreferenceTopicReplaceRequest = - preferenceTopicReplaceRequest + fun workspacePreferenceTopicReplaceRequest(): WorkspacePreferenceTopicReplaceRequest = + workspacePreferenceTopicReplaceRequest fun _additionalBodyProperties(): Map = - preferenceTopicReplaceRequest._additionalProperties() + workspacePreferenceTopicReplaceRequest._additionalProperties() /** Additional headers to send with the request. */ fun _additionalHeaders(): Headers = additionalHeaders @@ -55,7 +55,7 @@ private constructor( * The following fields are required: * ```java * .sectionId() - * .preferenceTopicReplaceRequest() + * .workspacePreferenceTopicReplaceRequest() * ``` */ @JvmStatic fun builder() = Builder() @@ -66,7 +66,9 @@ private constructor( private var sectionId: String? = null private var topicId: String? = null - private var preferenceTopicReplaceRequest: PreferenceTopicReplaceRequest? = null + private var workspacePreferenceTopicReplaceRequest: + WorkspacePreferenceTopicReplaceRequest? = + null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -74,7 +76,8 @@ private constructor( internal fun from(topicReplaceParams: TopicReplaceParams) = apply { sectionId = topicReplaceParams.sectionId topicId = topicReplaceParams.topicId - preferenceTopicReplaceRequest = topicReplaceParams.preferenceTopicReplaceRequest + workspacePreferenceTopicReplaceRequest = + topicReplaceParams.workspacePreferenceTopicReplaceRequest additionalHeaders = topicReplaceParams.additionalHeaders.toBuilder() additionalQueryParams = topicReplaceParams.additionalQueryParams.toBuilder() } @@ -90,9 +93,11 @@ private constructor( * Request body for replacing a preference topic. Full document replacement; missing * optional fields are cleared. */ - fun preferenceTopicReplaceRequest( - preferenceTopicReplaceRequest: PreferenceTopicReplaceRequest - ) = apply { this.preferenceTopicReplaceRequest = preferenceTopicReplaceRequest } + fun workspacePreferenceTopicReplaceRequest( + workspacePreferenceTopicReplaceRequest: WorkspacePreferenceTopicReplaceRequest + ) = apply { + this.workspacePreferenceTopicReplaceRequest = workspacePreferenceTopicReplaceRequest + } fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -200,7 +205,7 @@ private constructor( * The following fields are required: * ```java * .sectionId() - * .preferenceTopicReplaceRequest() + * .workspacePreferenceTopicReplaceRequest() * ``` * * @throws IllegalStateException if any required field is unset. @@ -209,13 +214,16 @@ private constructor( TopicReplaceParams( checkRequired("sectionId", sectionId), topicId, - checkRequired("preferenceTopicReplaceRequest", preferenceTopicReplaceRequest), + checkRequired( + "workspacePreferenceTopicReplaceRequest", + workspacePreferenceTopicReplaceRequest, + ), additionalHeaders.build(), additionalQueryParams.build(), ) } - fun _body(): PreferenceTopicReplaceRequest = preferenceTopicReplaceRequest + fun _body(): WorkspacePreferenceTopicReplaceRequest = workspacePreferenceTopicReplaceRequest fun _pathParam(index: Int): String = when (index) { @@ -236,7 +244,8 @@ private constructor( return other is TopicReplaceParams && sectionId == other.sectionId && topicId == other.topicId && - preferenceTopicReplaceRequest == other.preferenceTopicReplaceRequest && + workspacePreferenceTopicReplaceRequest == + other.workspacePreferenceTopicReplaceRequest && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams } @@ -245,11 +254,11 @@ private constructor( Objects.hash( sectionId, topicId, - preferenceTopicReplaceRequest, + workspacePreferenceTopicReplaceRequest, additionalHeaders, additionalQueryParams, ) override fun toString() = - "TopicReplaceParams{sectionId=$sectionId, topicId=$topicId, preferenceTopicReplaceRequest=$preferenceTopicReplaceRequest, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "TopicReplaceParams{sectionId=$sectionId, topicId=$topicId, workspacePreferenceTopicReplaceRequest=$workspacePreferenceTopicReplaceRequest, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/topics/TopicRetrieveParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/topics/TopicRetrieveParams.kt similarity index 96% rename from courier-java-core/src/main/kotlin/com/courier/models/preferencesections/topics/TopicRetrieveParams.kt rename to courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/topics/TopicRetrieveParams.kt index 04e3051..a7d341d 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/preferencesections/topics/TopicRetrieveParams.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/workspacepreferences/topics/TopicRetrieveParams.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections.topics +package com.courier.models.workspacepreferences.topics import com.courier.core.Params import com.courier.core.checkRequired @@ -11,8 +11,8 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Retrieve a topic within a section. Returns 404 if the section does not exist, the topic does not - * exist, or the topic belongs to a different section. + * Retrieve a topic within a workspace preference. Returns 404 if the workspace preference does not + * exist, the topic does not exist, or the topic belongs to a different workspace preference. */ class TopicRetrieveParams private constructor( diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/PreferenceSectionServiceAsync.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/PreferenceSectionServiceAsync.kt deleted file mode 100644 index 954fc4f..0000000 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/PreferenceSectionServiceAsync.kt +++ /dev/null @@ -1,428 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.services.async - -import com.courier.core.ClientOptions -import com.courier.core.RequestOptions -import com.courier.core.http.HttpResponse -import com.courier.core.http.HttpResponseFor -import com.courier.models.preferencesections.PreferenceSectionArchiveParams -import com.courier.models.preferencesections.PreferenceSectionCreateParams -import com.courier.models.preferencesections.PreferenceSectionCreateRequest -import com.courier.models.preferencesections.PreferenceSectionGetResponse -import com.courier.models.preferencesections.PreferenceSectionListParams -import com.courier.models.preferencesections.PreferenceSectionListResponse -import com.courier.models.preferencesections.PreferenceSectionPublishParams -import com.courier.models.preferencesections.PreferenceSectionReplaceParams -import com.courier.models.preferencesections.PreferenceSectionRetrieveParams -import com.courier.models.preferencesections.PublishPreferencesResponse -import com.courier.services.async.preferencesections.TopicServiceAsync -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer - -interface PreferenceSectionServiceAsync { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): PreferenceSectionServiceAsync - - fun topics(): TopicServiceAsync - - /** - * Create a preference section in your workspace. The section id is generated and returned. - * Topics are created inside a section via POST /preferences/sections/{section_id}/topics. - */ - fun create( - params: PreferenceSectionCreateParams - ): CompletableFuture = create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: PreferenceSectionCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see create */ - fun create( - preferenceSectionCreateRequest: PreferenceSectionCreateRequest, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - create( - PreferenceSectionCreateParams.builder() - .preferenceSectionCreateRequest(preferenceSectionCreateRequest) - .build(), - requestOptions, - ) - - /** @see create */ - fun create( - preferenceSectionCreateRequest: PreferenceSectionCreateRequest - ): CompletableFuture = - create(preferenceSectionCreateRequest, RequestOptions.none()) - - /** Retrieve a preference section by id, including its topics. */ - fun retrieve(sectionId: String): CompletableFuture = - retrieve(sectionId, PreferenceSectionRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - sectionId: String, - params: PreferenceSectionRetrieveParams = PreferenceSectionRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - retrieve(params.toBuilder().sectionId(sectionId).build(), requestOptions) - - /** @see retrieve */ - fun retrieve( - sectionId: String, - params: PreferenceSectionRetrieveParams = PreferenceSectionRetrieveParams.none(), - ): CompletableFuture = - retrieve(sectionId, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: PreferenceSectionRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see retrieve */ - fun retrieve( - params: PreferenceSectionRetrieveParams - ): CompletableFuture = retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - sectionId: String, - requestOptions: RequestOptions, - ): CompletableFuture = - retrieve(sectionId, PreferenceSectionRetrieveParams.none(), requestOptions) - - /** - * List the workspace's preference sections. Each section embeds its topics. Scoped to the - * workspace of the API key. - */ - fun list(): CompletableFuture = - list(PreferenceSectionListParams.none()) - - /** @see list */ - fun list( - params: PreferenceSectionListParams = PreferenceSectionListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see list */ - fun list( - params: PreferenceSectionListParams = PreferenceSectionListParams.none() - ): CompletableFuture = list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): CompletableFuture = - list(PreferenceSectionListParams.none(), requestOptions) - - /** - * Archive a preference section. The section must be empty: delete its topics first, otherwise - * the request fails with 409. - */ - fun archive(sectionId: String): CompletableFuture = - archive(sectionId, PreferenceSectionArchiveParams.none()) - - /** @see archive */ - fun archive( - sectionId: String, - params: PreferenceSectionArchiveParams = PreferenceSectionArchiveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - archive(params.toBuilder().sectionId(sectionId).build(), requestOptions) - - /** @see archive */ - fun archive( - sectionId: String, - params: PreferenceSectionArchiveParams = PreferenceSectionArchiveParams.none(), - ): CompletableFuture = archive(sectionId, params, RequestOptions.none()) - - /** @see archive */ - fun archive( - params: PreferenceSectionArchiveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see archive */ - fun archive(params: PreferenceSectionArchiveParams): CompletableFuture = - archive(params, RequestOptions.none()) - - /** @see archive */ - fun archive(sectionId: String, requestOptions: RequestOptions): CompletableFuture = - archive(sectionId, PreferenceSectionArchiveParams.none(), requestOptions) - - /** - * Publish the workspace's preferences page. Takes a snapshot of every section with its topics - * under a new published version, making the current state visible on the hosted preferences - * page (non-draft). - */ - fun publish(): CompletableFuture = - publish(PreferenceSectionPublishParams.none()) - - /** @see publish */ - fun publish( - params: PreferenceSectionPublishParams = PreferenceSectionPublishParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see publish */ - fun publish( - params: PreferenceSectionPublishParams = PreferenceSectionPublishParams.none() - ): CompletableFuture = publish(params, RequestOptions.none()) - - /** @see publish */ - fun publish(requestOptions: RequestOptions): CompletableFuture = - publish(PreferenceSectionPublishParams.none(), requestOptions) - - /** - * Replace a preference section. Full document replacement; missing optional fields are cleared. - * Topics attached to the section are unaffected. - */ - fun replace( - sectionId: String, - params: PreferenceSectionReplaceParams, - ): CompletableFuture = - replace(sectionId, params, RequestOptions.none()) - - /** @see replace */ - fun replace( - sectionId: String, - params: PreferenceSectionReplaceParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - replace(params.toBuilder().sectionId(sectionId).build(), requestOptions) - - /** @see replace */ - fun replace( - params: PreferenceSectionReplaceParams - ): CompletableFuture = replace(params, RequestOptions.none()) - - /** @see replace */ - fun replace( - params: PreferenceSectionReplaceParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** - * A view of [PreferenceSectionServiceAsync] that provides access to raw HTTP responses for each - * method. - */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions( - modifier: Consumer - ): PreferenceSectionServiceAsync.WithRawResponse - - fun topics(): TopicServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `post /preferences/sections`, but is otherwise the same - * as [PreferenceSectionServiceAsync.create]. - */ - fun create( - params: PreferenceSectionCreateParams - ): CompletableFuture> = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: PreferenceSectionCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see create */ - fun create( - preferenceSectionCreateRequest: PreferenceSectionCreateRequest, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - create( - PreferenceSectionCreateParams.builder() - .preferenceSectionCreateRequest(preferenceSectionCreateRequest) - .build(), - requestOptions, - ) - - /** @see create */ - fun create( - preferenceSectionCreateRequest: PreferenceSectionCreateRequest - ): CompletableFuture> = - create(preferenceSectionCreateRequest, RequestOptions.none()) - - /** - * Returns a raw HTTP response for `get /preferences/sections/{section_id}`, but is - * otherwise the same as [PreferenceSectionServiceAsync.retrieve]. - */ - fun retrieve( - sectionId: String - ): CompletableFuture> = - retrieve(sectionId, PreferenceSectionRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - sectionId: String, - params: PreferenceSectionRetrieveParams = PreferenceSectionRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - retrieve(params.toBuilder().sectionId(sectionId).build(), requestOptions) - - /** @see retrieve */ - fun retrieve( - sectionId: String, - params: PreferenceSectionRetrieveParams = PreferenceSectionRetrieveParams.none(), - ): CompletableFuture> = - retrieve(sectionId, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: PreferenceSectionRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see retrieve */ - fun retrieve( - params: PreferenceSectionRetrieveParams - ): CompletableFuture> = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - sectionId: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - retrieve(sectionId, PreferenceSectionRetrieveParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /preferences/sections`, but is otherwise the same as - * [PreferenceSectionServiceAsync.list]. - */ - fun list(): CompletableFuture> = - list(PreferenceSectionListParams.none()) - - /** @see list */ - fun list( - params: PreferenceSectionListParams = PreferenceSectionListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see list */ - fun list( - params: PreferenceSectionListParams = PreferenceSectionListParams.none() - ): CompletableFuture> = - list(params, RequestOptions.none()) - - /** @see list */ - fun list( - requestOptions: RequestOptions - ): CompletableFuture> = - list(PreferenceSectionListParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `delete /preferences/sections/{section_id}`, but is - * otherwise the same as [PreferenceSectionServiceAsync.archive]. - */ - fun archive(sectionId: String): CompletableFuture = - archive(sectionId, PreferenceSectionArchiveParams.none()) - - /** @see archive */ - fun archive( - sectionId: String, - params: PreferenceSectionArchiveParams = PreferenceSectionArchiveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - archive(params.toBuilder().sectionId(sectionId).build(), requestOptions) - - /** @see archive */ - fun archive( - sectionId: String, - params: PreferenceSectionArchiveParams = PreferenceSectionArchiveParams.none(), - ): CompletableFuture = archive(sectionId, params, RequestOptions.none()) - - /** @see archive */ - fun archive( - params: PreferenceSectionArchiveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see archive */ - fun archive(params: PreferenceSectionArchiveParams): CompletableFuture = - archive(params, RequestOptions.none()) - - /** @see archive */ - fun archive( - sectionId: String, - requestOptions: RequestOptions, - ): CompletableFuture = - archive(sectionId, PreferenceSectionArchiveParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `post /preferences/publish`, but is otherwise the same as - * [PreferenceSectionServiceAsync.publish]. - */ - fun publish(): CompletableFuture> = - publish(PreferenceSectionPublishParams.none()) - - /** @see publish */ - fun publish( - params: PreferenceSectionPublishParams = PreferenceSectionPublishParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see publish */ - fun publish( - params: PreferenceSectionPublishParams = PreferenceSectionPublishParams.none() - ): CompletableFuture> = - publish(params, RequestOptions.none()) - - /** @see publish */ - fun publish( - requestOptions: RequestOptions - ): CompletableFuture> = - publish(PreferenceSectionPublishParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `put /preferences/sections/{section_id}`, but is - * otherwise the same as [PreferenceSectionServiceAsync.replace]. - */ - fun replace( - sectionId: String, - params: PreferenceSectionReplaceParams, - ): CompletableFuture> = - replace(sectionId, params, RequestOptions.none()) - - /** @see replace */ - fun replace( - sectionId: String, - params: PreferenceSectionReplaceParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - replace(params.toBuilder().sectionId(sectionId).build(), requestOptions) - - /** @see replace */ - fun replace( - params: PreferenceSectionReplaceParams - ): CompletableFuture> = - replace(params, RequestOptions.none()) - - /** @see replace */ - fun replace( - params: PreferenceSectionReplaceParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - } -} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/WorkspacePreferenceServiceAsync.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/WorkspacePreferenceServiceAsync.kt new file mode 100644 index 0000000..050aacb --- /dev/null +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/WorkspacePreferenceServiceAsync.kt @@ -0,0 +1,428 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.services.async + +import com.courier.core.ClientOptions +import com.courier.core.RequestOptions +import com.courier.core.http.HttpResponse +import com.courier.core.http.HttpResponseFor +import com.courier.models.workspacepreferences.PublishPreferencesResponse +import com.courier.models.workspacepreferences.WorkspacePreferenceArchiveParams +import com.courier.models.workspacepreferences.WorkspacePreferenceCreateParams +import com.courier.models.workspacepreferences.WorkspacePreferenceCreateRequest +import com.courier.models.workspacepreferences.WorkspacePreferenceGetResponse +import com.courier.models.workspacepreferences.WorkspacePreferenceListParams +import com.courier.models.workspacepreferences.WorkspacePreferenceListResponse +import com.courier.models.workspacepreferences.WorkspacePreferencePublishParams +import com.courier.models.workspacepreferences.WorkspacePreferenceReplaceParams +import com.courier.models.workspacepreferences.WorkspacePreferenceRetrieveParams +import com.courier.services.async.workspacepreferences.TopicServiceAsync +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface WorkspacePreferenceServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): WorkspacePreferenceServiceAsync + + fun topics(): TopicServiceAsync + + /** + * Create a workspace preference. The workspace preference id is generated and returned. Topics + * are created inside a workspace preference via POST /preferences/sections/{section_id}/topics. + */ + fun create( + params: WorkspacePreferenceCreateParams + ): CompletableFuture = create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: WorkspacePreferenceCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see create */ + fun create( + workspacePreferenceCreateRequest: WorkspacePreferenceCreateRequest, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + create( + WorkspacePreferenceCreateParams.builder() + .workspacePreferenceCreateRequest(workspacePreferenceCreateRequest) + .build(), + requestOptions, + ) + + /** @see create */ + fun create( + workspacePreferenceCreateRequest: WorkspacePreferenceCreateRequest + ): CompletableFuture = + create(workspacePreferenceCreateRequest, RequestOptions.none()) + + /** Retrieve a workspace preference by id, including its topics. */ + fun retrieve(sectionId: String): CompletableFuture = + retrieve(sectionId, WorkspacePreferenceRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + sectionId: String, + params: WorkspacePreferenceRetrieveParams = WorkspacePreferenceRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + sectionId: String, + params: WorkspacePreferenceRetrieveParams = WorkspacePreferenceRetrieveParams.none(), + ): CompletableFuture = + retrieve(sectionId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: WorkspacePreferenceRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see retrieve */ + fun retrieve( + params: WorkspacePreferenceRetrieveParams + ): CompletableFuture = retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + sectionId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + retrieve(sectionId, WorkspacePreferenceRetrieveParams.none(), requestOptions) + + /** + * List the workspace's preferences. Each workspace preference embeds its topics. Scoped to the + * workspace of the API key. + */ + fun list(): CompletableFuture = + list(WorkspacePreferenceListParams.none()) + + /** @see list */ + fun list( + params: WorkspacePreferenceListParams = WorkspacePreferenceListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see list */ + fun list( + params: WorkspacePreferenceListParams = WorkspacePreferenceListParams.none() + ): CompletableFuture = list(params, RequestOptions.none()) + + /** @see list */ + fun list(requestOptions: RequestOptions): CompletableFuture = + list(WorkspacePreferenceListParams.none(), requestOptions) + + /** + * Archive a workspace preference. The workspace preference must be empty: delete its topics + * first, otherwise the request fails with 409. + */ + fun archive(sectionId: String): CompletableFuture = + archive(sectionId, WorkspacePreferenceArchiveParams.none()) + + /** @see archive */ + fun archive( + sectionId: String, + params: WorkspacePreferenceArchiveParams = WorkspacePreferenceArchiveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + archive(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see archive */ + fun archive( + sectionId: String, + params: WorkspacePreferenceArchiveParams = WorkspacePreferenceArchiveParams.none(), + ): CompletableFuture = archive(sectionId, params, RequestOptions.none()) + + /** @see archive */ + fun archive( + params: WorkspacePreferenceArchiveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see archive */ + fun archive(params: WorkspacePreferenceArchiveParams): CompletableFuture = + archive(params, RequestOptions.none()) + + /** @see archive */ + fun archive(sectionId: String, requestOptions: RequestOptions): CompletableFuture = + archive(sectionId, WorkspacePreferenceArchiveParams.none(), requestOptions) + + /** + * Publish the workspace's preferences page. Takes a snapshot of every workspace preference with + * its topics under a new published version, making the current state visible on the hosted + * preferences page (non-draft). + */ + fun publish(): CompletableFuture = + publish(WorkspacePreferencePublishParams.none()) + + /** @see publish */ + fun publish( + params: WorkspacePreferencePublishParams = WorkspacePreferencePublishParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see publish */ + fun publish( + params: WorkspacePreferencePublishParams = WorkspacePreferencePublishParams.none() + ): CompletableFuture = publish(params, RequestOptions.none()) + + /** @see publish */ + fun publish(requestOptions: RequestOptions): CompletableFuture = + publish(WorkspacePreferencePublishParams.none(), requestOptions) + + /** + * Replace a workspace preference. Full document replacement; missing optional fields are + * cleared. Topics attached to the workspace preference are unaffected. + */ + fun replace( + sectionId: String, + params: WorkspacePreferenceReplaceParams, + ): CompletableFuture = + replace(sectionId, params, RequestOptions.none()) + + /** @see replace */ + fun replace( + sectionId: String, + params: WorkspacePreferenceReplaceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + replace(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see replace */ + fun replace( + params: WorkspacePreferenceReplaceParams + ): CompletableFuture = replace(params, RequestOptions.none()) + + /** @see replace */ + fun replace( + params: WorkspacePreferenceReplaceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** + * A view of [WorkspacePreferenceServiceAsync] that provides access to raw HTTP responses for + * each method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): WorkspacePreferenceServiceAsync.WithRawResponse + + fun topics(): TopicServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /preferences/sections`, but is otherwise the same + * as [WorkspacePreferenceServiceAsync.create]. + */ + fun create( + params: WorkspacePreferenceCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: WorkspacePreferenceCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see create */ + fun create( + workspacePreferenceCreateRequest: WorkspacePreferenceCreateRequest, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + create( + WorkspacePreferenceCreateParams.builder() + .workspacePreferenceCreateRequest(workspacePreferenceCreateRequest) + .build(), + requestOptions, + ) + + /** @see create */ + fun create( + workspacePreferenceCreateRequest: WorkspacePreferenceCreateRequest + ): CompletableFuture> = + create(workspacePreferenceCreateRequest, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `get /preferences/sections/{section_id}`, but is + * otherwise the same as [WorkspacePreferenceServiceAsync.retrieve]. + */ + fun retrieve( + sectionId: String + ): CompletableFuture> = + retrieve(sectionId, WorkspacePreferenceRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + sectionId: String, + params: WorkspacePreferenceRetrieveParams = WorkspacePreferenceRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + sectionId: String, + params: WorkspacePreferenceRetrieveParams = WorkspacePreferenceRetrieveParams.none(), + ): CompletableFuture> = + retrieve(sectionId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: WorkspacePreferenceRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see retrieve */ + fun retrieve( + params: WorkspacePreferenceRetrieveParams + ): CompletableFuture> = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + sectionId: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve(sectionId, WorkspacePreferenceRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /preferences/sections`, but is otherwise the same as + * [WorkspacePreferenceServiceAsync.list]. + */ + fun list(): CompletableFuture> = + list(WorkspacePreferenceListParams.none()) + + /** @see list */ + fun list( + params: WorkspacePreferenceListParams = WorkspacePreferenceListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see list */ + fun list( + params: WorkspacePreferenceListParams = WorkspacePreferenceListParams.none() + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + requestOptions: RequestOptions + ): CompletableFuture> = + list(WorkspacePreferenceListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /preferences/sections/{section_id}`, but is + * otherwise the same as [WorkspacePreferenceServiceAsync.archive]. + */ + fun archive(sectionId: String): CompletableFuture = + archive(sectionId, WorkspacePreferenceArchiveParams.none()) + + /** @see archive */ + fun archive( + sectionId: String, + params: WorkspacePreferenceArchiveParams = WorkspacePreferenceArchiveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + archive(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see archive */ + fun archive( + sectionId: String, + params: WorkspacePreferenceArchiveParams = WorkspacePreferenceArchiveParams.none(), + ): CompletableFuture = archive(sectionId, params, RequestOptions.none()) + + /** @see archive */ + fun archive( + params: WorkspacePreferenceArchiveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see archive */ + fun archive(params: WorkspacePreferenceArchiveParams): CompletableFuture = + archive(params, RequestOptions.none()) + + /** @see archive */ + fun archive( + sectionId: String, + requestOptions: RequestOptions, + ): CompletableFuture = + archive(sectionId, WorkspacePreferenceArchiveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /preferences/publish`, but is otherwise the same as + * [WorkspacePreferenceServiceAsync.publish]. + */ + fun publish(): CompletableFuture> = + publish(WorkspacePreferencePublishParams.none()) + + /** @see publish */ + fun publish( + params: WorkspacePreferencePublishParams = WorkspacePreferencePublishParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see publish */ + fun publish( + params: WorkspacePreferencePublishParams = WorkspacePreferencePublishParams.none() + ): CompletableFuture> = + publish(params, RequestOptions.none()) + + /** @see publish */ + fun publish( + requestOptions: RequestOptions + ): CompletableFuture> = + publish(WorkspacePreferencePublishParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `put /preferences/sections/{section_id}`, but is + * otherwise the same as [WorkspacePreferenceServiceAsync.replace]. + */ + fun replace( + sectionId: String, + params: WorkspacePreferenceReplaceParams, + ): CompletableFuture> = + replace(sectionId, params, RequestOptions.none()) + + /** @see replace */ + fun replace( + sectionId: String, + params: WorkspacePreferenceReplaceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + replace(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see replace */ + fun replace( + params: WorkspacePreferenceReplaceParams + ): CompletableFuture> = + replace(params, RequestOptions.none()) + + /** @see replace */ + fun replace( + params: WorkspacePreferenceReplaceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } +} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/PreferenceSectionServiceAsyncImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/WorkspacePreferenceServiceAsyncImpl.kt similarity index 76% rename from courier-java-core/src/main/kotlin/com/courier/services/async/PreferenceSectionServiceAsyncImpl.kt rename to courier-java-core/src/main/kotlin/com/courier/services/async/WorkspacePreferenceServiceAsyncImpl.kt index 1e8975c..6a0676f 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/PreferenceSectionServiceAsyncImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/WorkspacePreferenceServiceAsyncImpl.kt @@ -17,83 +17,86 @@ import com.courier.core.http.HttpResponseFor import com.courier.core.http.json import com.courier.core.http.parseable import com.courier.core.prepareAsync -import com.courier.models.preferencesections.PreferenceSectionArchiveParams -import com.courier.models.preferencesections.PreferenceSectionCreateParams -import com.courier.models.preferencesections.PreferenceSectionGetResponse -import com.courier.models.preferencesections.PreferenceSectionListParams -import com.courier.models.preferencesections.PreferenceSectionListResponse -import com.courier.models.preferencesections.PreferenceSectionPublishParams -import com.courier.models.preferencesections.PreferenceSectionReplaceParams -import com.courier.models.preferencesections.PreferenceSectionRetrieveParams -import com.courier.models.preferencesections.PublishPreferencesResponse -import com.courier.services.async.preferencesections.TopicServiceAsync -import com.courier.services.async.preferencesections.TopicServiceAsyncImpl +import com.courier.models.workspacepreferences.PublishPreferencesResponse +import com.courier.models.workspacepreferences.WorkspacePreferenceArchiveParams +import com.courier.models.workspacepreferences.WorkspacePreferenceCreateParams +import com.courier.models.workspacepreferences.WorkspacePreferenceGetResponse +import com.courier.models.workspacepreferences.WorkspacePreferenceListParams +import com.courier.models.workspacepreferences.WorkspacePreferenceListResponse +import com.courier.models.workspacepreferences.WorkspacePreferencePublishParams +import com.courier.models.workspacepreferences.WorkspacePreferenceReplaceParams +import com.courier.models.workspacepreferences.WorkspacePreferenceRetrieveParams +import com.courier.services.async.workspacepreferences.TopicServiceAsync +import com.courier.services.async.workspacepreferences.TopicServiceAsyncImpl import java.util.concurrent.CompletableFuture import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -class PreferenceSectionServiceAsyncImpl -internal constructor(private val clientOptions: ClientOptions) : PreferenceSectionServiceAsync { +class WorkspacePreferenceServiceAsyncImpl +internal constructor(private val clientOptions: ClientOptions) : WorkspacePreferenceServiceAsync { - private val withRawResponse: PreferenceSectionServiceAsync.WithRawResponse by lazy { + private val withRawResponse: WorkspacePreferenceServiceAsync.WithRawResponse by lazy { WithRawResponseImpl(clientOptions) } private val topics: TopicServiceAsync by lazy { TopicServiceAsyncImpl(clientOptions) } - override fun withRawResponse(): PreferenceSectionServiceAsync.WithRawResponse = withRawResponse + override fun withRawResponse(): WorkspacePreferenceServiceAsync.WithRawResponse = + withRawResponse override fun withOptions( modifier: Consumer - ): PreferenceSectionServiceAsync = - PreferenceSectionServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + ): WorkspacePreferenceServiceAsync = + WorkspacePreferenceServiceAsyncImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) override fun topics(): TopicServiceAsync = topics override fun create( - params: PreferenceSectionCreateParams, + params: WorkspacePreferenceCreateParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // post /preferences/sections withRawResponse().create(params, requestOptions).thenApply { it.parse() } override fun retrieve( - params: PreferenceSectionRetrieveParams, + params: WorkspacePreferenceRetrieveParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // get /preferences/sections/{section_id} withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } override fun list( - params: PreferenceSectionListParams, + params: WorkspacePreferenceListParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // get /preferences/sections withRawResponse().list(params, requestOptions).thenApply { it.parse() } override fun archive( - params: PreferenceSectionArchiveParams, + params: WorkspacePreferenceArchiveParams, requestOptions: RequestOptions, ): CompletableFuture = // delete /preferences/sections/{section_id} withRawResponse().archive(params, requestOptions).thenAccept {} override fun publish( - params: PreferenceSectionPublishParams, + params: WorkspacePreferencePublishParams, requestOptions: RequestOptions, ): CompletableFuture = // post /preferences/publish withRawResponse().publish(params, requestOptions).thenApply { it.parse() } override fun replace( - params: PreferenceSectionReplaceParams, + params: WorkspacePreferenceReplaceParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // put /preferences/sections/{section_id} withRawResponse().replace(params, requestOptions).thenApply { it.parse() } class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - PreferenceSectionServiceAsync.WithRawResponse { + WorkspacePreferenceServiceAsync.WithRawResponse { private val errorHandler: Handler = errorHandler(errorBodyHandler(clientOptions.jsonMapper)) @@ -104,20 +107,20 @@ internal constructor(private val clientOptions: ClientOptions) : PreferenceSecti override fun withOptions( modifier: Consumer - ): PreferenceSectionServiceAsync.WithRawResponse = - PreferenceSectionServiceAsyncImpl.WithRawResponseImpl( + ): WorkspacePreferenceServiceAsync.WithRawResponse = + WorkspacePreferenceServiceAsyncImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) override fun topics(): TopicServiceAsync.WithRawResponse = topics - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun create( - params: PreferenceSectionCreateParams, + params: WorkspacePreferenceCreateParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -142,13 +145,13 @@ internal constructor(private val clientOptions: ClientOptions) : PreferenceSecti } } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun retrieve( - params: PreferenceSectionRetrieveParams, + params: WorkspacePreferenceRetrieveParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("sectionId", params.sectionId().getOrNull()) @@ -175,13 +178,13 @@ internal constructor(private val clientOptions: ClientOptions) : PreferenceSecti } } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun list( - params: PreferenceSectionListParams, + params: WorkspacePreferenceListParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -208,7 +211,7 @@ internal constructor(private val clientOptions: ClientOptions) : PreferenceSecti private val archiveHandler: Handler = emptyHandler() override fun archive( - params: PreferenceSectionArchiveParams, + params: WorkspacePreferenceArchiveParams, requestOptions: RequestOptions, ): CompletableFuture { // We check here instead of in the params builder because this can be specified @@ -236,7 +239,7 @@ internal constructor(private val clientOptions: ClientOptions) : PreferenceSecti jsonHandler(clientOptions.jsonMapper) override fun publish( - params: PreferenceSectionPublishParams, + params: WorkspacePreferencePublishParams, requestOptions: RequestOptions, ): CompletableFuture> { val request = @@ -263,13 +266,13 @@ internal constructor(private val clientOptions: ClientOptions) : PreferenceSecti } } - private val replaceHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val replaceHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun replace( - params: PreferenceSectionReplaceParams, + params: WorkspacePreferenceReplaceParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("sectionId", params.sectionId().getOrNull()) diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/preferencesections/TopicServiceAsync.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/workspacepreferences/TopicServiceAsync.kt similarity index 69% rename from courier-java-core/src/main/kotlin/com/courier/services/async/preferencesections/TopicServiceAsync.kt rename to courier-java-core/src/main/kotlin/com/courier/services/async/workspacepreferences/TopicServiceAsync.kt index 7a12372..42214e0 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/preferencesections/TopicServiceAsync.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/workspacepreferences/TopicServiceAsync.kt @@ -1,18 +1,18 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.services.async.preferencesections +package com.courier.services.async.workspacepreferences import com.courier.core.ClientOptions import com.courier.core.RequestOptions import com.courier.core.http.HttpResponse import com.courier.core.http.HttpResponseFor -import com.courier.models.preferencesections.PreferenceTopicGetResponse -import com.courier.models.preferencesections.PreferenceTopicListResponse -import com.courier.models.preferencesections.topics.TopicArchiveParams -import com.courier.models.preferencesections.topics.TopicCreateParams -import com.courier.models.preferencesections.topics.TopicListParams -import com.courier.models.preferencesections.topics.TopicReplaceParams -import com.courier.models.preferencesections.topics.TopicRetrieveParams +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicGetResponse +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicListResponse +import com.courier.models.workspacepreferences.topics.TopicArchiveParams +import com.courier.models.workspacepreferences.topics.TopicCreateParams +import com.courier.models.workspacepreferences.topics.TopicListParams +import com.courier.models.workspacepreferences.topics.TopicReplaceParams +import com.courier.models.workspacepreferences.topics.TopicRetrieveParams import java.util.concurrent.CompletableFuture import java.util.function.Consumer @@ -31,13 +31,13 @@ interface TopicServiceAsync { fun withOptions(modifier: Consumer): TopicServiceAsync /** - * Create a subscription preference topic inside a section. Fails with 404 if the section does - * not exist. The topic id is generated and returned. + * Create a subscription preference topic inside a workspace preference. Fails with 404 if the + * workspace preference does not exist. The topic id is generated and returned. */ fun create( sectionId: String, params: TopicCreateParams, - ): CompletableFuture = + ): CompletableFuture = create(sectionId, params, RequestOptions.none()) /** @see create */ @@ -45,27 +45,28 @@ interface TopicServiceAsync { sectionId: String, params: TopicCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = + ): CompletableFuture = create(params.toBuilder().sectionId(sectionId).build(), requestOptions) /** @see create */ - fun create(params: TopicCreateParams): CompletableFuture = + fun create(params: TopicCreateParams): CompletableFuture = create(params, RequestOptions.none()) /** @see create */ fun create( params: TopicCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** - * Retrieve a topic within a section. Returns 404 if the section does not exist, the topic does - * not exist, or the topic belongs to a different section. + * Retrieve a topic within a workspace preference. Returns 404 if the workspace preference does + * not exist, the topic does not exist, or the topic belongs to a different workspace + * preference. */ fun retrieve( topicId: String, params: TopicRetrieveParams, - ): CompletableFuture = + ): CompletableFuture = retrieve(topicId, params, RequestOptions.none()) /** @see retrieve */ @@ -73,21 +74,23 @@ interface TopicServiceAsync { topicId: String, params: TopicRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = + ): CompletableFuture = retrieve(params.toBuilder().topicId(topicId).build(), requestOptions) /** @see retrieve */ - fun retrieve(params: TopicRetrieveParams): CompletableFuture = + fun retrieve( + params: TopicRetrieveParams + ): CompletableFuture = retrieve(params, RequestOptions.none()) /** @see retrieve */ fun retrieve( params: TopicRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture - /** List the topics in a preference section. */ - fun list(sectionId: String): CompletableFuture = + /** List the topics in a workspace preference. */ + fun list(sectionId: String): CompletableFuture = list(sectionId, TopicListParams.none()) /** @see list */ @@ -95,34 +98,34 @@ interface TopicServiceAsync { sectionId: String, params: TopicListParams = TopicListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = + ): CompletableFuture = list(params.toBuilder().sectionId(sectionId).build(), requestOptions) /** @see list */ fun list( sectionId: String, params: TopicListParams = TopicListParams.none(), - ): CompletableFuture = + ): CompletableFuture = list(sectionId, params, RequestOptions.none()) /** @see list */ fun list( params: TopicListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** @see list */ - fun list(params: TopicListParams): CompletableFuture = + fun list(params: TopicListParams): CompletableFuture = list(params, RequestOptions.none()) /** @see list */ fun list( sectionId: String, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = list(sectionId, TopicListParams.none(), requestOptions) - /** Archive a topic and remove it from its section. Same 404 rules as GET. */ + /** Archive a topic and remove it from its workspace preference. Same 404 rules as GET. */ fun archive(topicId: String, params: TopicArchiveParams): CompletableFuture = archive(topicId, params, RequestOptions.none()) @@ -145,13 +148,13 @@ interface TopicServiceAsync { ): CompletableFuture /** - * Replace a topic within a section. Full document replacement; missing optional fields are - * cleared. Same 404 rules as GET. + * Replace a topic within a workspace preference. Full document replacement; missing optional + * fields are cleared. Same 404 rules as GET. */ fun replace( topicId: String, params: TopicReplaceParams, - ): CompletableFuture = + ): CompletableFuture = replace(topicId, params, RequestOptions.none()) /** @see replace */ @@ -159,18 +162,20 @@ interface TopicServiceAsync { topicId: String, params: TopicReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = + ): CompletableFuture = replace(params.toBuilder().topicId(topicId).build(), requestOptions) /** @see replace */ - fun replace(params: TopicReplaceParams): CompletableFuture = + fun replace( + params: TopicReplaceParams + ): CompletableFuture = replace(params, RequestOptions.none()) /** @see replace */ fun replace( params: TopicReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** A view of [TopicServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -191,7 +196,7 @@ interface TopicServiceAsync { fun create( sectionId: String, params: TopicCreateParams, - ): CompletableFuture> = + ): CompletableFuture> = create(sectionId, params, RequestOptions.none()) /** @see create */ @@ -199,20 +204,20 @@ interface TopicServiceAsync { sectionId: String, params: TopicCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = + ): CompletableFuture> = create(params.toBuilder().sectionId(sectionId).build(), requestOptions) /** @see create */ fun create( params: TopicCreateParams - ): CompletableFuture> = + ): CompletableFuture> = create(params, RequestOptions.none()) /** @see create */ fun create( params: TopicCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** * Returns a raw HTTP response for `get @@ -222,7 +227,7 @@ interface TopicServiceAsync { fun retrieve( topicId: String, params: TopicRetrieveParams, - ): CompletableFuture> = + ): CompletableFuture> = retrieve(topicId, params, RequestOptions.none()) /** @see retrieve */ @@ -230,20 +235,20 @@ interface TopicServiceAsync { topicId: String, params: TopicRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = + ): CompletableFuture> = retrieve(params.toBuilder().topicId(topicId).build(), requestOptions) /** @see retrieve */ fun retrieve( params: TopicRetrieveParams - ): CompletableFuture> = + ): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see retrieve */ fun retrieve( params: TopicRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** * Returns a raw HTTP response for `get /preferences/sections/{section_id}/topics`, but is @@ -251,7 +256,7 @@ interface TopicServiceAsync { */ fun list( sectionId: String - ): CompletableFuture> = + ): CompletableFuture> = list(sectionId, TopicListParams.none()) /** @see list */ @@ -259,33 +264,33 @@ interface TopicServiceAsync { sectionId: String, params: TopicListParams = TopicListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = + ): CompletableFuture> = list(params.toBuilder().sectionId(sectionId).build(), requestOptions) /** @see list */ fun list( sectionId: String, params: TopicListParams = TopicListParams.none(), - ): CompletableFuture> = + ): CompletableFuture> = list(sectionId, params, RequestOptions.none()) /** @see list */ fun list( params: TopicListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see list */ fun list( params: TopicListParams - ): CompletableFuture> = + ): CompletableFuture> = list(params, RequestOptions.none()) /** @see list */ fun list( sectionId: String, requestOptions: RequestOptions, - ): CompletableFuture> = + ): CompletableFuture> = list(sectionId, TopicListParams.none(), requestOptions) /** @@ -322,7 +327,7 @@ interface TopicServiceAsync { fun replace( topicId: String, params: TopicReplaceParams, - ): CompletableFuture> = + ): CompletableFuture> = replace(topicId, params, RequestOptions.none()) /** @see replace */ @@ -330,19 +335,19 @@ interface TopicServiceAsync { topicId: String, params: TopicReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = + ): CompletableFuture> = replace(params.toBuilder().topicId(topicId).build(), requestOptions) /** @see replace */ fun replace( params: TopicReplaceParams - ): CompletableFuture> = + ): CompletableFuture> = replace(params, RequestOptions.none()) /** @see replace */ fun replace( params: TopicReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> } } diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/preferencesections/TopicServiceAsyncImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/workspacepreferences/TopicServiceAsyncImpl.kt similarity index 85% rename from courier-java-core/src/main/kotlin/com/courier/services/async/preferencesections/TopicServiceAsyncImpl.kt rename to courier-java-core/src/main/kotlin/com/courier/services/async/workspacepreferences/TopicServiceAsyncImpl.kt index 0ec567f..1601d37 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/preferencesections/TopicServiceAsyncImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/workspacepreferences/TopicServiceAsyncImpl.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.services.async.preferencesections +package com.courier.services.async.workspacepreferences import com.courier.core.ClientOptions import com.courier.core.RequestOptions @@ -17,13 +17,13 @@ import com.courier.core.http.HttpResponseFor import com.courier.core.http.json import com.courier.core.http.parseable import com.courier.core.prepareAsync -import com.courier.models.preferencesections.PreferenceTopicGetResponse -import com.courier.models.preferencesections.PreferenceTopicListResponse -import com.courier.models.preferencesections.topics.TopicArchiveParams -import com.courier.models.preferencesections.topics.TopicCreateParams -import com.courier.models.preferencesections.topics.TopicListParams -import com.courier.models.preferencesections.topics.TopicReplaceParams -import com.courier.models.preferencesections.topics.TopicRetrieveParams +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicGetResponse +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicListResponse +import com.courier.models.workspacepreferences.topics.TopicArchiveParams +import com.courier.models.workspacepreferences.topics.TopicCreateParams +import com.courier.models.workspacepreferences.topics.TopicListParams +import com.courier.models.workspacepreferences.topics.TopicReplaceParams +import com.courier.models.workspacepreferences.topics.TopicRetrieveParams import java.util.concurrent.CompletableFuture import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull @@ -43,21 +43,21 @@ class TopicServiceAsyncImpl internal constructor(private val clientOptions: Clie override fun create( params: TopicCreateParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // post /preferences/sections/{section_id}/topics withRawResponse().create(params, requestOptions).thenApply { it.parse() } override fun retrieve( params: TopicRetrieveParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // get /preferences/sections/{section_id}/topics/{topic_id} withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } override fun list( params: TopicListParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // get /preferences/sections/{section_id}/topics withRawResponse().list(params, requestOptions).thenApply { it.parse() } @@ -71,7 +71,7 @@ class TopicServiceAsyncImpl internal constructor(private val clientOptions: Clie override fun replace( params: TopicReplaceParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // put /preferences/sections/{section_id}/topics/{topic_id} withRawResponse().replace(params, requestOptions).thenApply { it.parse() } @@ -88,13 +88,13 @@ class TopicServiceAsyncImpl internal constructor(private val clientOptions: Clie clientOptions.toBuilder().apply(modifier::accept).build() ) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun create( params: TopicCreateParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("sectionId", params.sectionId().getOrNull()) @@ -122,13 +122,13 @@ class TopicServiceAsyncImpl internal constructor(private val clientOptions: Clie } } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun retrieve( params: TopicRetrieveParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("topicId", params.topicId().getOrNull()) @@ -161,13 +161,13 @@ class TopicServiceAsyncImpl internal constructor(private val clientOptions: Clie } } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun list( params: TopicListParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("sectionId", params.sectionId().getOrNull()) @@ -227,13 +227,13 @@ class TopicServiceAsyncImpl internal constructor(private val clientOptions: Clie } } - private val replaceHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val replaceHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun replace( params: TopicReplaceParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("topicId", params.topicId().getOrNull()) diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/PreferenceSectionService.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/PreferenceSectionService.kt deleted file mode 100644 index 0a6abc8..0000000 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/PreferenceSectionService.kt +++ /dev/null @@ -1,427 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.services.blocking - -import com.courier.core.ClientOptions -import com.courier.core.RequestOptions -import com.courier.core.http.HttpResponse -import com.courier.core.http.HttpResponseFor -import com.courier.models.preferencesections.PreferenceSectionArchiveParams -import com.courier.models.preferencesections.PreferenceSectionCreateParams -import com.courier.models.preferencesections.PreferenceSectionCreateRequest -import com.courier.models.preferencesections.PreferenceSectionGetResponse -import com.courier.models.preferencesections.PreferenceSectionListParams -import com.courier.models.preferencesections.PreferenceSectionListResponse -import com.courier.models.preferencesections.PreferenceSectionPublishParams -import com.courier.models.preferencesections.PreferenceSectionReplaceParams -import com.courier.models.preferencesections.PreferenceSectionRetrieveParams -import com.courier.models.preferencesections.PublishPreferencesResponse -import com.courier.services.blocking.preferencesections.TopicService -import com.google.errorprone.annotations.MustBeClosed -import java.util.function.Consumer - -interface PreferenceSectionService { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): PreferenceSectionService - - fun topics(): TopicService - - /** - * Create a preference section in your workspace. The section id is generated and returned. - * Topics are created inside a section via POST /preferences/sections/{section_id}/topics. - */ - fun create(params: PreferenceSectionCreateParams): PreferenceSectionGetResponse = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: PreferenceSectionCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): PreferenceSectionGetResponse - - /** @see create */ - fun create( - preferenceSectionCreateRequest: PreferenceSectionCreateRequest, - requestOptions: RequestOptions = RequestOptions.none(), - ): PreferenceSectionGetResponse = - create( - PreferenceSectionCreateParams.builder() - .preferenceSectionCreateRequest(preferenceSectionCreateRequest) - .build(), - requestOptions, - ) - - /** @see create */ - fun create( - preferenceSectionCreateRequest: PreferenceSectionCreateRequest - ): PreferenceSectionGetResponse = create(preferenceSectionCreateRequest, RequestOptions.none()) - - /** Retrieve a preference section by id, including its topics. */ - fun retrieve(sectionId: String): PreferenceSectionGetResponse = - retrieve(sectionId, PreferenceSectionRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - sectionId: String, - params: PreferenceSectionRetrieveParams = PreferenceSectionRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): PreferenceSectionGetResponse = - retrieve(params.toBuilder().sectionId(sectionId).build(), requestOptions) - - /** @see retrieve */ - fun retrieve( - sectionId: String, - params: PreferenceSectionRetrieveParams = PreferenceSectionRetrieveParams.none(), - ): PreferenceSectionGetResponse = retrieve(sectionId, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: PreferenceSectionRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): PreferenceSectionGetResponse - - /** @see retrieve */ - fun retrieve(params: PreferenceSectionRetrieveParams): PreferenceSectionGetResponse = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve(sectionId: String, requestOptions: RequestOptions): PreferenceSectionGetResponse = - retrieve(sectionId, PreferenceSectionRetrieveParams.none(), requestOptions) - - /** - * List the workspace's preference sections. Each section embeds its topics. Scoped to the - * workspace of the API key. - */ - fun list(): PreferenceSectionListResponse = list(PreferenceSectionListParams.none()) - - /** @see list */ - fun list( - params: PreferenceSectionListParams = PreferenceSectionListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): PreferenceSectionListResponse - - /** @see list */ - fun list( - params: PreferenceSectionListParams = PreferenceSectionListParams.none() - ): PreferenceSectionListResponse = list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): PreferenceSectionListResponse = - list(PreferenceSectionListParams.none(), requestOptions) - - /** - * Archive a preference section. The section must be empty: delete its topics first, otherwise - * the request fails with 409. - */ - fun archive(sectionId: String) = archive(sectionId, PreferenceSectionArchiveParams.none()) - - /** @see archive */ - fun archive( - sectionId: String, - params: PreferenceSectionArchiveParams = PreferenceSectionArchiveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ) = archive(params.toBuilder().sectionId(sectionId).build(), requestOptions) - - /** @see archive */ - fun archive( - sectionId: String, - params: PreferenceSectionArchiveParams = PreferenceSectionArchiveParams.none(), - ) = archive(sectionId, params, RequestOptions.none()) - - /** @see archive */ - fun archive( - params: PreferenceSectionArchiveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ) - - /** @see archive */ - fun archive(params: PreferenceSectionArchiveParams) = archive(params, RequestOptions.none()) - - /** @see archive */ - fun archive(sectionId: String, requestOptions: RequestOptions) = - archive(sectionId, PreferenceSectionArchiveParams.none(), requestOptions) - - /** - * Publish the workspace's preferences page. Takes a snapshot of every section with its topics - * under a new published version, making the current state visible on the hosted preferences - * page (non-draft). - */ - fun publish(): PublishPreferencesResponse = publish(PreferenceSectionPublishParams.none()) - - /** @see publish */ - fun publish( - params: PreferenceSectionPublishParams = PreferenceSectionPublishParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): PublishPreferencesResponse - - /** @see publish */ - fun publish( - params: PreferenceSectionPublishParams = PreferenceSectionPublishParams.none() - ): PublishPreferencesResponse = publish(params, RequestOptions.none()) - - /** @see publish */ - fun publish(requestOptions: RequestOptions): PublishPreferencesResponse = - publish(PreferenceSectionPublishParams.none(), requestOptions) - - /** - * Replace a preference section. Full document replacement; missing optional fields are cleared. - * Topics attached to the section are unaffected. - */ - fun replace( - sectionId: String, - params: PreferenceSectionReplaceParams, - ): PreferenceSectionGetResponse = replace(sectionId, params, RequestOptions.none()) - - /** @see replace */ - fun replace( - sectionId: String, - params: PreferenceSectionReplaceParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): PreferenceSectionGetResponse = - replace(params.toBuilder().sectionId(sectionId).build(), requestOptions) - - /** @see replace */ - fun replace(params: PreferenceSectionReplaceParams): PreferenceSectionGetResponse = - replace(params, RequestOptions.none()) - - /** @see replace */ - fun replace( - params: PreferenceSectionReplaceParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): PreferenceSectionGetResponse - - /** - * A view of [PreferenceSectionService] that provides access to raw HTTP responses for each - * method. - */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions( - modifier: Consumer - ): PreferenceSectionService.WithRawResponse - - fun topics(): TopicService.WithRawResponse - - /** - * Returns a raw HTTP response for `post /preferences/sections`, but is otherwise the same - * as [PreferenceSectionService.create]. - */ - @MustBeClosed - fun create( - params: PreferenceSectionCreateParams - ): HttpResponseFor = create(params, RequestOptions.none()) - - /** @see create */ - @MustBeClosed - fun create( - params: PreferenceSectionCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see create */ - @MustBeClosed - fun create( - preferenceSectionCreateRequest: PreferenceSectionCreateRequest, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - create( - PreferenceSectionCreateParams.builder() - .preferenceSectionCreateRequest(preferenceSectionCreateRequest) - .build(), - requestOptions, - ) - - /** @see create */ - @MustBeClosed - fun create( - preferenceSectionCreateRequest: PreferenceSectionCreateRequest - ): HttpResponseFor = - create(preferenceSectionCreateRequest, RequestOptions.none()) - - /** - * Returns a raw HTTP response for `get /preferences/sections/{section_id}`, but is - * otherwise the same as [PreferenceSectionService.retrieve]. - */ - @MustBeClosed - fun retrieve(sectionId: String): HttpResponseFor = - retrieve(sectionId, PreferenceSectionRetrieveParams.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - sectionId: String, - params: PreferenceSectionRetrieveParams = PreferenceSectionRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - retrieve(params.toBuilder().sectionId(sectionId).build(), requestOptions) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - sectionId: String, - params: PreferenceSectionRetrieveParams = PreferenceSectionRetrieveParams.none(), - ): HttpResponseFor = - retrieve(sectionId, params, RequestOptions.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - params: PreferenceSectionRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - params: PreferenceSectionRetrieveParams - ): HttpResponseFor = retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - sectionId: String, - requestOptions: RequestOptions, - ): HttpResponseFor = - retrieve(sectionId, PreferenceSectionRetrieveParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /preferences/sections`, but is otherwise the same as - * [PreferenceSectionService.list]. - */ - @MustBeClosed - fun list(): HttpResponseFor = - list(PreferenceSectionListParams.none()) - - /** @see list */ - @MustBeClosed - fun list( - params: PreferenceSectionListParams = PreferenceSectionListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see list */ - @MustBeClosed - fun list( - params: PreferenceSectionListParams = PreferenceSectionListParams.none() - ): HttpResponseFor = list(params, RequestOptions.none()) - - /** @see list */ - @MustBeClosed - fun list(requestOptions: RequestOptions): HttpResponseFor = - list(PreferenceSectionListParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `delete /preferences/sections/{section_id}`, but is - * otherwise the same as [PreferenceSectionService.archive]. - */ - @MustBeClosed - fun archive(sectionId: String): HttpResponse = - archive(sectionId, PreferenceSectionArchiveParams.none()) - - /** @see archive */ - @MustBeClosed - fun archive( - sectionId: String, - params: PreferenceSectionArchiveParams = PreferenceSectionArchiveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponse = archive(params.toBuilder().sectionId(sectionId).build(), requestOptions) - - /** @see archive */ - @MustBeClosed - fun archive( - sectionId: String, - params: PreferenceSectionArchiveParams = PreferenceSectionArchiveParams.none(), - ): HttpResponse = archive(sectionId, params, RequestOptions.none()) - - /** @see archive */ - @MustBeClosed - fun archive( - params: PreferenceSectionArchiveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponse - - /** @see archive */ - @MustBeClosed - fun archive(params: PreferenceSectionArchiveParams): HttpResponse = - archive(params, RequestOptions.none()) - - /** @see archive */ - @MustBeClosed - fun archive(sectionId: String, requestOptions: RequestOptions): HttpResponse = - archive(sectionId, PreferenceSectionArchiveParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `post /preferences/publish`, but is otherwise the same as - * [PreferenceSectionService.publish]. - */ - @MustBeClosed - fun publish(): HttpResponseFor = - publish(PreferenceSectionPublishParams.none()) - - /** @see publish */ - @MustBeClosed - fun publish( - params: PreferenceSectionPublishParams = PreferenceSectionPublishParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see publish */ - @MustBeClosed - fun publish( - params: PreferenceSectionPublishParams = PreferenceSectionPublishParams.none() - ): HttpResponseFor = publish(params, RequestOptions.none()) - - /** @see publish */ - @MustBeClosed - fun publish(requestOptions: RequestOptions): HttpResponseFor = - publish(PreferenceSectionPublishParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `put /preferences/sections/{section_id}`, but is - * otherwise the same as [PreferenceSectionService.replace]. - */ - @MustBeClosed - fun replace( - sectionId: String, - params: PreferenceSectionReplaceParams, - ): HttpResponseFor = - replace(sectionId, params, RequestOptions.none()) - - /** @see replace */ - @MustBeClosed - fun replace( - sectionId: String, - params: PreferenceSectionReplaceParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - replace(params.toBuilder().sectionId(sectionId).build(), requestOptions) - - /** @see replace */ - @MustBeClosed - fun replace( - params: PreferenceSectionReplaceParams - ): HttpResponseFor = replace(params, RequestOptions.none()) - - /** @see replace */ - @MustBeClosed - fun replace( - params: PreferenceSectionReplaceParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - } -} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/WorkspacePreferenceService.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/WorkspacePreferenceService.kt new file mode 100644 index 0000000..662a04b --- /dev/null +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/WorkspacePreferenceService.kt @@ -0,0 +1,431 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.services.blocking + +import com.courier.core.ClientOptions +import com.courier.core.RequestOptions +import com.courier.core.http.HttpResponse +import com.courier.core.http.HttpResponseFor +import com.courier.models.workspacepreferences.PublishPreferencesResponse +import com.courier.models.workspacepreferences.WorkspacePreferenceArchiveParams +import com.courier.models.workspacepreferences.WorkspacePreferenceCreateParams +import com.courier.models.workspacepreferences.WorkspacePreferenceCreateRequest +import com.courier.models.workspacepreferences.WorkspacePreferenceGetResponse +import com.courier.models.workspacepreferences.WorkspacePreferenceListParams +import com.courier.models.workspacepreferences.WorkspacePreferenceListResponse +import com.courier.models.workspacepreferences.WorkspacePreferencePublishParams +import com.courier.models.workspacepreferences.WorkspacePreferenceReplaceParams +import com.courier.models.workspacepreferences.WorkspacePreferenceRetrieveParams +import com.courier.services.blocking.workspacepreferences.TopicService +import com.google.errorprone.annotations.MustBeClosed +import java.util.function.Consumer + +interface WorkspacePreferenceService { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): WorkspacePreferenceService + + fun topics(): TopicService + + /** + * Create a workspace preference. The workspace preference id is generated and returned. Topics + * are created inside a workspace preference via POST /preferences/sections/{section_id}/topics. + */ + fun create(params: WorkspacePreferenceCreateParams): WorkspacePreferenceGetResponse = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: WorkspacePreferenceCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): WorkspacePreferenceGetResponse + + /** @see create */ + fun create( + workspacePreferenceCreateRequest: WorkspacePreferenceCreateRequest, + requestOptions: RequestOptions = RequestOptions.none(), + ): WorkspacePreferenceGetResponse = + create( + WorkspacePreferenceCreateParams.builder() + .workspacePreferenceCreateRequest(workspacePreferenceCreateRequest) + .build(), + requestOptions, + ) + + /** @see create */ + fun create( + workspacePreferenceCreateRequest: WorkspacePreferenceCreateRequest + ): WorkspacePreferenceGetResponse = + create(workspacePreferenceCreateRequest, RequestOptions.none()) + + /** Retrieve a workspace preference by id, including its topics. */ + fun retrieve(sectionId: String): WorkspacePreferenceGetResponse = + retrieve(sectionId, WorkspacePreferenceRetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + sectionId: String, + params: WorkspacePreferenceRetrieveParams = WorkspacePreferenceRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): WorkspacePreferenceGetResponse = + retrieve(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + sectionId: String, + params: WorkspacePreferenceRetrieveParams = WorkspacePreferenceRetrieveParams.none(), + ): WorkspacePreferenceGetResponse = retrieve(sectionId, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: WorkspacePreferenceRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): WorkspacePreferenceGetResponse + + /** @see retrieve */ + fun retrieve(params: WorkspacePreferenceRetrieveParams): WorkspacePreferenceGetResponse = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + sectionId: String, + requestOptions: RequestOptions, + ): WorkspacePreferenceGetResponse = + retrieve(sectionId, WorkspacePreferenceRetrieveParams.none(), requestOptions) + + /** + * List the workspace's preferences. Each workspace preference embeds its topics. Scoped to the + * workspace of the API key. + */ + fun list(): WorkspacePreferenceListResponse = list(WorkspacePreferenceListParams.none()) + + /** @see list */ + fun list( + params: WorkspacePreferenceListParams = WorkspacePreferenceListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): WorkspacePreferenceListResponse + + /** @see list */ + fun list( + params: WorkspacePreferenceListParams = WorkspacePreferenceListParams.none() + ): WorkspacePreferenceListResponse = list(params, RequestOptions.none()) + + /** @see list */ + fun list(requestOptions: RequestOptions): WorkspacePreferenceListResponse = + list(WorkspacePreferenceListParams.none(), requestOptions) + + /** + * Archive a workspace preference. The workspace preference must be empty: delete its topics + * first, otherwise the request fails with 409. + */ + fun archive(sectionId: String) = archive(sectionId, WorkspacePreferenceArchiveParams.none()) + + /** @see archive */ + fun archive( + sectionId: String, + params: WorkspacePreferenceArchiveParams = WorkspacePreferenceArchiveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ) = archive(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see archive */ + fun archive( + sectionId: String, + params: WorkspacePreferenceArchiveParams = WorkspacePreferenceArchiveParams.none(), + ) = archive(sectionId, params, RequestOptions.none()) + + /** @see archive */ + fun archive( + params: WorkspacePreferenceArchiveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ) + + /** @see archive */ + fun archive(params: WorkspacePreferenceArchiveParams) = archive(params, RequestOptions.none()) + + /** @see archive */ + fun archive(sectionId: String, requestOptions: RequestOptions) = + archive(sectionId, WorkspacePreferenceArchiveParams.none(), requestOptions) + + /** + * Publish the workspace's preferences page. Takes a snapshot of every workspace preference with + * its topics under a new published version, making the current state visible on the hosted + * preferences page (non-draft). + */ + fun publish(): PublishPreferencesResponse = publish(WorkspacePreferencePublishParams.none()) + + /** @see publish */ + fun publish( + params: WorkspacePreferencePublishParams = WorkspacePreferencePublishParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): PublishPreferencesResponse + + /** @see publish */ + fun publish( + params: WorkspacePreferencePublishParams = WorkspacePreferencePublishParams.none() + ): PublishPreferencesResponse = publish(params, RequestOptions.none()) + + /** @see publish */ + fun publish(requestOptions: RequestOptions): PublishPreferencesResponse = + publish(WorkspacePreferencePublishParams.none(), requestOptions) + + /** + * Replace a workspace preference. Full document replacement; missing optional fields are + * cleared. Topics attached to the workspace preference are unaffected. + */ + fun replace( + sectionId: String, + params: WorkspacePreferenceReplaceParams, + ): WorkspacePreferenceGetResponse = replace(sectionId, params, RequestOptions.none()) + + /** @see replace */ + fun replace( + sectionId: String, + params: WorkspacePreferenceReplaceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): WorkspacePreferenceGetResponse = + replace(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see replace */ + fun replace(params: WorkspacePreferenceReplaceParams): WorkspacePreferenceGetResponse = + replace(params, RequestOptions.none()) + + /** @see replace */ + fun replace( + params: WorkspacePreferenceReplaceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): WorkspacePreferenceGetResponse + + /** + * A view of [WorkspacePreferenceService] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): WorkspacePreferenceService.WithRawResponse + + fun topics(): TopicService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /preferences/sections`, but is otherwise the same + * as [WorkspacePreferenceService.create]. + */ + @MustBeClosed + fun create( + params: WorkspacePreferenceCreateParams + ): HttpResponseFor = create(params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + params: WorkspacePreferenceCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see create */ + @MustBeClosed + fun create( + workspacePreferenceCreateRequest: WorkspacePreferenceCreateRequest, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + create( + WorkspacePreferenceCreateParams.builder() + .workspacePreferenceCreateRequest(workspacePreferenceCreateRequest) + .build(), + requestOptions, + ) + + /** @see create */ + @MustBeClosed + fun create( + workspacePreferenceCreateRequest: WorkspacePreferenceCreateRequest + ): HttpResponseFor = + create(workspacePreferenceCreateRequest, RequestOptions.none()) + + /** + * Returns a raw HTTP response for `get /preferences/sections/{section_id}`, but is + * otherwise the same as [WorkspacePreferenceService.retrieve]. + */ + @MustBeClosed + fun retrieve(sectionId: String): HttpResponseFor = + retrieve(sectionId, WorkspacePreferenceRetrieveParams.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + sectionId: String, + params: WorkspacePreferenceRetrieveParams = WorkspacePreferenceRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + sectionId: String, + params: WorkspacePreferenceRetrieveParams = WorkspacePreferenceRetrieveParams.none(), + ): HttpResponseFor = + retrieve(sectionId, params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: WorkspacePreferenceRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: WorkspacePreferenceRetrieveParams + ): HttpResponseFor = retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + sectionId: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + retrieve(sectionId, WorkspacePreferenceRetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /preferences/sections`, but is otherwise the same as + * [WorkspacePreferenceService.list]. + */ + @MustBeClosed + fun list(): HttpResponseFor = + list(WorkspacePreferenceListParams.none()) + + /** @see list */ + @MustBeClosed + fun list( + params: WorkspacePreferenceListParams = WorkspacePreferenceListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see list */ + @MustBeClosed + fun list( + params: WorkspacePreferenceListParams = WorkspacePreferenceListParams.none() + ): HttpResponseFor = list(params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list(requestOptions: RequestOptions): HttpResponseFor = + list(WorkspacePreferenceListParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `delete /preferences/sections/{section_id}`, but is + * otherwise the same as [WorkspacePreferenceService.archive]. + */ + @MustBeClosed + fun archive(sectionId: String): HttpResponse = + archive(sectionId, WorkspacePreferenceArchiveParams.none()) + + /** @see archive */ + @MustBeClosed + fun archive( + sectionId: String, + params: WorkspacePreferenceArchiveParams = WorkspacePreferenceArchiveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponse = archive(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see archive */ + @MustBeClosed + fun archive( + sectionId: String, + params: WorkspacePreferenceArchiveParams = WorkspacePreferenceArchiveParams.none(), + ): HttpResponse = archive(sectionId, params, RequestOptions.none()) + + /** @see archive */ + @MustBeClosed + fun archive( + params: WorkspacePreferenceArchiveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponse + + /** @see archive */ + @MustBeClosed + fun archive(params: WorkspacePreferenceArchiveParams): HttpResponse = + archive(params, RequestOptions.none()) + + /** @see archive */ + @MustBeClosed + fun archive(sectionId: String, requestOptions: RequestOptions): HttpResponse = + archive(sectionId, WorkspacePreferenceArchiveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `post /preferences/publish`, but is otherwise the same as + * [WorkspacePreferenceService.publish]. + */ + @MustBeClosed + fun publish(): HttpResponseFor = + publish(WorkspacePreferencePublishParams.none()) + + /** @see publish */ + @MustBeClosed + fun publish( + params: WorkspacePreferencePublishParams = WorkspacePreferencePublishParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see publish */ + @MustBeClosed + fun publish( + params: WorkspacePreferencePublishParams = WorkspacePreferencePublishParams.none() + ): HttpResponseFor = publish(params, RequestOptions.none()) + + /** @see publish */ + @MustBeClosed + fun publish(requestOptions: RequestOptions): HttpResponseFor = + publish(WorkspacePreferencePublishParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `put /preferences/sections/{section_id}`, but is + * otherwise the same as [WorkspacePreferenceService.replace]. + */ + @MustBeClosed + fun replace( + sectionId: String, + params: WorkspacePreferenceReplaceParams, + ): HttpResponseFor = + replace(sectionId, params, RequestOptions.none()) + + /** @see replace */ + @MustBeClosed + fun replace( + sectionId: String, + params: WorkspacePreferenceReplaceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + replace(params.toBuilder().sectionId(sectionId).build(), requestOptions) + + /** @see replace */ + @MustBeClosed + fun replace( + params: WorkspacePreferenceReplaceParams + ): HttpResponseFor = replace(params, RequestOptions.none()) + + /** @see replace */ + @MustBeClosed + fun replace( + params: WorkspacePreferenceReplaceParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } +} diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/PreferenceSectionServiceImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/WorkspacePreferenceServiceImpl.kt similarity index 74% rename from courier-java-core/src/main/kotlin/com/courier/services/blocking/PreferenceSectionServiceImpl.kt rename to courier-java-core/src/main/kotlin/com/courier/services/blocking/WorkspacePreferenceServiceImpl.kt index 470be2f..d08ce1c 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/PreferenceSectionServiceImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/WorkspacePreferenceServiceImpl.kt @@ -17,78 +17,80 @@ import com.courier.core.http.HttpResponseFor import com.courier.core.http.json import com.courier.core.http.parseable import com.courier.core.prepare -import com.courier.models.preferencesections.PreferenceSectionArchiveParams -import com.courier.models.preferencesections.PreferenceSectionCreateParams -import com.courier.models.preferencesections.PreferenceSectionGetResponse -import com.courier.models.preferencesections.PreferenceSectionListParams -import com.courier.models.preferencesections.PreferenceSectionListResponse -import com.courier.models.preferencesections.PreferenceSectionPublishParams -import com.courier.models.preferencesections.PreferenceSectionReplaceParams -import com.courier.models.preferencesections.PreferenceSectionRetrieveParams -import com.courier.models.preferencesections.PublishPreferencesResponse -import com.courier.services.blocking.preferencesections.TopicService -import com.courier.services.blocking.preferencesections.TopicServiceImpl +import com.courier.models.workspacepreferences.PublishPreferencesResponse +import com.courier.models.workspacepreferences.WorkspacePreferenceArchiveParams +import com.courier.models.workspacepreferences.WorkspacePreferenceCreateParams +import com.courier.models.workspacepreferences.WorkspacePreferenceGetResponse +import com.courier.models.workspacepreferences.WorkspacePreferenceListParams +import com.courier.models.workspacepreferences.WorkspacePreferenceListResponse +import com.courier.models.workspacepreferences.WorkspacePreferencePublishParams +import com.courier.models.workspacepreferences.WorkspacePreferenceReplaceParams +import com.courier.models.workspacepreferences.WorkspacePreferenceRetrieveParams +import com.courier.services.blocking.workspacepreferences.TopicService +import com.courier.services.blocking.workspacepreferences.TopicServiceImpl import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -class PreferenceSectionServiceImpl internal constructor(private val clientOptions: ClientOptions) : - PreferenceSectionService { +class WorkspacePreferenceServiceImpl +internal constructor(private val clientOptions: ClientOptions) : WorkspacePreferenceService { - private val withRawResponse: PreferenceSectionService.WithRawResponse by lazy { + private val withRawResponse: WorkspacePreferenceService.WithRawResponse by lazy { WithRawResponseImpl(clientOptions) } private val topics: TopicService by lazy { TopicServiceImpl(clientOptions) } - override fun withRawResponse(): PreferenceSectionService.WithRawResponse = withRawResponse + override fun withRawResponse(): WorkspacePreferenceService.WithRawResponse = withRawResponse - override fun withOptions(modifier: Consumer): PreferenceSectionService = - PreferenceSectionServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun withOptions( + modifier: Consumer + ): WorkspacePreferenceService = + WorkspacePreferenceServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) override fun topics(): TopicService = topics override fun create( - params: PreferenceSectionCreateParams, + params: WorkspacePreferenceCreateParams, requestOptions: RequestOptions, - ): PreferenceSectionGetResponse = + ): WorkspacePreferenceGetResponse = // post /preferences/sections withRawResponse().create(params, requestOptions).parse() override fun retrieve( - params: PreferenceSectionRetrieveParams, + params: WorkspacePreferenceRetrieveParams, requestOptions: RequestOptions, - ): PreferenceSectionGetResponse = + ): WorkspacePreferenceGetResponse = // get /preferences/sections/{section_id} withRawResponse().retrieve(params, requestOptions).parse() override fun list( - params: PreferenceSectionListParams, + params: WorkspacePreferenceListParams, requestOptions: RequestOptions, - ): PreferenceSectionListResponse = + ): WorkspacePreferenceListResponse = // get /preferences/sections withRawResponse().list(params, requestOptions).parse() - override fun archive(params: PreferenceSectionArchiveParams, requestOptions: RequestOptions) { + override fun archive(params: WorkspacePreferenceArchiveParams, requestOptions: RequestOptions) { // delete /preferences/sections/{section_id} withRawResponse().archive(params, requestOptions) } override fun publish( - params: PreferenceSectionPublishParams, + params: WorkspacePreferencePublishParams, requestOptions: RequestOptions, ): PublishPreferencesResponse = // post /preferences/publish withRawResponse().publish(params, requestOptions).parse() override fun replace( - params: PreferenceSectionReplaceParams, + params: WorkspacePreferenceReplaceParams, requestOptions: RequestOptions, - ): PreferenceSectionGetResponse = + ): WorkspacePreferenceGetResponse = // put /preferences/sections/{section_id} withRawResponse().replace(params, requestOptions).parse() class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - PreferenceSectionService.WithRawResponse { + WorkspacePreferenceService.WithRawResponse { private val errorHandler: Handler = errorHandler(errorBodyHandler(clientOptions.jsonMapper)) @@ -99,20 +101,20 @@ class PreferenceSectionServiceImpl internal constructor(private val clientOption override fun withOptions( modifier: Consumer - ): PreferenceSectionService.WithRawResponse = - PreferenceSectionServiceImpl.WithRawResponseImpl( + ): WorkspacePreferenceService.WithRawResponse = + WorkspacePreferenceServiceImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) override fun topics(): TopicService.WithRawResponse = topics - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun create( - params: PreferenceSectionCreateParams, + params: WorkspacePreferenceCreateParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -134,13 +136,13 @@ class PreferenceSectionServiceImpl internal constructor(private val clientOption } } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun retrieve( - params: PreferenceSectionRetrieveParams, + params: WorkspacePreferenceRetrieveParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("sectionId", params.sectionId().getOrNull()) @@ -164,13 +166,13 @@ class PreferenceSectionServiceImpl internal constructor(private val clientOption } } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun list( - params: PreferenceSectionListParams, + params: WorkspacePreferenceListParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -194,7 +196,7 @@ class PreferenceSectionServiceImpl internal constructor(private val clientOption private val archiveHandler: Handler = emptyHandler() override fun archive( - params: PreferenceSectionArchiveParams, + params: WorkspacePreferenceArchiveParams, requestOptions: RequestOptions, ): HttpResponse { // We check here instead of in the params builder because this can be specified @@ -219,7 +221,7 @@ class PreferenceSectionServiceImpl internal constructor(private val clientOption jsonHandler(clientOptions.jsonMapper) override fun publish( - params: PreferenceSectionPublishParams, + params: WorkspacePreferencePublishParams, requestOptions: RequestOptions, ): HttpResponseFor { val request = @@ -243,13 +245,13 @@ class PreferenceSectionServiceImpl internal constructor(private val clientOption } } - private val replaceHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val replaceHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun replace( - params: PreferenceSectionReplaceParams, + params: WorkspacePreferenceReplaceParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("sectionId", params.sectionId().getOrNull()) diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/preferencesections/TopicService.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/workspacepreferences/TopicService.kt similarity index 69% rename from courier-java-core/src/main/kotlin/com/courier/services/blocking/preferencesections/TopicService.kt rename to courier-java-core/src/main/kotlin/com/courier/services/blocking/workspacepreferences/TopicService.kt index fc0d220..b90d7c5 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/preferencesections/TopicService.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/workspacepreferences/TopicService.kt @@ -1,18 +1,18 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.services.blocking.preferencesections +package com.courier.services.blocking.workspacepreferences import com.courier.core.ClientOptions import com.courier.core.RequestOptions import com.courier.core.http.HttpResponse import com.courier.core.http.HttpResponseFor -import com.courier.models.preferencesections.PreferenceTopicGetResponse -import com.courier.models.preferencesections.PreferenceTopicListResponse -import com.courier.models.preferencesections.topics.TopicArchiveParams -import com.courier.models.preferencesections.topics.TopicCreateParams -import com.courier.models.preferencesections.topics.TopicListParams -import com.courier.models.preferencesections.topics.TopicReplaceParams -import com.courier.models.preferencesections.topics.TopicRetrieveParams +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicGetResponse +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicListResponse +import com.courier.models.workspacepreferences.topics.TopicArchiveParams +import com.courier.models.workspacepreferences.topics.TopicCreateParams +import com.courier.models.workspacepreferences.topics.TopicListParams +import com.courier.models.workspacepreferences.topics.TopicReplaceParams +import com.courier.models.workspacepreferences.topics.TopicRetrieveParams import com.google.errorprone.annotations.MustBeClosed import java.util.function.Consumer @@ -31,10 +31,10 @@ interface TopicService { fun withOptions(modifier: Consumer): TopicService /** - * Create a subscription preference topic inside a section. Fails with 404 if the section does - * not exist. The topic id is generated and returned. + * Create a subscription preference topic inside a workspace preference. Fails with 404 if the + * workspace preference does not exist. The topic id is generated and returned. */ - fun create(sectionId: String, params: TopicCreateParams): PreferenceTopicGetResponse = + fun create(sectionId: String, params: TopicCreateParams): WorkspacePreferenceTopicGetResponse = create(sectionId, params, RequestOptions.none()) /** @see create */ @@ -42,46 +42,49 @@ interface TopicService { sectionId: String, params: TopicCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): PreferenceTopicGetResponse = + ): WorkspacePreferenceTopicGetResponse = create(params.toBuilder().sectionId(sectionId).build(), requestOptions) /** @see create */ - fun create(params: TopicCreateParams): PreferenceTopicGetResponse = + fun create(params: TopicCreateParams): WorkspacePreferenceTopicGetResponse = create(params, RequestOptions.none()) /** @see create */ fun create( params: TopicCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): PreferenceTopicGetResponse + ): WorkspacePreferenceTopicGetResponse /** - * Retrieve a topic within a section. Returns 404 if the section does not exist, the topic does - * not exist, or the topic belongs to a different section. + * Retrieve a topic within a workspace preference. Returns 404 if the workspace preference does + * not exist, the topic does not exist, or the topic belongs to a different workspace + * preference. */ - fun retrieve(topicId: String, params: TopicRetrieveParams): PreferenceTopicGetResponse = - retrieve(topicId, params, RequestOptions.none()) + fun retrieve( + topicId: String, + params: TopicRetrieveParams, + ): WorkspacePreferenceTopicGetResponse = retrieve(topicId, params, RequestOptions.none()) /** @see retrieve */ fun retrieve( topicId: String, params: TopicRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ): PreferenceTopicGetResponse = + ): WorkspacePreferenceTopicGetResponse = retrieve(params.toBuilder().topicId(topicId).build(), requestOptions) /** @see retrieve */ - fun retrieve(params: TopicRetrieveParams): PreferenceTopicGetResponse = + fun retrieve(params: TopicRetrieveParams): WorkspacePreferenceTopicGetResponse = retrieve(params, RequestOptions.none()) /** @see retrieve */ fun retrieve( params: TopicRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ): PreferenceTopicGetResponse + ): WorkspacePreferenceTopicGetResponse - /** List the topics in a preference section. */ - fun list(sectionId: String): PreferenceTopicListResponse = + /** List the topics in a workspace preference. */ + fun list(sectionId: String): WorkspacePreferenceTopicListResponse = list(sectionId, TopicListParams.none()) /** @see list */ @@ -89,30 +92,33 @@ interface TopicService { sectionId: String, params: TopicListParams = TopicListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): PreferenceTopicListResponse = + ): WorkspacePreferenceTopicListResponse = list(params.toBuilder().sectionId(sectionId).build(), requestOptions) /** @see list */ fun list( sectionId: String, params: TopicListParams = TopicListParams.none(), - ): PreferenceTopicListResponse = list(sectionId, params, RequestOptions.none()) + ): WorkspacePreferenceTopicListResponse = list(sectionId, params, RequestOptions.none()) /** @see list */ fun list( params: TopicListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): PreferenceTopicListResponse + ): WorkspacePreferenceTopicListResponse /** @see list */ - fun list(params: TopicListParams): PreferenceTopicListResponse = + fun list(params: TopicListParams): WorkspacePreferenceTopicListResponse = list(params, RequestOptions.none()) /** @see list */ - fun list(sectionId: String, requestOptions: RequestOptions): PreferenceTopicListResponse = + fun list( + sectionId: String, + requestOptions: RequestOptions, + ): WorkspacePreferenceTopicListResponse = list(sectionId, TopicListParams.none(), requestOptions) - /** Archive a topic and remove it from its section. Same 404 rules as GET. */ + /** Archive a topic and remove it from its workspace preference. Same 404 rules as GET. */ fun archive(topicId: String, params: TopicArchiveParams) = archive(topicId, params, RequestOptions.none()) @@ -130,10 +136,10 @@ interface TopicService { fun archive(params: TopicArchiveParams, requestOptions: RequestOptions = RequestOptions.none()) /** - * Replace a topic within a section. Full document replacement; missing optional fields are - * cleared. Same 404 rules as GET. + * Replace a topic within a workspace preference. Full document replacement; missing optional + * fields are cleared. Same 404 rules as GET. */ - fun replace(topicId: String, params: TopicReplaceParams): PreferenceTopicGetResponse = + fun replace(topicId: String, params: TopicReplaceParams): WorkspacePreferenceTopicGetResponse = replace(topicId, params, RequestOptions.none()) /** @see replace */ @@ -141,18 +147,18 @@ interface TopicService { topicId: String, params: TopicReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): PreferenceTopicGetResponse = + ): WorkspacePreferenceTopicGetResponse = replace(params.toBuilder().topicId(topicId).build(), requestOptions) /** @see replace */ - fun replace(params: TopicReplaceParams): PreferenceTopicGetResponse = + fun replace(params: TopicReplaceParams): WorkspacePreferenceTopicGetResponse = replace(params, RequestOptions.none()) /** @see replace */ fun replace( params: TopicReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): PreferenceTopicGetResponse + ): WorkspacePreferenceTopicGetResponse /** A view of [TopicService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -172,7 +178,7 @@ interface TopicService { fun create( sectionId: String, params: TopicCreateParams, - ): HttpResponseFor = + ): HttpResponseFor = create(sectionId, params, RequestOptions.none()) /** @see create */ @@ -181,12 +187,14 @@ interface TopicService { sectionId: String, params: TopicCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = + ): HttpResponseFor = create(params.toBuilder().sectionId(sectionId).build(), requestOptions) /** @see create */ @MustBeClosed - fun create(params: TopicCreateParams): HttpResponseFor = + fun create( + params: TopicCreateParams + ): HttpResponseFor = create(params, RequestOptions.none()) /** @see create */ @@ -194,7 +202,7 @@ interface TopicService { fun create( params: TopicCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor /** * Returns a raw HTTP response for `get @@ -205,7 +213,7 @@ interface TopicService { fun retrieve( topicId: String, params: TopicRetrieveParams, - ): HttpResponseFor = + ): HttpResponseFor = retrieve(topicId, params, RequestOptions.none()) /** @see retrieve */ @@ -214,12 +222,14 @@ interface TopicService { topicId: String, params: TopicRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = + ): HttpResponseFor = retrieve(params.toBuilder().topicId(topicId).build(), requestOptions) /** @see retrieve */ @MustBeClosed - fun retrieve(params: TopicRetrieveParams): HttpResponseFor = + fun retrieve( + params: TopicRetrieveParams + ): HttpResponseFor = retrieve(params, RequestOptions.none()) /** @see retrieve */ @@ -227,14 +237,14 @@ interface TopicService { fun retrieve( params: TopicRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor /** * Returns a raw HTTP response for `get /preferences/sections/{section_id}/topics`, but is * otherwise the same as [TopicService.list]. */ @MustBeClosed - fun list(sectionId: String): HttpResponseFor = + fun list(sectionId: String): HttpResponseFor = list(sectionId, TopicListParams.none()) /** @see list */ @@ -243,7 +253,7 @@ interface TopicService { sectionId: String, params: TopicListParams = TopicListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = + ): HttpResponseFor = list(params.toBuilder().sectionId(sectionId).build(), requestOptions) /** @see list */ @@ -251,7 +261,7 @@ interface TopicService { fun list( sectionId: String, params: TopicListParams = TopicListParams.none(), - ): HttpResponseFor = + ): HttpResponseFor = list(sectionId, params, RequestOptions.none()) /** @see list */ @@ -259,11 +269,11 @@ interface TopicService { fun list( params: TopicListParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor /** @see list */ @MustBeClosed - fun list(params: TopicListParams): HttpResponseFor = + fun list(params: TopicListParams): HttpResponseFor = list(params, RequestOptions.none()) /** @see list */ @@ -271,7 +281,7 @@ interface TopicService { fun list( sectionId: String, requestOptions: RequestOptions, - ): HttpResponseFor = + ): HttpResponseFor = list(sectionId, TopicListParams.none(), requestOptions) /** @@ -312,7 +322,7 @@ interface TopicService { fun replace( topicId: String, params: TopicReplaceParams, - ): HttpResponseFor = + ): HttpResponseFor = replace(topicId, params, RequestOptions.none()) /** @see replace */ @@ -321,12 +331,14 @@ interface TopicService { topicId: String, params: TopicReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = + ): HttpResponseFor = replace(params.toBuilder().topicId(topicId).build(), requestOptions) /** @see replace */ @MustBeClosed - fun replace(params: TopicReplaceParams): HttpResponseFor = + fun replace( + params: TopicReplaceParams + ): HttpResponseFor = replace(params, RequestOptions.none()) /** @see replace */ @@ -334,6 +346,6 @@ interface TopicService { fun replace( params: TopicReplaceParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor } } diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/preferencesections/TopicServiceImpl.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/workspacepreferences/TopicServiceImpl.kt similarity index 84% rename from courier-java-core/src/main/kotlin/com/courier/services/blocking/preferencesections/TopicServiceImpl.kt rename to courier-java-core/src/main/kotlin/com/courier/services/blocking/workspacepreferences/TopicServiceImpl.kt index da17bdf..5acd30e 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/preferencesections/TopicServiceImpl.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/workspacepreferences/TopicServiceImpl.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.services.blocking.preferencesections +package com.courier.services.blocking.workspacepreferences import com.courier.core.ClientOptions import com.courier.core.RequestOptions @@ -17,13 +17,13 @@ import com.courier.core.http.HttpResponseFor import com.courier.core.http.json import com.courier.core.http.parseable import com.courier.core.prepare -import com.courier.models.preferencesections.PreferenceTopicGetResponse -import com.courier.models.preferencesections.PreferenceTopicListResponse -import com.courier.models.preferencesections.topics.TopicArchiveParams -import com.courier.models.preferencesections.topics.TopicCreateParams -import com.courier.models.preferencesections.topics.TopicListParams -import com.courier.models.preferencesections.topics.TopicReplaceParams -import com.courier.models.preferencesections.topics.TopicRetrieveParams +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicGetResponse +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicListResponse +import com.courier.models.workspacepreferences.topics.TopicArchiveParams +import com.courier.models.workspacepreferences.topics.TopicCreateParams +import com.courier.models.workspacepreferences.topics.TopicListParams +import com.courier.models.workspacepreferences.topics.TopicReplaceParams +import com.courier.models.workspacepreferences.topics.TopicRetrieveParams import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull @@ -42,21 +42,21 @@ class TopicServiceImpl internal constructor(private val clientOptions: ClientOpt override fun create( params: TopicCreateParams, requestOptions: RequestOptions, - ): PreferenceTopicGetResponse = + ): WorkspacePreferenceTopicGetResponse = // post /preferences/sections/{section_id}/topics withRawResponse().create(params, requestOptions).parse() override fun retrieve( params: TopicRetrieveParams, requestOptions: RequestOptions, - ): PreferenceTopicGetResponse = + ): WorkspacePreferenceTopicGetResponse = // get /preferences/sections/{section_id}/topics/{topic_id} withRawResponse().retrieve(params, requestOptions).parse() override fun list( params: TopicListParams, requestOptions: RequestOptions, - ): PreferenceTopicListResponse = + ): WorkspacePreferenceTopicListResponse = // get /preferences/sections/{section_id}/topics withRawResponse().list(params, requestOptions).parse() @@ -68,7 +68,7 @@ class TopicServiceImpl internal constructor(private val clientOptions: ClientOpt override fun replace( params: TopicReplaceParams, requestOptions: RequestOptions, - ): PreferenceTopicGetResponse = + ): WorkspacePreferenceTopicGetResponse = // put /preferences/sections/{section_id}/topics/{topic_id} withRawResponse().replace(params, requestOptions).parse() @@ -85,13 +85,13 @@ class TopicServiceImpl internal constructor(private val clientOptions: ClientOpt clientOptions.toBuilder().apply(modifier::accept).build() ) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun create( params: TopicCreateParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("sectionId", params.sectionId().getOrNull()) @@ -116,13 +116,13 @@ class TopicServiceImpl internal constructor(private val clientOptions: ClientOpt } } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun retrieve( params: TopicRetrieveParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("topicId", params.topicId().getOrNull()) @@ -152,13 +152,13 @@ class TopicServiceImpl internal constructor(private val clientOptions: ClientOpt } } - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun list( params: TopicListParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("sectionId", params.sectionId().getOrNull()) @@ -212,13 +212,13 @@ class TopicServiceImpl internal constructor(private val clientOptions: ClientOpt } } - private val replaceHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val replaceHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun replace( params: TopicReplaceParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("topicId", params.topicId().getOrNull()) diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionListParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionListParamsTest.kt deleted file mode 100644 index 48d6261..0000000 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionListParamsTest.kt +++ /dev/null @@ -1,13 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.models.preferencesections - -import org.junit.jupiter.api.Test - -internal class PreferenceSectionListParamsTest { - - @Test - fun create() { - PreferenceSectionListParams.builder().build() - } -} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionPublishParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionPublishParamsTest.kt deleted file mode 100644 index 2c0dca9..0000000 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionPublishParamsTest.kt +++ /dev/null @@ -1,13 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.models.preferencesections - -import org.junit.jupiter.api.Test - -internal class PreferenceSectionPublishParamsTest { - - @Test - fun create() { - PreferenceSectionPublishParams.builder().build() - } -} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionReplaceRequestTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionReplaceRequestTest.kt deleted file mode 100644 index 7917ee2..0000000 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionReplaceRequestTest.kt +++ /dev/null @@ -1,48 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.models.preferencesections - -import com.courier.core.jsonMapper -import com.courier.models.ChannelClassification -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class PreferenceSectionReplaceRequestTest { - - @Test - fun create() { - val preferenceSectionReplaceRequest = - PreferenceSectionReplaceRequest.builder() - .name("name") - .hasCustomRouting(true) - .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) - .build() - - assertThat(preferenceSectionReplaceRequest.name()).isEqualTo("name") - assertThat(preferenceSectionReplaceRequest.hasCustomRouting()).contains(true) - assertThat(preferenceSectionReplaceRequest.routingOptions().getOrNull()) - .containsExactly(ChannelClassification.DIRECT_MESSAGE) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val preferenceSectionReplaceRequest = - PreferenceSectionReplaceRequest.builder() - .name("name") - .hasCustomRouting(true) - .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) - .build() - - val roundtrippedPreferenceSectionReplaceRequest = - jsonMapper.readValue( - jsonMapper.writeValueAsString(preferenceSectionReplaceRequest), - jacksonTypeRef(), - ) - - assertThat(roundtrippedPreferenceSectionReplaceRequest) - .isEqualTo(preferenceSectionReplaceRequest) - } -} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceTopicCreateRequestTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceTopicCreateRequestTest.kt deleted file mode 100644 index ff697c3..0000000 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceTopicCreateRequestTest.kt +++ /dev/null @@ -1,72 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.models.preferencesections - -import com.courier.core.JsonValue -import com.courier.core.jsonMapper -import com.courier.models.ChannelClassification -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class PreferenceTopicCreateRequestTest { - - @Test - fun create() { - val preferenceTopicCreateRequest = - PreferenceTopicCreateRequest.builder() - .defaultStatus(PreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) - .name("name") - .addAllowedPreference(PreferenceTopicCreateRequest.AllowedPreference.SNOOZE) - .includeUnsubscribeHeader(true) - .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) - .topicData( - PreferenceTopicCreateRequest.TopicData.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - - assertThat(preferenceTopicCreateRequest.defaultStatus()) - .isEqualTo(PreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) - assertThat(preferenceTopicCreateRequest.name()).isEqualTo("name") - assertThat(preferenceTopicCreateRequest.allowedPreferences().getOrNull()) - .containsExactly(PreferenceTopicCreateRequest.AllowedPreference.SNOOZE) - assertThat(preferenceTopicCreateRequest.includeUnsubscribeHeader()).contains(true) - assertThat(preferenceTopicCreateRequest.routingOptions().getOrNull()) - .containsExactly(ChannelClassification.DIRECT_MESSAGE) - assertThat(preferenceTopicCreateRequest.topicData()) - .contains( - PreferenceTopicCreateRequest.TopicData.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val preferenceTopicCreateRequest = - PreferenceTopicCreateRequest.builder() - .defaultStatus(PreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) - .name("name") - .addAllowedPreference(PreferenceTopicCreateRequest.AllowedPreference.SNOOZE) - .includeUnsubscribeHeader(true) - .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) - .topicData( - PreferenceTopicCreateRequest.TopicData.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - - val roundtrippedPreferenceTopicCreateRequest = - jsonMapper.readValue( - jsonMapper.writeValueAsString(preferenceTopicCreateRequest), - jacksonTypeRef(), - ) - - assertThat(roundtrippedPreferenceTopicCreateRequest).isEqualTo(preferenceTopicCreateRequest) - } -} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceTopicGetResponseTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceTopicGetResponseTest.kt deleted file mode 100644 index 755d78e..0000000 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceTopicGetResponseTest.kt +++ /dev/null @@ -1,86 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.models.preferencesections - -import com.courier.core.JsonValue -import com.courier.core.jsonMapper -import com.courier.models.ChannelClassification -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class PreferenceTopicGetResponseTest { - - @Test - fun create() { - val preferenceTopicGetResponse = - PreferenceTopicGetResponse.builder() - .id("id") - .addAllowedPreference(PreferenceTopicGetResponse.AllowedPreference.SNOOZE) - .created("created") - .defaultStatus(PreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) - .includeUnsubscribeHeader(true) - .name("name") - .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) - .topicData( - PreferenceTopicGetResponse.TopicData.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .updated("updated") - .creator("creator") - .updater("updater") - .build() - - assertThat(preferenceTopicGetResponse.id()).isEqualTo("id") - assertThat(preferenceTopicGetResponse.allowedPreferences()) - .containsExactly(PreferenceTopicGetResponse.AllowedPreference.SNOOZE) - assertThat(preferenceTopicGetResponse.created()).isEqualTo("created") - assertThat(preferenceTopicGetResponse.defaultStatus()) - .isEqualTo(PreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) - assertThat(preferenceTopicGetResponse.includeUnsubscribeHeader()).isEqualTo(true) - assertThat(preferenceTopicGetResponse.name()).isEqualTo("name") - assertThat(preferenceTopicGetResponse.routingOptions()) - .containsExactly(ChannelClassification.DIRECT_MESSAGE) - assertThat(preferenceTopicGetResponse.topicData()) - .isEqualTo( - PreferenceTopicGetResponse.TopicData.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - assertThat(preferenceTopicGetResponse.updated()).isEqualTo("updated") - assertThat(preferenceTopicGetResponse.creator()).contains("creator") - assertThat(preferenceTopicGetResponse.updater()).contains("updater") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val preferenceTopicGetResponse = - PreferenceTopicGetResponse.builder() - .id("id") - .addAllowedPreference(PreferenceTopicGetResponse.AllowedPreference.SNOOZE) - .created("created") - .defaultStatus(PreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) - .includeUnsubscribeHeader(true) - .name("name") - .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) - .topicData( - PreferenceTopicGetResponse.TopicData.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .updated("updated") - .creator("creator") - .updater("updater") - .build() - - val roundtrippedPreferenceTopicGetResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(preferenceTopicGetResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedPreferenceTopicGetResponse).isEqualTo(preferenceTopicGetResponse) - } -} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceTopicReplaceRequestTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceTopicReplaceRequestTest.kt deleted file mode 100644 index 6a174aa..0000000 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceTopicReplaceRequestTest.kt +++ /dev/null @@ -1,73 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.models.preferencesections - -import com.courier.core.JsonValue -import com.courier.core.jsonMapper -import com.courier.models.ChannelClassification -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class PreferenceTopicReplaceRequestTest { - - @Test - fun create() { - val preferenceTopicReplaceRequest = - PreferenceTopicReplaceRequest.builder() - .defaultStatus(PreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) - .name("name") - .addAllowedPreference(PreferenceTopicReplaceRequest.AllowedPreference.SNOOZE) - .includeUnsubscribeHeader(true) - .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) - .topicData( - PreferenceTopicReplaceRequest.TopicData.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - - assertThat(preferenceTopicReplaceRequest.defaultStatus()) - .isEqualTo(PreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) - assertThat(preferenceTopicReplaceRequest.name()).isEqualTo("name") - assertThat(preferenceTopicReplaceRequest.allowedPreferences().getOrNull()) - .containsExactly(PreferenceTopicReplaceRequest.AllowedPreference.SNOOZE) - assertThat(preferenceTopicReplaceRequest.includeUnsubscribeHeader()).contains(true) - assertThat(preferenceTopicReplaceRequest.routingOptions().getOrNull()) - .containsExactly(ChannelClassification.DIRECT_MESSAGE) - assertThat(preferenceTopicReplaceRequest.topicData()) - .contains( - PreferenceTopicReplaceRequest.TopicData.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val preferenceTopicReplaceRequest = - PreferenceTopicReplaceRequest.builder() - .defaultStatus(PreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) - .name("name") - .addAllowedPreference(PreferenceTopicReplaceRequest.AllowedPreference.SNOOZE) - .includeUnsubscribeHeader(true) - .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) - .topicData( - PreferenceTopicReplaceRequest.TopicData.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - - val roundtrippedPreferenceTopicReplaceRequest = - jsonMapper.readValue( - jsonMapper.writeValueAsString(preferenceTopicReplaceRequest), - jacksonTypeRef(), - ) - - assertThat(roundtrippedPreferenceTopicReplaceRequest) - .isEqualTo(preferenceTopicReplaceRequest) - } -} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PublishPreferencesResponseTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/PublishPreferencesResponseTest.kt similarity index 97% rename from courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PublishPreferencesResponseTest.kt rename to courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/PublishPreferencesResponseTest.kt index 9d5eebb..11ada03 100644 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PublishPreferencesResponseTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/PublishPreferencesResponseTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.jsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionArchiveParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceArchiveParamsTest.kt similarity index 57% rename from courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionArchiveParamsTest.kt rename to courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceArchiveParamsTest.kt index b7911be..2aed66b 100644 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionArchiveParamsTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceArchiveParamsTest.kt @@ -1,20 +1,20 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -internal class PreferenceSectionArchiveParamsTest { +internal class WorkspacePreferenceArchiveParamsTest { @Test fun create() { - PreferenceSectionArchiveParams.builder().sectionId("section_id").build() + WorkspacePreferenceArchiveParams.builder().sectionId("section_id").build() } @Test fun pathParams() { - val params = PreferenceSectionArchiveParams.builder().sectionId("section_id").build() + val params = WorkspacePreferenceArchiveParams.builder().sectionId("section_id").build() assertThat(params._pathParam(0)).isEqualTo("section_id") // out-of-bound path param diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionCreateParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceCreateParamsTest.kt similarity index 62% rename from courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionCreateParamsTest.kt rename to courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceCreateParamsTest.kt index 8bc3563..e4aadc3 100644 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionCreateParamsTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceCreateParamsTest.kt @@ -1,18 +1,18 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.models.ChannelClassification import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -internal class PreferenceSectionCreateParamsTest { +internal class WorkspacePreferenceCreateParamsTest { @Test fun create() { - PreferenceSectionCreateParams.builder() - .preferenceSectionCreateRequest( - PreferenceSectionCreateRequest.builder() + WorkspacePreferenceCreateParams.builder() + .workspacePreferenceCreateRequest( + WorkspacePreferenceCreateRequest.builder() .name("Account Notifications") .hasCustomRouting(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) @@ -24,9 +24,9 @@ internal class PreferenceSectionCreateParamsTest { @Test fun body() { val params = - PreferenceSectionCreateParams.builder() - .preferenceSectionCreateRequest( - PreferenceSectionCreateRequest.builder() + WorkspacePreferenceCreateParams.builder() + .workspacePreferenceCreateRequest( + WorkspacePreferenceCreateRequest.builder() .name("Account Notifications") .hasCustomRouting(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) @@ -38,7 +38,7 @@ internal class PreferenceSectionCreateParamsTest { assertThat(body) .isEqualTo( - PreferenceSectionCreateRequest.builder() + WorkspacePreferenceCreateRequest.builder() .name("Account Notifications") .hasCustomRouting(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) @@ -49,9 +49,9 @@ internal class PreferenceSectionCreateParamsTest { @Test fun bodyWithoutOptionalFields() { val params = - PreferenceSectionCreateParams.builder() - .preferenceSectionCreateRequest( - PreferenceSectionCreateRequest.builder().name("Account Notifications").build() + WorkspacePreferenceCreateParams.builder() + .workspacePreferenceCreateRequest( + WorkspacePreferenceCreateRequest.builder().name("Account Notifications").build() ) .build() @@ -59,7 +59,7 @@ internal class PreferenceSectionCreateParamsTest { assertThat(body) .isEqualTo( - PreferenceSectionCreateRequest.builder().name("Account Notifications").build() + WorkspacePreferenceCreateRequest.builder().name("Account Notifications").build() ) } } diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionCreateRequestTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceCreateRequestTest.kt similarity index 50% rename from courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionCreateRequestTest.kt rename to courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceCreateRequestTest.kt index 16d611f..2757bf8 100644 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionCreateRequestTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceCreateRequestTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.jsonMapper import com.courier.models.ChannelClassification @@ -9,40 +9,40 @@ import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -internal class PreferenceSectionCreateRequestTest { +internal class WorkspacePreferenceCreateRequestTest { @Test fun create() { - val preferenceSectionCreateRequest = - PreferenceSectionCreateRequest.builder() + val workspacePreferenceCreateRequest = + WorkspacePreferenceCreateRequest.builder() .name("name") .hasCustomRouting(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .build() - assertThat(preferenceSectionCreateRequest.name()).isEqualTo("name") - assertThat(preferenceSectionCreateRequest.hasCustomRouting()).contains(true) - assertThat(preferenceSectionCreateRequest.routingOptions().getOrNull()) + assertThat(workspacePreferenceCreateRequest.name()).isEqualTo("name") + assertThat(workspacePreferenceCreateRequest.hasCustomRouting()).contains(true) + assertThat(workspacePreferenceCreateRequest.routingOptions().getOrNull()) .containsExactly(ChannelClassification.DIRECT_MESSAGE) } @Test fun roundtrip() { val jsonMapper = jsonMapper() - val preferenceSectionCreateRequest = - PreferenceSectionCreateRequest.builder() + val workspacePreferenceCreateRequest = + WorkspacePreferenceCreateRequest.builder() .name("name") .hasCustomRouting(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .build() - val roundtrippedPreferenceSectionCreateRequest = + val roundtrippedWorkspacePreferenceCreateRequest = jsonMapper.readValue( - jsonMapper.writeValueAsString(preferenceSectionCreateRequest), - jacksonTypeRef(), + jsonMapper.writeValueAsString(workspacePreferenceCreateRequest), + jacksonTypeRef(), ) - assertThat(roundtrippedPreferenceSectionCreateRequest) - .isEqualTo(preferenceSectionCreateRequest) + assertThat(roundtrippedWorkspacePreferenceCreateRequest) + .isEqualTo(workspacePreferenceCreateRequest) } } diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionGetResponseTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceGetResponseTest.kt similarity index 55% rename from courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionGetResponseTest.kt rename to courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceGetResponseTest.kt index 2e69f86..bbfae02 100644 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionGetResponseTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceGetResponseTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.JsonValue import com.courier.core.jsonMapper @@ -9,28 +9,30 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -internal class PreferenceSectionGetResponseTest { +internal class WorkspacePreferenceGetResponseTest { @Test fun create() { - val preferenceSectionGetResponse = - PreferenceSectionGetResponse.builder() + val workspacePreferenceGetResponse = + WorkspacePreferenceGetResponse.builder() .id("id") .created("created") .hasCustomRouting(true) .name("name") .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .addTopic( - PreferenceTopicGetResponse.builder() + WorkspacePreferenceTopicGetResponse.builder() .id("id") - .addAllowedPreference(PreferenceTopicGetResponse.AllowedPreference.SNOOZE) + .addAllowedPreference( + WorkspacePreferenceTopicGetResponse.AllowedPreference.SNOOZE + ) .created("created") - .defaultStatus(PreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) + .defaultStatus(WorkspacePreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) .includeUnsubscribeHeader(true) .name("name") .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicGetResponse.TopicData.builder() + WorkspacePreferenceTopicGetResponse.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -44,24 +46,26 @@ internal class PreferenceSectionGetResponseTest { .updater("updater") .build() - assertThat(preferenceSectionGetResponse.id()).isEqualTo("id") - assertThat(preferenceSectionGetResponse.created()).isEqualTo("created") - assertThat(preferenceSectionGetResponse.hasCustomRouting()).isEqualTo(true) - assertThat(preferenceSectionGetResponse.name()).isEqualTo("name") - assertThat(preferenceSectionGetResponse.routingOptions()) + assertThat(workspacePreferenceGetResponse.id()).isEqualTo("id") + assertThat(workspacePreferenceGetResponse.created()).isEqualTo("created") + assertThat(workspacePreferenceGetResponse.hasCustomRouting()).isEqualTo(true) + assertThat(workspacePreferenceGetResponse.name()).isEqualTo("name") + assertThat(workspacePreferenceGetResponse.routingOptions()) .containsExactly(ChannelClassification.DIRECT_MESSAGE) - assertThat(preferenceSectionGetResponse.topics()) + assertThat(workspacePreferenceGetResponse.topics()) .containsExactly( - PreferenceTopicGetResponse.builder() + WorkspacePreferenceTopicGetResponse.builder() .id("id") - .addAllowedPreference(PreferenceTopicGetResponse.AllowedPreference.SNOOZE) + .addAllowedPreference( + WorkspacePreferenceTopicGetResponse.AllowedPreference.SNOOZE + ) .created("created") - .defaultStatus(PreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) + .defaultStatus(WorkspacePreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) .includeUnsubscribeHeader(true) .name("name") .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicGetResponse.TopicData.builder() + WorkspacePreferenceTopicGetResponse.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -70,32 +74,34 @@ internal class PreferenceSectionGetResponseTest { .updater("updater") .build() ) - assertThat(preferenceSectionGetResponse.creator()).contains("creator") - assertThat(preferenceSectionGetResponse.updated()).contains("updated") - assertThat(preferenceSectionGetResponse.updater()).contains("updater") + assertThat(workspacePreferenceGetResponse.creator()).contains("creator") + assertThat(workspacePreferenceGetResponse.updated()).contains("updated") + assertThat(workspacePreferenceGetResponse.updater()).contains("updater") } @Test fun roundtrip() { val jsonMapper = jsonMapper() - val preferenceSectionGetResponse = - PreferenceSectionGetResponse.builder() + val workspacePreferenceGetResponse = + WorkspacePreferenceGetResponse.builder() .id("id") .created("created") .hasCustomRouting(true) .name("name") .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .addTopic( - PreferenceTopicGetResponse.builder() + WorkspacePreferenceTopicGetResponse.builder() .id("id") - .addAllowedPreference(PreferenceTopicGetResponse.AllowedPreference.SNOOZE) + .addAllowedPreference( + WorkspacePreferenceTopicGetResponse.AllowedPreference.SNOOZE + ) .created("created") - .defaultStatus(PreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) + .defaultStatus(WorkspacePreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) .includeUnsubscribeHeader(true) .name("name") .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicGetResponse.TopicData.builder() + WorkspacePreferenceTopicGetResponse.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -109,12 +115,13 @@ internal class PreferenceSectionGetResponseTest { .updater("updater") .build() - val roundtrippedPreferenceSectionGetResponse = + val roundtrippedWorkspacePreferenceGetResponse = jsonMapper.readValue( - jsonMapper.writeValueAsString(preferenceSectionGetResponse), - jacksonTypeRef(), + jsonMapper.writeValueAsString(workspacePreferenceGetResponse), + jacksonTypeRef(), ) - assertThat(roundtrippedPreferenceSectionGetResponse).isEqualTo(preferenceSectionGetResponse) + assertThat(roundtrippedWorkspacePreferenceGetResponse) + .isEqualTo(workspacePreferenceGetResponse) } } diff --git a/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceListParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceListParamsTest.kt new file mode 100644 index 0000000..6da12a7 --- /dev/null +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceListParamsTest.kt @@ -0,0 +1,13 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.models.workspacepreferences + +import org.junit.jupiter.api.Test + +internal class WorkspacePreferenceListParamsTest { + + @Test + fun create() { + WorkspacePreferenceListParams.builder().build() + } +} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionListResponseTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceListResponseTest.kt similarity index 66% rename from courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionListResponseTest.kt rename to courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceListResponseTest.kt index e4a0fa1..63aef38 100644 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionListResponseTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceListResponseTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.JsonValue import com.courier.core.jsonMapper @@ -9,32 +9,34 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -internal class PreferenceSectionListResponseTest { +internal class WorkspacePreferenceListResponseTest { @Test fun create() { - val preferenceSectionListResponse = - PreferenceSectionListResponse.builder() + val workspacePreferenceListResponse = + WorkspacePreferenceListResponse.builder() .addResult( - PreferenceSectionGetResponse.builder() + WorkspacePreferenceGetResponse.builder() .id("id") .created("created") .hasCustomRouting(true) .name("name") .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .addTopic( - PreferenceTopicGetResponse.builder() + WorkspacePreferenceTopicGetResponse.builder() .id("id") .addAllowedPreference( - PreferenceTopicGetResponse.AllowedPreference.SNOOZE + WorkspacePreferenceTopicGetResponse.AllowedPreference.SNOOZE ) .created("created") - .defaultStatus(PreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) + .defaultStatus( + WorkspacePreferenceTopicGetResponse.DefaultStatus.OPTED_OUT + ) .includeUnsubscribeHeader(true) .name("name") .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicGetResponse.TopicData.builder() + WorkspacePreferenceTopicGetResponse.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -50,27 +52,29 @@ internal class PreferenceSectionListResponseTest { ) .build() - assertThat(preferenceSectionListResponse.results()) + assertThat(workspacePreferenceListResponse.results()) .containsExactly( - PreferenceSectionGetResponse.builder() + WorkspacePreferenceGetResponse.builder() .id("id") .created("created") .hasCustomRouting(true) .name("name") .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .addTopic( - PreferenceTopicGetResponse.builder() + WorkspacePreferenceTopicGetResponse.builder() .id("id") .addAllowedPreference( - PreferenceTopicGetResponse.AllowedPreference.SNOOZE + WorkspacePreferenceTopicGetResponse.AllowedPreference.SNOOZE ) .created("created") - .defaultStatus(PreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) + .defaultStatus( + WorkspacePreferenceTopicGetResponse.DefaultStatus.OPTED_OUT + ) .includeUnsubscribeHeader(true) .name("name") .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicGetResponse.TopicData.builder() + WorkspacePreferenceTopicGetResponse.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -89,28 +93,30 @@ internal class PreferenceSectionListResponseTest { @Test fun roundtrip() { val jsonMapper = jsonMapper() - val preferenceSectionListResponse = - PreferenceSectionListResponse.builder() + val workspacePreferenceListResponse = + WorkspacePreferenceListResponse.builder() .addResult( - PreferenceSectionGetResponse.builder() + WorkspacePreferenceGetResponse.builder() .id("id") .created("created") .hasCustomRouting(true) .name("name") .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .addTopic( - PreferenceTopicGetResponse.builder() + WorkspacePreferenceTopicGetResponse.builder() .id("id") .addAllowedPreference( - PreferenceTopicGetResponse.AllowedPreference.SNOOZE + WorkspacePreferenceTopicGetResponse.AllowedPreference.SNOOZE ) .created("created") - .defaultStatus(PreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) + .defaultStatus( + WorkspacePreferenceTopicGetResponse.DefaultStatus.OPTED_OUT + ) .includeUnsubscribeHeader(true) .name("name") .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicGetResponse.TopicData.builder() + WorkspacePreferenceTopicGetResponse.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -126,13 +132,13 @@ internal class PreferenceSectionListResponseTest { ) .build() - val roundtrippedPreferenceSectionListResponse = + val roundtrippedWorkspacePreferenceListResponse = jsonMapper.readValue( - jsonMapper.writeValueAsString(preferenceSectionListResponse), - jacksonTypeRef(), + jsonMapper.writeValueAsString(workspacePreferenceListResponse), + jacksonTypeRef(), ) - assertThat(roundtrippedPreferenceSectionListResponse) - .isEqualTo(preferenceSectionListResponse) + assertThat(roundtrippedWorkspacePreferenceListResponse) + .isEqualTo(workspacePreferenceListResponse) } } diff --git a/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferencePublishParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferencePublishParamsTest.kt new file mode 100644 index 0000000..f7ee239 --- /dev/null +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferencePublishParamsTest.kt @@ -0,0 +1,13 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.models.workspacepreferences + +import org.junit.jupiter.api.Test + +internal class WorkspacePreferencePublishParamsTest { + + @Test + fun create() { + WorkspacePreferencePublishParams.builder().build() + } +} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionReplaceParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceReplaceParamsTest.kt similarity index 62% rename from courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionReplaceParamsTest.kt rename to courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceReplaceParamsTest.kt index 2e8bc5e..e58f9f4 100644 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionReplaceParamsTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceReplaceParamsTest.kt @@ -1,19 +1,19 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.models.ChannelClassification import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -internal class PreferenceSectionReplaceParamsTest { +internal class WorkspacePreferenceReplaceParamsTest { @Test fun create() { - PreferenceSectionReplaceParams.builder() + WorkspacePreferenceReplaceParams.builder() .sectionId("section_id") - .preferenceSectionReplaceRequest( - PreferenceSectionReplaceRequest.builder() + .workspacePreferenceReplaceRequest( + WorkspacePreferenceReplaceRequest.builder() .name("name") .hasCustomRouting(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) @@ -25,10 +25,10 @@ internal class PreferenceSectionReplaceParamsTest { @Test fun pathParams() { val params = - PreferenceSectionReplaceParams.builder() + WorkspacePreferenceReplaceParams.builder() .sectionId("section_id") - .preferenceSectionReplaceRequest( - PreferenceSectionReplaceRequest.builder().name("name").build() + .workspacePreferenceReplaceRequest( + WorkspacePreferenceReplaceRequest.builder().name("name").build() ) .build() @@ -40,10 +40,10 @@ internal class PreferenceSectionReplaceParamsTest { @Test fun body() { val params = - PreferenceSectionReplaceParams.builder() + WorkspacePreferenceReplaceParams.builder() .sectionId("section_id") - .preferenceSectionReplaceRequest( - PreferenceSectionReplaceRequest.builder() + .workspacePreferenceReplaceRequest( + WorkspacePreferenceReplaceRequest.builder() .name("name") .hasCustomRouting(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) @@ -55,7 +55,7 @@ internal class PreferenceSectionReplaceParamsTest { assertThat(body) .isEqualTo( - PreferenceSectionReplaceRequest.builder() + WorkspacePreferenceReplaceRequest.builder() .name("name") .hasCustomRouting(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) @@ -66,15 +66,15 @@ internal class PreferenceSectionReplaceParamsTest { @Test fun bodyWithoutOptionalFields() { val params = - PreferenceSectionReplaceParams.builder() + WorkspacePreferenceReplaceParams.builder() .sectionId("section_id") - .preferenceSectionReplaceRequest( - PreferenceSectionReplaceRequest.builder().name("name").build() + .workspacePreferenceReplaceRequest( + WorkspacePreferenceReplaceRequest.builder().name("name").build() ) .build() val body = params._body() - assertThat(body).isEqualTo(PreferenceSectionReplaceRequest.builder().name("name").build()) + assertThat(body).isEqualTo(WorkspacePreferenceReplaceRequest.builder().name("name").build()) } } diff --git a/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceReplaceRequestTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceReplaceRequestTest.kt new file mode 100644 index 0000000..070ac44 --- /dev/null +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceReplaceRequestTest.kt @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.models.workspacepreferences + +import com.courier.core.jsonMapper +import com.courier.models.ChannelClassification +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class WorkspacePreferenceReplaceRequestTest { + + @Test + fun create() { + val workspacePreferenceReplaceRequest = + WorkspacePreferenceReplaceRequest.builder() + .name("name") + .hasCustomRouting(true) + .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) + .build() + + assertThat(workspacePreferenceReplaceRequest.name()).isEqualTo("name") + assertThat(workspacePreferenceReplaceRequest.hasCustomRouting()).contains(true) + assertThat(workspacePreferenceReplaceRequest.routingOptions().getOrNull()) + .containsExactly(ChannelClassification.DIRECT_MESSAGE) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val workspacePreferenceReplaceRequest = + WorkspacePreferenceReplaceRequest.builder() + .name("name") + .hasCustomRouting(true) + .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) + .build() + + val roundtrippedWorkspacePreferenceReplaceRequest = + jsonMapper.readValue( + jsonMapper.writeValueAsString(workspacePreferenceReplaceRequest), + jacksonTypeRef(), + ) + + assertThat(roundtrippedWorkspacePreferenceReplaceRequest) + .isEqualTo(workspacePreferenceReplaceRequest) + } +} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionRetrieveParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceRetrieveParamsTest.kt similarity index 56% rename from courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionRetrieveParamsTest.kt rename to courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceRetrieveParamsTest.kt index eecea46..98823f2 100644 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceSectionRetrieveParamsTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceRetrieveParamsTest.kt @@ -1,20 +1,20 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -internal class PreferenceSectionRetrieveParamsTest { +internal class WorkspacePreferenceRetrieveParamsTest { @Test fun create() { - PreferenceSectionRetrieveParams.builder().sectionId("section_id").build() + WorkspacePreferenceRetrieveParams.builder().sectionId("section_id").build() } @Test fun pathParams() { - val params = PreferenceSectionRetrieveParams.builder().sectionId("section_id").build() + val params = WorkspacePreferenceRetrieveParams.builder().sectionId("section_id").build() assertThat(params._pathParam(0)).isEqualTo("section_id") // out-of-bound path param diff --git a/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicCreateRequestTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicCreateRequestTest.kt new file mode 100644 index 0000000..f34bc57 --- /dev/null +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicCreateRequestTest.kt @@ -0,0 +1,77 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.models.workspacepreferences + +import com.courier.core.JsonValue +import com.courier.core.jsonMapper +import com.courier.models.ChannelClassification +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class WorkspacePreferenceTopicCreateRequestTest { + + @Test + fun create() { + val workspacePreferenceTopicCreateRequest = + WorkspacePreferenceTopicCreateRequest.builder() + .defaultStatus(WorkspacePreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) + .name("name") + .addAllowedPreference( + WorkspacePreferenceTopicCreateRequest.AllowedPreference.SNOOZE + ) + .includeUnsubscribeHeader(true) + .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) + .topicData( + WorkspacePreferenceTopicCreateRequest.TopicData.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + + assertThat(workspacePreferenceTopicCreateRequest.defaultStatus()) + .isEqualTo(WorkspacePreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) + assertThat(workspacePreferenceTopicCreateRequest.name()).isEqualTo("name") + assertThat(workspacePreferenceTopicCreateRequest.allowedPreferences().getOrNull()) + .containsExactly(WorkspacePreferenceTopicCreateRequest.AllowedPreference.SNOOZE) + assertThat(workspacePreferenceTopicCreateRequest.includeUnsubscribeHeader()).contains(true) + assertThat(workspacePreferenceTopicCreateRequest.routingOptions().getOrNull()) + .containsExactly(ChannelClassification.DIRECT_MESSAGE) + assertThat(workspacePreferenceTopicCreateRequest.topicData()) + .contains( + WorkspacePreferenceTopicCreateRequest.TopicData.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val workspacePreferenceTopicCreateRequest = + WorkspacePreferenceTopicCreateRequest.builder() + .defaultStatus(WorkspacePreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) + .name("name") + .addAllowedPreference( + WorkspacePreferenceTopicCreateRequest.AllowedPreference.SNOOZE + ) + .includeUnsubscribeHeader(true) + .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) + .topicData( + WorkspacePreferenceTopicCreateRequest.TopicData.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + + val roundtrippedWorkspacePreferenceTopicCreateRequest = + jsonMapper.readValue( + jsonMapper.writeValueAsString(workspacePreferenceTopicCreateRequest), + jacksonTypeRef(), + ) + + assertThat(roundtrippedWorkspacePreferenceTopicCreateRequest) + .isEqualTo(workspacePreferenceTopicCreateRequest) + } +} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicGetResponseTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicGetResponseTest.kt new file mode 100644 index 0000000..0f759d8 --- /dev/null +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicGetResponseTest.kt @@ -0,0 +1,87 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.models.workspacepreferences + +import com.courier.core.JsonValue +import com.courier.core.jsonMapper +import com.courier.models.ChannelClassification +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class WorkspacePreferenceTopicGetResponseTest { + + @Test + fun create() { + val workspacePreferenceTopicGetResponse = + WorkspacePreferenceTopicGetResponse.builder() + .id("id") + .addAllowedPreference(WorkspacePreferenceTopicGetResponse.AllowedPreference.SNOOZE) + .created("created") + .defaultStatus(WorkspacePreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) + .includeUnsubscribeHeader(true) + .name("name") + .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) + .topicData( + WorkspacePreferenceTopicGetResponse.TopicData.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .updated("updated") + .creator("creator") + .updater("updater") + .build() + + assertThat(workspacePreferenceTopicGetResponse.id()).isEqualTo("id") + assertThat(workspacePreferenceTopicGetResponse.allowedPreferences()) + .containsExactly(WorkspacePreferenceTopicGetResponse.AllowedPreference.SNOOZE) + assertThat(workspacePreferenceTopicGetResponse.created()).isEqualTo("created") + assertThat(workspacePreferenceTopicGetResponse.defaultStatus()) + .isEqualTo(WorkspacePreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) + assertThat(workspacePreferenceTopicGetResponse.includeUnsubscribeHeader()).isEqualTo(true) + assertThat(workspacePreferenceTopicGetResponse.name()).isEqualTo("name") + assertThat(workspacePreferenceTopicGetResponse.routingOptions()) + .containsExactly(ChannelClassification.DIRECT_MESSAGE) + assertThat(workspacePreferenceTopicGetResponse.topicData()) + .isEqualTo( + WorkspacePreferenceTopicGetResponse.TopicData.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + assertThat(workspacePreferenceTopicGetResponse.updated()).isEqualTo("updated") + assertThat(workspacePreferenceTopicGetResponse.creator()).contains("creator") + assertThat(workspacePreferenceTopicGetResponse.updater()).contains("updater") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val workspacePreferenceTopicGetResponse = + WorkspacePreferenceTopicGetResponse.builder() + .id("id") + .addAllowedPreference(WorkspacePreferenceTopicGetResponse.AllowedPreference.SNOOZE) + .created("created") + .defaultStatus(WorkspacePreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) + .includeUnsubscribeHeader(true) + .name("name") + .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) + .topicData( + WorkspacePreferenceTopicGetResponse.TopicData.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .updated("updated") + .creator("creator") + .updater("updater") + .build() + + val roundtrippedWorkspacePreferenceTopicGetResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(workspacePreferenceTopicGetResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedWorkspacePreferenceTopicGetResponse) + .isEqualTo(workspacePreferenceTopicGetResponse) + } +} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceTopicListResponseTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicListResponseTest.kt similarity index 55% rename from courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceTopicListResponseTest.kt rename to courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicListResponseTest.kt index f1367f3..3b2402c 100644 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/PreferenceTopicListResponseTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicListResponseTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections +package com.courier.models.workspacepreferences import com.courier.core.JsonValue import com.courier.core.jsonMapper @@ -9,23 +9,25 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -internal class PreferenceTopicListResponseTest { +internal class WorkspacePreferenceTopicListResponseTest { @Test fun create() { - val preferenceTopicListResponse = - PreferenceTopicListResponse.builder() + val workspacePreferenceTopicListResponse = + WorkspacePreferenceTopicListResponse.builder() .addResult( - PreferenceTopicGetResponse.builder() + WorkspacePreferenceTopicGetResponse.builder() .id("id") - .addAllowedPreference(PreferenceTopicGetResponse.AllowedPreference.SNOOZE) + .addAllowedPreference( + WorkspacePreferenceTopicGetResponse.AllowedPreference.SNOOZE + ) .created("created") - .defaultStatus(PreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) + .defaultStatus(WorkspacePreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) .includeUnsubscribeHeader(true) .name("name") .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicGetResponse.TopicData.builder() + WorkspacePreferenceTopicGetResponse.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -36,18 +38,20 @@ internal class PreferenceTopicListResponseTest { ) .build() - assertThat(preferenceTopicListResponse.results()) + assertThat(workspacePreferenceTopicListResponse.results()) .containsExactly( - PreferenceTopicGetResponse.builder() + WorkspacePreferenceTopicGetResponse.builder() .id("id") - .addAllowedPreference(PreferenceTopicGetResponse.AllowedPreference.SNOOZE) + .addAllowedPreference( + WorkspacePreferenceTopicGetResponse.AllowedPreference.SNOOZE + ) .created("created") - .defaultStatus(PreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) + .defaultStatus(WorkspacePreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) .includeUnsubscribeHeader(true) .name("name") .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicGetResponse.TopicData.builder() + WorkspacePreferenceTopicGetResponse.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -61,19 +65,21 @@ internal class PreferenceTopicListResponseTest { @Test fun roundtrip() { val jsonMapper = jsonMapper() - val preferenceTopicListResponse = - PreferenceTopicListResponse.builder() + val workspacePreferenceTopicListResponse = + WorkspacePreferenceTopicListResponse.builder() .addResult( - PreferenceTopicGetResponse.builder() + WorkspacePreferenceTopicGetResponse.builder() .id("id") - .addAllowedPreference(PreferenceTopicGetResponse.AllowedPreference.SNOOZE) + .addAllowedPreference( + WorkspacePreferenceTopicGetResponse.AllowedPreference.SNOOZE + ) .created("created") - .defaultStatus(PreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) + .defaultStatus(WorkspacePreferenceTopicGetResponse.DefaultStatus.OPTED_OUT) .includeUnsubscribeHeader(true) .name("name") .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicGetResponse.TopicData.builder() + WorkspacePreferenceTopicGetResponse.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -84,12 +90,13 @@ internal class PreferenceTopicListResponseTest { ) .build() - val roundtrippedPreferenceTopicListResponse = + val roundtrippedWorkspacePreferenceTopicListResponse = jsonMapper.readValue( - jsonMapper.writeValueAsString(preferenceTopicListResponse), - jacksonTypeRef(), + jsonMapper.writeValueAsString(workspacePreferenceTopicListResponse), + jacksonTypeRef(), ) - assertThat(roundtrippedPreferenceTopicListResponse).isEqualTo(preferenceTopicListResponse) + assertThat(roundtrippedWorkspacePreferenceTopicListResponse) + .isEqualTo(workspacePreferenceTopicListResponse) } } diff --git a/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicReplaceRequestTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicReplaceRequestTest.kt new file mode 100644 index 0000000..6b97379 --- /dev/null +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/WorkspacePreferenceTopicReplaceRequestTest.kt @@ -0,0 +1,77 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.models.workspacepreferences + +import com.courier.core.JsonValue +import com.courier.core.jsonMapper +import com.courier.models.ChannelClassification +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class WorkspacePreferenceTopicReplaceRequestTest { + + @Test + fun create() { + val workspacePreferenceTopicReplaceRequest = + WorkspacePreferenceTopicReplaceRequest.builder() + .defaultStatus(WorkspacePreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) + .name("name") + .addAllowedPreference( + WorkspacePreferenceTopicReplaceRequest.AllowedPreference.SNOOZE + ) + .includeUnsubscribeHeader(true) + .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) + .topicData( + WorkspacePreferenceTopicReplaceRequest.TopicData.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + + assertThat(workspacePreferenceTopicReplaceRequest.defaultStatus()) + .isEqualTo(WorkspacePreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) + assertThat(workspacePreferenceTopicReplaceRequest.name()).isEqualTo("name") + assertThat(workspacePreferenceTopicReplaceRequest.allowedPreferences().getOrNull()) + .containsExactly(WorkspacePreferenceTopicReplaceRequest.AllowedPreference.SNOOZE) + assertThat(workspacePreferenceTopicReplaceRequest.includeUnsubscribeHeader()).contains(true) + assertThat(workspacePreferenceTopicReplaceRequest.routingOptions().getOrNull()) + .containsExactly(ChannelClassification.DIRECT_MESSAGE) + assertThat(workspacePreferenceTopicReplaceRequest.topicData()) + .contains( + WorkspacePreferenceTopicReplaceRequest.TopicData.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val workspacePreferenceTopicReplaceRequest = + WorkspacePreferenceTopicReplaceRequest.builder() + .defaultStatus(WorkspacePreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) + .name("name") + .addAllowedPreference( + WorkspacePreferenceTopicReplaceRequest.AllowedPreference.SNOOZE + ) + .includeUnsubscribeHeader(true) + .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) + .topicData( + WorkspacePreferenceTopicReplaceRequest.TopicData.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() + + val roundtrippedWorkspacePreferenceTopicReplaceRequest = + jsonMapper.readValue( + jsonMapper.writeValueAsString(workspacePreferenceTopicReplaceRequest), + jacksonTypeRef(), + ) + + assertThat(roundtrippedWorkspacePreferenceTopicReplaceRequest) + .isEqualTo(workspacePreferenceTopicReplaceRequest) + } +} diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/topics/TopicArchiveParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/topics/TopicArchiveParamsTest.kt similarity index 92% rename from courier-java-core/src/test/kotlin/com/courier/models/preferencesections/topics/TopicArchiveParamsTest.kt rename to courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/topics/TopicArchiveParamsTest.kt index 550bada..ac0ffbd 100644 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/topics/TopicArchiveParamsTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/topics/TopicArchiveParamsTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections.topics +package com.courier.models.workspacepreferences.topics import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/topics/TopicCreateParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/topics/TopicCreateParamsTest.kt similarity index 54% rename from courier-java-core/src/test/kotlin/com/courier/models/preferencesections/topics/TopicCreateParamsTest.kt rename to courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/topics/TopicCreateParamsTest.kt index 2344ab1..3b2c1a4 100644 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/topics/TopicCreateParamsTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/topics/TopicCreateParamsTest.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections.topics +package com.courier.models.workspacepreferences.topics import com.courier.core.JsonValue import com.courier.models.ChannelClassification -import com.courier.models.preferencesections.PreferenceTopicCreateRequest +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicCreateRequest import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -14,15 +14,17 @@ internal class TopicCreateParamsTest { fun create() { TopicCreateParams.builder() .sectionId("section_id") - .preferenceTopicCreateRequest( - PreferenceTopicCreateRequest.builder() - .defaultStatus(PreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) + .workspacePreferenceTopicCreateRequest( + WorkspacePreferenceTopicCreateRequest.builder() + .defaultStatus(WorkspacePreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) .name("Marketing") - .addAllowedPreference(PreferenceTopicCreateRequest.AllowedPreference.SNOOZE) + .addAllowedPreference( + WorkspacePreferenceTopicCreateRequest.AllowedPreference.SNOOZE + ) .includeUnsubscribeHeader(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicCreateRequest.TopicData.builder() + WorkspacePreferenceTopicCreateRequest.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -36,9 +38,11 @@ internal class TopicCreateParamsTest { val params = TopicCreateParams.builder() .sectionId("section_id") - .preferenceTopicCreateRequest( - PreferenceTopicCreateRequest.builder() - .defaultStatus(PreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) + .workspacePreferenceTopicCreateRequest( + WorkspacePreferenceTopicCreateRequest.builder() + .defaultStatus( + WorkspacePreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT + ) .name("Marketing") .build() ) @@ -54,15 +58,19 @@ internal class TopicCreateParamsTest { val params = TopicCreateParams.builder() .sectionId("section_id") - .preferenceTopicCreateRequest( - PreferenceTopicCreateRequest.builder() - .defaultStatus(PreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) + .workspacePreferenceTopicCreateRequest( + WorkspacePreferenceTopicCreateRequest.builder() + .defaultStatus( + WorkspacePreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT + ) .name("Marketing") - .addAllowedPreference(PreferenceTopicCreateRequest.AllowedPreference.SNOOZE) + .addAllowedPreference( + WorkspacePreferenceTopicCreateRequest.AllowedPreference.SNOOZE + ) .includeUnsubscribeHeader(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicCreateRequest.TopicData.builder() + WorkspacePreferenceTopicCreateRequest.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -74,14 +82,16 @@ internal class TopicCreateParamsTest { assertThat(body) .isEqualTo( - PreferenceTopicCreateRequest.builder() - .defaultStatus(PreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) + WorkspacePreferenceTopicCreateRequest.builder() + .defaultStatus(WorkspacePreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) .name("Marketing") - .addAllowedPreference(PreferenceTopicCreateRequest.AllowedPreference.SNOOZE) + .addAllowedPreference( + WorkspacePreferenceTopicCreateRequest.AllowedPreference.SNOOZE + ) .includeUnsubscribeHeader(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicCreateRequest.TopicData.builder() + WorkspacePreferenceTopicCreateRequest.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -94,9 +104,11 @@ internal class TopicCreateParamsTest { val params = TopicCreateParams.builder() .sectionId("section_id") - .preferenceTopicCreateRequest( - PreferenceTopicCreateRequest.builder() - .defaultStatus(PreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) + .workspacePreferenceTopicCreateRequest( + WorkspacePreferenceTopicCreateRequest.builder() + .defaultStatus( + WorkspacePreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT + ) .name("Marketing") .build() ) @@ -106,8 +118,8 @@ internal class TopicCreateParamsTest { assertThat(body) .isEqualTo( - PreferenceTopicCreateRequest.builder() - .defaultStatus(PreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) + WorkspacePreferenceTopicCreateRequest.builder() + .defaultStatus(WorkspacePreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) .name("Marketing") .build() ) diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/topics/TopicListParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/topics/TopicListParamsTest.kt similarity index 91% rename from courier-java-core/src/test/kotlin/com/courier/models/preferencesections/topics/TopicListParamsTest.kt rename to courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/topics/TopicListParamsTest.kt index 6dffeab..9de31eb 100644 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/topics/TopicListParamsTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/topics/TopicListParamsTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections.topics +package com.courier.models.workspacepreferences.topics import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/topics/TopicReplaceParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/topics/TopicReplaceParamsTest.kt similarity index 57% rename from courier-java-core/src/test/kotlin/com/courier/models/preferencesections/topics/TopicReplaceParamsTest.kt rename to courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/topics/TopicReplaceParamsTest.kt index e2718a2..0aa7116 100644 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/topics/TopicReplaceParamsTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/topics/TopicReplaceParamsTest.kt @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections.topics +package com.courier.models.workspacepreferences.topics import com.courier.core.JsonValue import com.courier.models.ChannelClassification -import com.courier.models.preferencesections.PreferenceTopicReplaceRequest +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicReplaceRequest import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -15,15 +15,17 @@ internal class TopicReplaceParamsTest { TopicReplaceParams.builder() .sectionId("section_id") .topicId("topic_id") - .preferenceTopicReplaceRequest( - PreferenceTopicReplaceRequest.builder() - .defaultStatus(PreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) + .workspacePreferenceTopicReplaceRequest( + WorkspacePreferenceTopicReplaceRequest.builder() + .defaultStatus(WorkspacePreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) .name("name") - .addAllowedPreference(PreferenceTopicReplaceRequest.AllowedPreference.SNOOZE) + .addAllowedPreference( + WorkspacePreferenceTopicReplaceRequest.AllowedPreference.SNOOZE + ) .includeUnsubscribeHeader(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicReplaceRequest.TopicData.builder() + WorkspacePreferenceTopicReplaceRequest.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -38,9 +40,11 @@ internal class TopicReplaceParamsTest { TopicReplaceParams.builder() .sectionId("section_id") .topicId("topic_id") - .preferenceTopicReplaceRequest( - PreferenceTopicReplaceRequest.builder() - .defaultStatus(PreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) + .workspacePreferenceTopicReplaceRequest( + WorkspacePreferenceTopicReplaceRequest.builder() + .defaultStatus( + WorkspacePreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT + ) .name("name") .build() ) @@ -58,17 +62,19 @@ internal class TopicReplaceParamsTest { TopicReplaceParams.builder() .sectionId("section_id") .topicId("topic_id") - .preferenceTopicReplaceRequest( - PreferenceTopicReplaceRequest.builder() - .defaultStatus(PreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) + .workspacePreferenceTopicReplaceRequest( + WorkspacePreferenceTopicReplaceRequest.builder() + .defaultStatus( + WorkspacePreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT + ) .name("name") .addAllowedPreference( - PreferenceTopicReplaceRequest.AllowedPreference.SNOOZE + WorkspacePreferenceTopicReplaceRequest.AllowedPreference.SNOOZE ) .includeUnsubscribeHeader(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicReplaceRequest.TopicData.builder() + WorkspacePreferenceTopicReplaceRequest.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -80,14 +86,16 @@ internal class TopicReplaceParamsTest { assertThat(body) .isEqualTo( - PreferenceTopicReplaceRequest.builder() - .defaultStatus(PreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) + WorkspacePreferenceTopicReplaceRequest.builder() + .defaultStatus(WorkspacePreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) .name("name") - .addAllowedPreference(PreferenceTopicReplaceRequest.AllowedPreference.SNOOZE) + .addAllowedPreference( + WorkspacePreferenceTopicReplaceRequest.AllowedPreference.SNOOZE + ) .includeUnsubscribeHeader(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicReplaceRequest.TopicData.builder() + WorkspacePreferenceTopicReplaceRequest.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -101,9 +109,11 @@ internal class TopicReplaceParamsTest { TopicReplaceParams.builder() .sectionId("section_id") .topicId("topic_id") - .preferenceTopicReplaceRequest( - PreferenceTopicReplaceRequest.builder() - .defaultStatus(PreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) + .workspacePreferenceTopicReplaceRequest( + WorkspacePreferenceTopicReplaceRequest.builder() + .defaultStatus( + WorkspacePreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT + ) .name("name") .build() ) @@ -113,8 +123,8 @@ internal class TopicReplaceParamsTest { assertThat(body) .isEqualTo( - PreferenceTopicReplaceRequest.builder() - .defaultStatus(PreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) + WorkspacePreferenceTopicReplaceRequest.builder() + .defaultStatus(WorkspacePreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) .name("name") .build() ) diff --git a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/topics/TopicRetrieveParamsTest.kt b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/topics/TopicRetrieveParamsTest.kt similarity index 92% rename from courier-java-core/src/test/kotlin/com/courier/models/preferencesections/topics/TopicRetrieveParamsTest.kt rename to courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/topics/TopicRetrieveParamsTest.kt index 46efdfe..f5e743b 100644 --- a/courier-java-core/src/test/kotlin/com/courier/models/preferencesections/topics/TopicRetrieveParamsTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/models/workspacepreferences/topics/TopicRetrieveParamsTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.models.preferencesections.topics +package com.courier.models.workspacepreferences.topics import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/courier-java-core/src/test/kotlin/com/courier/services/async/PreferenceSectionServiceAsyncTest.kt b/courier-java-core/src/test/kotlin/com/courier/services/async/PreferenceSectionServiceAsyncTest.kt deleted file mode 100644 index 32a153e..0000000 --- a/courier-java-core/src/test/kotlin/com/courier/services/async/PreferenceSectionServiceAsyncTest.kt +++ /dev/null @@ -1,105 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.courier.services.async - -import com.courier.client.okhttp.CourierOkHttpClientAsync -import com.courier.models.ChannelClassification -import com.courier.models.preferencesections.PreferenceSectionCreateRequest -import com.courier.models.preferencesections.PreferenceSectionReplaceParams -import com.courier.models.preferencesections.PreferenceSectionReplaceRequest -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class PreferenceSectionServiceAsyncTest { - - @Disabled("Mock server tests are disabled") - @Test - fun create() { - val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() - val preferenceSectionServiceAsync = client.preferenceSections() - - val preferenceSectionGetResponseFuture = - preferenceSectionServiceAsync.create( - PreferenceSectionCreateRequest.builder() - .name("Account Notifications") - .hasCustomRouting(true) - .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) - .build() - ) - - val preferenceSectionGetResponse = preferenceSectionGetResponseFuture.get() - preferenceSectionGetResponse.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun retrieve() { - val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() - val preferenceSectionServiceAsync = client.preferenceSections() - - val preferenceSectionGetResponseFuture = - preferenceSectionServiceAsync.retrieve("section_id") - - val preferenceSectionGetResponse = preferenceSectionGetResponseFuture.get() - preferenceSectionGetResponse.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun list() { - val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() - val preferenceSectionServiceAsync = client.preferenceSections() - - val preferenceSectionListResponseFuture = preferenceSectionServiceAsync.list() - - val preferenceSectionListResponse = preferenceSectionListResponseFuture.get() - preferenceSectionListResponse.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun archive() { - val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() - val preferenceSectionServiceAsync = client.preferenceSections() - - val future = preferenceSectionServiceAsync.archive("section_id") - - val response = future.get() - } - - @Disabled("Mock server tests are disabled") - @Test - fun publish() { - val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() - val preferenceSectionServiceAsync = client.preferenceSections() - - val publishPreferencesResponseFuture = preferenceSectionServiceAsync.publish() - - val publishPreferencesResponse = publishPreferencesResponseFuture.get() - publishPreferencesResponse.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun replace() { - val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() - val preferenceSectionServiceAsync = client.preferenceSections() - - val preferenceSectionGetResponseFuture = - preferenceSectionServiceAsync.replace( - PreferenceSectionReplaceParams.builder() - .sectionId("section_id") - .preferenceSectionReplaceRequest( - PreferenceSectionReplaceRequest.builder() - .name("name") - .hasCustomRouting(true) - .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) - .build() - ) - .build() - ) - - val preferenceSectionGetResponse = preferenceSectionGetResponseFuture.get() - preferenceSectionGetResponse.validate() - } -} diff --git a/courier-java-core/src/test/kotlin/com/courier/services/async/WorkspacePreferenceServiceAsyncTest.kt b/courier-java-core/src/test/kotlin/com/courier/services/async/WorkspacePreferenceServiceAsyncTest.kt new file mode 100644 index 0000000..0518f0f --- /dev/null +++ b/courier-java-core/src/test/kotlin/com/courier/services/async/WorkspacePreferenceServiceAsyncTest.kt @@ -0,0 +1,105 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.courier.services.async + +import com.courier.client.okhttp.CourierOkHttpClientAsync +import com.courier.models.ChannelClassification +import com.courier.models.workspacepreferences.WorkspacePreferenceCreateRequest +import com.courier.models.workspacepreferences.WorkspacePreferenceReplaceParams +import com.courier.models.workspacepreferences.WorkspacePreferenceReplaceRequest +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.Test + +internal class WorkspacePreferenceServiceAsyncTest { + + @Disabled("Mock server tests are disabled") + @Test + fun create() { + val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() + val workspacePreferenceServiceAsync = client.workspacePreferences() + + val workspacePreferenceGetResponseFuture = + workspacePreferenceServiceAsync.create( + WorkspacePreferenceCreateRequest.builder() + .name("Account Notifications") + .hasCustomRouting(true) + .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) + .build() + ) + + val workspacePreferenceGetResponse = workspacePreferenceGetResponseFuture.get() + workspacePreferenceGetResponse.validate() + } + + @Disabled("Mock server tests are disabled") + @Test + fun retrieve() { + val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() + val workspacePreferenceServiceAsync = client.workspacePreferences() + + val workspacePreferenceGetResponseFuture = + workspacePreferenceServiceAsync.retrieve("section_id") + + val workspacePreferenceGetResponse = workspacePreferenceGetResponseFuture.get() + workspacePreferenceGetResponse.validate() + } + + @Disabled("Mock server tests are disabled") + @Test + fun list() { + val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() + val workspacePreferenceServiceAsync = client.workspacePreferences() + + val workspacePreferenceListResponseFuture = workspacePreferenceServiceAsync.list() + + val workspacePreferenceListResponse = workspacePreferenceListResponseFuture.get() + workspacePreferenceListResponse.validate() + } + + @Disabled("Mock server tests are disabled") + @Test + fun archive() { + val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() + val workspacePreferenceServiceAsync = client.workspacePreferences() + + val future = workspacePreferenceServiceAsync.archive("section_id") + + val response = future.get() + } + + @Disabled("Mock server tests are disabled") + @Test + fun publish() { + val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() + val workspacePreferenceServiceAsync = client.workspacePreferences() + + val publishPreferencesResponseFuture = workspacePreferenceServiceAsync.publish() + + val publishPreferencesResponse = publishPreferencesResponseFuture.get() + publishPreferencesResponse.validate() + } + + @Disabled("Mock server tests are disabled") + @Test + fun replace() { + val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() + val workspacePreferenceServiceAsync = client.workspacePreferences() + + val workspacePreferenceGetResponseFuture = + workspacePreferenceServiceAsync.replace( + WorkspacePreferenceReplaceParams.builder() + .sectionId("section_id") + .workspacePreferenceReplaceRequest( + WorkspacePreferenceReplaceRequest.builder() + .name("name") + .hasCustomRouting(true) + .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) + .build() + ) + .build() + ) + + val workspacePreferenceGetResponse = workspacePreferenceGetResponseFuture.get() + workspacePreferenceGetResponse.validate() + } +} diff --git a/courier-java-core/src/test/kotlin/com/courier/services/async/preferencesections/TopicServiceAsyncTest.kt b/courier-java-core/src/test/kotlin/com/courier/services/async/workspacepreferences/TopicServiceAsyncTest.kt similarity index 52% rename from courier-java-core/src/test/kotlin/com/courier/services/async/preferencesections/TopicServiceAsyncTest.kt rename to courier-java-core/src/test/kotlin/com/courier/services/async/workspacepreferences/TopicServiceAsyncTest.kt index 76bd4b1..edad21f 100644 --- a/courier-java-core/src/test/kotlin/com/courier/services/async/preferencesections/TopicServiceAsyncTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/services/async/workspacepreferences/TopicServiceAsyncTest.kt @@ -1,16 +1,16 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.services.async.preferencesections +package com.courier.services.async.workspacepreferences import com.courier.client.okhttp.CourierOkHttpClientAsync import com.courier.core.JsonValue import com.courier.models.ChannelClassification -import com.courier.models.preferencesections.PreferenceTopicCreateRequest -import com.courier.models.preferencesections.PreferenceTopicReplaceRequest -import com.courier.models.preferencesections.topics.TopicArchiveParams -import com.courier.models.preferencesections.topics.TopicCreateParams -import com.courier.models.preferencesections.topics.TopicReplaceParams -import com.courier.models.preferencesections.topics.TopicRetrieveParams +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicCreateRequest +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicReplaceRequest +import com.courier.models.workspacepreferences.topics.TopicArchiveParams +import com.courier.models.workspacepreferences.topics.TopicCreateParams +import com.courier.models.workspacepreferences.topics.TopicReplaceParams +import com.courier.models.workspacepreferences.topics.TopicRetrieveParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test @@ -20,23 +20,25 @@ internal class TopicServiceAsyncTest { @Test fun create() { val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() - val topicServiceAsync = client.preferenceSections().topics() + val topicServiceAsync = client.workspacePreferences().topics() - val preferenceTopicGetResponseFuture = + val workspacePreferenceTopicGetResponseFuture = topicServiceAsync.create( TopicCreateParams.builder() .sectionId("section_id") - .preferenceTopicCreateRequest( - PreferenceTopicCreateRequest.builder() - .defaultStatus(PreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) + .workspacePreferenceTopicCreateRequest( + WorkspacePreferenceTopicCreateRequest.builder() + .defaultStatus( + WorkspacePreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT + ) .name("Marketing") .addAllowedPreference( - PreferenceTopicCreateRequest.AllowedPreference.SNOOZE + WorkspacePreferenceTopicCreateRequest.AllowedPreference.SNOOZE ) .includeUnsubscribeHeader(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicCreateRequest.TopicData.builder() + WorkspacePreferenceTopicCreateRequest.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -45,42 +47,42 @@ internal class TopicServiceAsyncTest { .build() ) - val preferenceTopicGetResponse = preferenceTopicGetResponseFuture.get() - preferenceTopicGetResponse.validate() + val workspacePreferenceTopicGetResponse = workspacePreferenceTopicGetResponseFuture.get() + workspacePreferenceTopicGetResponse.validate() } @Disabled("Mock server tests are disabled") @Test fun retrieve() { val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() - val topicServiceAsync = client.preferenceSections().topics() + val topicServiceAsync = client.workspacePreferences().topics() - val preferenceTopicGetResponseFuture = + val workspacePreferenceTopicGetResponseFuture = topicServiceAsync.retrieve( TopicRetrieveParams.builder().sectionId("section_id").topicId("topic_id").build() ) - val preferenceTopicGetResponse = preferenceTopicGetResponseFuture.get() - preferenceTopicGetResponse.validate() + val workspacePreferenceTopicGetResponse = workspacePreferenceTopicGetResponseFuture.get() + workspacePreferenceTopicGetResponse.validate() } @Disabled("Mock server tests are disabled") @Test fun list() { val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() - val topicServiceAsync = client.preferenceSections().topics() + val topicServiceAsync = client.workspacePreferences().topics() - val preferenceTopicListResponseFuture = topicServiceAsync.list("section_id") + val workspacePreferenceTopicListResponseFuture = topicServiceAsync.list("section_id") - val preferenceTopicListResponse = preferenceTopicListResponseFuture.get() - preferenceTopicListResponse.validate() + val workspacePreferenceTopicListResponse = workspacePreferenceTopicListResponseFuture.get() + workspacePreferenceTopicListResponse.validate() } @Disabled("Mock server tests are disabled") @Test fun archive() { val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() - val topicServiceAsync = client.preferenceSections().topics() + val topicServiceAsync = client.workspacePreferences().topics() val future = topicServiceAsync.archive( @@ -94,24 +96,26 @@ internal class TopicServiceAsyncTest { @Test fun replace() { val client = CourierOkHttpClientAsync.builder().apiKey("My API Key").build() - val topicServiceAsync = client.preferenceSections().topics() + val topicServiceAsync = client.workspacePreferences().topics() - val preferenceTopicGetResponseFuture = + val workspacePreferenceTopicGetResponseFuture = topicServiceAsync.replace( TopicReplaceParams.builder() .sectionId("section_id") .topicId("topic_id") - .preferenceTopicReplaceRequest( - PreferenceTopicReplaceRequest.builder() - .defaultStatus(PreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) + .workspacePreferenceTopicReplaceRequest( + WorkspacePreferenceTopicReplaceRequest.builder() + .defaultStatus( + WorkspacePreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT + ) .name("name") .addAllowedPreference( - PreferenceTopicReplaceRequest.AllowedPreference.SNOOZE + WorkspacePreferenceTopicReplaceRequest.AllowedPreference.SNOOZE ) .includeUnsubscribeHeader(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicReplaceRequest.TopicData.builder() + WorkspacePreferenceTopicReplaceRequest.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -120,7 +124,7 @@ internal class TopicServiceAsyncTest { .build() ) - val preferenceTopicGetResponse = preferenceTopicGetResponseFuture.get() - preferenceTopicGetResponse.validate() + val workspacePreferenceTopicGetResponse = workspacePreferenceTopicGetResponseFuture.get() + workspacePreferenceTopicGetResponse.validate() } } diff --git a/courier-java-core/src/test/kotlin/com/courier/services/blocking/PreferenceSectionServiceTest.kt b/courier-java-core/src/test/kotlin/com/courier/services/blocking/WorkspacePreferenceServiceTest.kt similarity index 52% rename from courier-java-core/src/test/kotlin/com/courier/services/blocking/PreferenceSectionServiceTest.kt rename to courier-java-core/src/test/kotlin/com/courier/services/blocking/WorkspacePreferenceServiceTest.kt index bfe7a64..d104a6f 100644 --- a/courier-java-core/src/test/kotlin/com/courier/services/blocking/PreferenceSectionServiceTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/services/blocking/WorkspacePreferenceServiceTest.kt @@ -4,70 +4,70 @@ package com.courier.services.blocking import com.courier.client.okhttp.CourierOkHttpClient import com.courier.models.ChannelClassification -import com.courier.models.preferencesections.PreferenceSectionCreateRequest -import com.courier.models.preferencesections.PreferenceSectionReplaceParams -import com.courier.models.preferencesections.PreferenceSectionReplaceRequest +import com.courier.models.workspacepreferences.WorkspacePreferenceCreateRequest +import com.courier.models.workspacepreferences.WorkspacePreferenceReplaceParams +import com.courier.models.workspacepreferences.WorkspacePreferenceReplaceRequest import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -internal class PreferenceSectionServiceTest { +internal class WorkspacePreferenceServiceTest { @Disabled("Mock server tests are disabled") @Test fun create() { val client = CourierOkHttpClient.builder().apiKey("My API Key").build() - val preferenceSectionService = client.preferenceSections() + val workspacePreferenceService = client.workspacePreferences() - val preferenceSectionGetResponse = - preferenceSectionService.create( - PreferenceSectionCreateRequest.builder() + val workspacePreferenceGetResponse = + workspacePreferenceService.create( + WorkspacePreferenceCreateRequest.builder() .name("Account Notifications") .hasCustomRouting(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .build() ) - preferenceSectionGetResponse.validate() + workspacePreferenceGetResponse.validate() } @Disabled("Mock server tests are disabled") @Test fun retrieve() { val client = CourierOkHttpClient.builder().apiKey("My API Key").build() - val preferenceSectionService = client.preferenceSections() + val workspacePreferenceService = client.workspacePreferences() - val preferenceSectionGetResponse = preferenceSectionService.retrieve("section_id") + val workspacePreferenceGetResponse = workspacePreferenceService.retrieve("section_id") - preferenceSectionGetResponse.validate() + workspacePreferenceGetResponse.validate() } @Disabled("Mock server tests are disabled") @Test fun list() { val client = CourierOkHttpClient.builder().apiKey("My API Key").build() - val preferenceSectionService = client.preferenceSections() + val workspacePreferenceService = client.workspacePreferences() - val preferenceSectionListResponse = preferenceSectionService.list() + val workspacePreferenceListResponse = workspacePreferenceService.list() - preferenceSectionListResponse.validate() + workspacePreferenceListResponse.validate() } @Disabled("Mock server tests are disabled") @Test fun archive() { val client = CourierOkHttpClient.builder().apiKey("My API Key").build() - val preferenceSectionService = client.preferenceSections() + val workspacePreferenceService = client.workspacePreferences() - preferenceSectionService.archive("section_id") + workspacePreferenceService.archive("section_id") } @Disabled("Mock server tests are disabled") @Test fun publish() { val client = CourierOkHttpClient.builder().apiKey("My API Key").build() - val preferenceSectionService = client.preferenceSections() + val workspacePreferenceService = client.workspacePreferences() - val publishPreferencesResponse = preferenceSectionService.publish() + val publishPreferencesResponse = workspacePreferenceService.publish() publishPreferencesResponse.validate() } @@ -76,14 +76,14 @@ internal class PreferenceSectionServiceTest { @Test fun replace() { val client = CourierOkHttpClient.builder().apiKey("My API Key").build() - val preferenceSectionService = client.preferenceSections() + val workspacePreferenceService = client.workspacePreferences() - val preferenceSectionGetResponse = - preferenceSectionService.replace( - PreferenceSectionReplaceParams.builder() + val workspacePreferenceGetResponse = + workspacePreferenceService.replace( + WorkspacePreferenceReplaceParams.builder() .sectionId("section_id") - .preferenceSectionReplaceRequest( - PreferenceSectionReplaceRequest.builder() + .workspacePreferenceReplaceRequest( + WorkspacePreferenceReplaceRequest.builder() .name("name") .hasCustomRouting(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) @@ -92,6 +92,6 @@ internal class PreferenceSectionServiceTest { .build() ) - preferenceSectionGetResponse.validate() + workspacePreferenceGetResponse.validate() } } diff --git a/courier-java-core/src/test/kotlin/com/courier/services/blocking/preferencesections/TopicServiceTest.kt b/courier-java-core/src/test/kotlin/com/courier/services/blocking/workspacepreferences/TopicServiceTest.kt similarity index 55% rename from courier-java-core/src/test/kotlin/com/courier/services/blocking/preferencesections/TopicServiceTest.kt rename to courier-java-core/src/test/kotlin/com/courier/services/blocking/workspacepreferences/TopicServiceTest.kt index f7ee355..c77297a 100644 --- a/courier-java-core/src/test/kotlin/com/courier/services/blocking/preferencesections/TopicServiceTest.kt +++ b/courier-java-core/src/test/kotlin/com/courier/services/blocking/workspacepreferences/TopicServiceTest.kt @@ -1,16 +1,16 @@ // File generated from our OpenAPI spec by Stainless. -package com.courier.services.blocking.preferencesections +package com.courier.services.blocking.workspacepreferences import com.courier.client.okhttp.CourierOkHttpClient import com.courier.core.JsonValue import com.courier.models.ChannelClassification -import com.courier.models.preferencesections.PreferenceTopicCreateRequest -import com.courier.models.preferencesections.PreferenceTopicReplaceRequest -import com.courier.models.preferencesections.topics.TopicArchiveParams -import com.courier.models.preferencesections.topics.TopicCreateParams -import com.courier.models.preferencesections.topics.TopicReplaceParams -import com.courier.models.preferencesections.topics.TopicRetrieveParams +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicCreateRequest +import com.courier.models.workspacepreferences.WorkspacePreferenceTopicReplaceRequest +import com.courier.models.workspacepreferences.topics.TopicArchiveParams +import com.courier.models.workspacepreferences.topics.TopicCreateParams +import com.courier.models.workspacepreferences.topics.TopicReplaceParams +import com.courier.models.workspacepreferences.topics.TopicRetrieveParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test @@ -20,23 +20,25 @@ internal class TopicServiceTest { @Test fun create() { val client = CourierOkHttpClient.builder().apiKey("My API Key").build() - val topicService = client.preferenceSections().topics() + val topicService = client.workspacePreferences().topics() - val preferenceTopicGetResponse = + val workspacePreferenceTopicGetResponse = topicService.create( TopicCreateParams.builder() .sectionId("section_id") - .preferenceTopicCreateRequest( - PreferenceTopicCreateRequest.builder() - .defaultStatus(PreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT) + .workspacePreferenceTopicCreateRequest( + WorkspacePreferenceTopicCreateRequest.builder() + .defaultStatus( + WorkspacePreferenceTopicCreateRequest.DefaultStatus.OPTED_OUT + ) .name("Marketing") .addAllowedPreference( - PreferenceTopicCreateRequest.AllowedPreference.SNOOZE + WorkspacePreferenceTopicCreateRequest.AllowedPreference.SNOOZE ) .includeUnsubscribeHeader(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicCreateRequest.TopicData.builder() + WorkspacePreferenceTopicCreateRequest.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -45,39 +47,39 @@ internal class TopicServiceTest { .build() ) - preferenceTopicGetResponse.validate() + workspacePreferenceTopicGetResponse.validate() } @Disabled("Mock server tests are disabled") @Test fun retrieve() { val client = CourierOkHttpClient.builder().apiKey("My API Key").build() - val topicService = client.preferenceSections().topics() + val topicService = client.workspacePreferences().topics() - val preferenceTopicGetResponse = + val workspacePreferenceTopicGetResponse = topicService.retrieve( TopicRetrieveParams.builder().sectionId("section_id").topicId("topic_id").build() ) - preferenceTopicGetResponse.validate() + workspacePreferenceTopicGetResponse.validate() } @Disabled("Mock server tests are disabled") @Test fun list() { val client = CourierOkHttpClient.builder().apiKey("My API Key").build() - val topicService = client.preferenceSections().topics() + val topicService = client.workspacePreferences().topics() - val preferenceTopicListResponse = topicService.list("section_id") + val workspacePreferenceTopicListResponse = topicService.list("section_id") - preferenceTopicListResponse.validate() + workspacePreferenceTopicListResponse.validate() } @Disabled("Mock server tests are disabled") @Test fun archive() { val client = CourierOkHttpClient.builder().apiKey("My API Key").build() - val topicService = client.preferenceSections().topics() + val topicService = client.workspacePreferences().topics() topicService.archive( TopicArchiveParams.builder().sectionId("section_id").topicId("topic_id").build() @@ -88,24 +90,26 @@ internal class TopicServiceTest { @Test fun replace() { val client = CourierOkHttpClient.builder().apiKey("My API Key").build() - val topicService = client.preferenceSections().topics() + val topicService = client.workspacePreferences().topics() - val preferenceTopicGetResponse = + val workspacePreferenceTopicGetResponse = topicService.replace( TopicReplaceParams.builder() .sectionId("section_id") .topicId("topic_id") - .preferenceTopicReplaceRequest( - PreferenceTopicReplaceRequest.builder() - .defaultStatus(PreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT) + .workspacePreferenceTopicReplaceRequest( + WorkspacePreferenceTopicReplaceRequest.builder() + .defaultStatus( + WorkspacePreferenceTopicReplaceRequest.DefaultStatus.OPTED_OUT + ) .name("name") .addAllowedPreference( - PreferenceTopicReplaceRequest.AllowedPreference.SNOOZE + WorkspacePreferenceTopicReplaceRequest.AllowedPreference.SNOOZE ) .includeUnsubscribeHeader(true) .addRoutingOption(ChannelClassification.DIRECT_MESSAGE) .topicData( - PreferenceTopicReplaceRequest.TopicData.builder() + WorkspacePreferenceTopicReplaceRequest.TopicData.builder() .putAdditionalProperty("foo", JsonValue.from("bar")) .build() ) @@ -114,6 +118,6 @@ internal class TopicServiceTest { .build() ) - preferenceTopicGetResponse.validate() + workspacePreferenceTopicGetResponse.validate() } } diff --git a/courier-java-proguard-test/src/test/kotlin/com/courier/proguard/ProGuardCompatibilityTest.kt b/courier-java-proguard-test/src/test/kotlin/com/courier/proguard/ProGuardCompatibilityTest.kt index 9f8bf1d..2783a45 100644 --- a/courier-java-proguard-test/src/test/kotlin/com/courier/proguard/ProGuardCompatibilityTest.kt +++ b/courier-java-proguard-test/src/test/kotlin/com/courier/proguard/ProGuardCompatibilityTest.kt @@ -66,7 +66,7 @@ internal class ProGuardCompatibilityTest { assertThat(client.requests()).isNotNull() assertThat(client.notifications()).isNotNull() assertThat(client.routingStrategies()).isNotNull() - assertThat(client.preferenceSections()).isNotNull() + assertThat(client.workspacePreferences()).isNotNull() assertThat(client.profiles()).isNotNull() assertThat(client.tenants()).isNotNull() assertThat(client.translations()).isNotNull() From 95daf0b3f98a989a1c2c7cfc3b88c994936decb8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 25 Jun 2026 21:10:42 +0000 Subject: [PATCH 2/5] docs(openapi): reword Get Submission Checks description --- .stats.yml | 4 ++-- .../courier/models/notifications/checks/CheckListParams.kt | 2 +- .../courier/services/async/notifications/CheckServiceAsync.kt | 2 +- .../courier/services/blocking/notifications/CheckService.kt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index d5483cd..a4d71ab 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 134 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-ce444e85aa0c52b8598fa416a43acc05e079904f2ed523fc61b2c86d133f2a94.yml -openapi_spec_hash: 554fe5462296f1734b2a0a9545c0a16e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-6f4413f8c83d56aff2b3aed0a352fd5ccbd3637b20f47c79cd490eeb14364013.yml +openapi_spec_hash: c05c7a6f77aa4d83264d1f8e3d2ab69f config_hash: 74aad10d1512ec69541ece3ca51cf7fa diff --git a/courier-java-core/src/main/kotlin/com/courier/models/notifications/checks/CheckListParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/notifications/checks/CheckListParams.kt index 3da2567..4b68d87 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/notifications/checks/CheckListParams.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/notifications/checks/CheckListParams.kt @@ -10,7 +10,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Retrieve the checks for a notification template submission. */ +/** Retrieve the submission checks for a notification template. */ class CheckListParams private constructor( private val id: String, diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/notifications/CheckServiceAsync.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/notifications/CheckServiceAsync.kt index 89c9922..dc71d43 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/notifications/CheckServiceAsync.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/notifications/CheckServiceAsync.kt @@ -52,7 +52,7 @@ interface CheckServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Retrieve the checks for a notification template submission. */ + /** Retrieve the submission checks for a notification template. */ fun list(submissionId: String, params: CheckListParams): CompletableFuture = list(submissionId, params, RequestOptions.none()) diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/notifications/CheckService.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/notifications/CheckService.kt index f2fe3c0..f713351 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/notifications/CheckService.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/notifications/CheckService.kt @@ -50,7 +50,7 @@ interface CheckService { requestOptions: RequestOptions = RequestOptions.none(), ): CheckUpdateResponse - /** Retrieve the checks for a notification template submission. */ + /** Retrieve the submission checks for a notification template. */ fun list(submissionId: String, params: CheckListParams): CheckListResponse = list(submissionId, params, RequestOptions.none()) From 878a8a7cb71be98ed4490cfad61d4e611467dbfb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 25 Jun 2026 21:24:28 +0000 Subject: [PATCH 3/5] docs(openapi): reword Replace Submission Checks description --- .stats.yml | 4 ++-- .../courier/models/notifications/checks/CheckUpdateParams.kt | 2 +- .../courier/services/async/notifications/CheckServiceAsync.kt | 2 +- .../courier/services/blocking/notifications/CheckService.kt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index a4d71ab..5229999 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 134 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-6f4413f8c83d56aff2b3aed0a352fd5ccbd3637b20f47c79cd490eeb14364013.yml -openapi_spec_hash: c05c7a6f77aa4d83264d1f8e3d2ab69f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-f89ad46559bb30e2bd9b5f85fd186c069e6c4bb32b744708c76d3a082739b864.yml +openapi_spec_hash: eb523a5b5dc53d3203ce2a395e8222ff config_hash: 74aad10d1512ec69541ece3ca51cf7fa diff --git a/courier-java-core/src/main/kotlin/com/courier/models/notifications/checks/CheckUpdateParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/notifications/checks/CheckUpdateParams.kt index 2554c0b..59bc206 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/notifications/checks/CheckUpdateParams.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/notifications/checks/CheckUpdateParams.kt @@ -23,7 +23,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Replace the checks for a notification template submission. */ +/** Replace the submission checks for a notification template. */ class CheckUpdateParams private constructor( private val id: String, diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/notifications/CheckServiceAsync.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/notifications/CheckServiceAsync.kt index dc71d43..f4b5131 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/notifications/CheckServiceAsync.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/notifications/CheckServiceAsync.kt @@ -28,7 +28,7 @@ interface CheckServiceAsync { */ fun withOptions(modifier: Consumer): CheckServiceAsync - /** Replace the checks for a notification template submission. */ + /** Replace the submission checks for a notification template. */ fun update( submissionId: String, params: CheckUpdateParams, diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/notifications/CheckService.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/notifications/CheckService.kt index f713351..ea93056 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/notifications/CheckService.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/notifications/CheckService.kt @@ -28,7 +28,7 @@ interface CheckService { */ fun withOptions(modifier: Consumer): CheckService - /** Replace the checks for a notification template submission. */ + /** Replace the submission checks for a notification template. */ fun update(submissionId: String, params: CheckUpdateParams): CheckUpdateResponse = update(submissionId, params, RequestOptions.none()) From 8be16f8740cc317d81f7a5ca3b3debaf746b073e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 25 Jun 2026 21:39:55 +0000 Subject: [PATCH 4/5] docs(openapi): reword Cancel Submission description --- .stats.yml | 4 ++-- .../courier/models/notifications/checks/CheckDeleteParams.kt | 2 +- .../courier/services/async/notifications/CheckServiceAsync.kt | 2 +- .../courier/services/blocking/notifications/CheckService.kt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5229999..5fa6994 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 134 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-f89ad46559bb30e2bd9b5f85fd186c069e6c4bb32b744708c76d3a082739b864.yml -openapi_spec_hash: eb523a5b5dc53d3203ce2a395e8222ff +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-97bb4b698571b6dbe884e93397d14aff0ec7e7279de272a15fa0defb3b2515d5.yml +openapi_spec_hash: c33bf8733151f4f5693788b6e57a8344 config_hash: 74aad10d1512ec69541ece3ca51cf7fa diff --git a/courier-java-core/src/main/kotlin/com/courier/models/notifications/checks/CheckDeleteParams.kt b/courier-java-core/src/main/kotlin/com/courier/models/notifications/checks/CheckDeleteParams.kt index 75c4607..feff5bf 100644 --- a/courier-java-core/src/main/kotlin/com/courier/models/notifications/checks/CheckDeleteParams.kt +++ b/courier-java-core/src/main/kotlin/com/courier/models/notifications/checks/CheckDeleteParams.kt @@ -12,7 +12,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Cancel a notification template submission. */ +/** Cancel a submission for a notification template. */ class CheckDeleteParams private constructor( private val id: String, diff --git a/courier-java-core/src/main/kotlin/com/courier/services/async/notifications/CheckServiceAsync.kt b/courier-java-core/src/main/kotlin/com/courier/services/async/notifications/CheckServiceAsync.kt index f4b5131..9470d9b 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/async/notifications/CheckServiceAsync.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/async/notifications/CheckServiceAsync.kt @@ -74,7 +74,7 @@ interface CheckServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Cancel a notification template submission. */ + /** Cancel a submission for a notification template. */ fun delete(submissionId: String, params: CheckDeleteParams): CompletableFuture = delete(submissionId, params, RequestOptions.none()) diff --git a/courier-java-core/src/main/kotlin/com/courier/services/blocking/notifications/CheckService.kt b/courier-java-core/src/main/kotlin/com/courier/services/blocking/notifications/CheckService.kt index ea93056..279716b 100644 --- a/courier-java-core/src/main/kotlin/com/courier/services/blocking/notifications/CheckService.kt +++ b/courier-java-core/src/main/kotlin/com/courier/services/blocking/notifications/CheckService.kt @@ -71,7 +71,7 @@ interface CheckService { requestOptions: RequestOptions = RequestOptions.none(), ): CheckListResponse - /** Cancel a notification template submission. */ + /** Cancel a submission for a notification template. */ fun delete(submissionId: String, params: CheckDeleteParams) = delete(submissionId, params, RequestOptions.none()) From 3ebc9e4cd1cfc7e41f8186d9745593d9d9bd5ca7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 25 Jun 2026 21:40:16 +0000 Subject: [PATCH 5/5] release: 4.18.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 11 +++++++++++ build.gradle.kts | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c001c07..5866fdc 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.18.1" + ".": "4.18.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b00efc..024ae8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 4.18.2 (2026-06-25) + +Full Changelog: [v4.18.1...v4.18.2](https://github.com/trycourier/courier-java/compare/v4.18.1...v4.18.2) + +### Documentation + +* **openapi:** add full response examples to every endpoint ([210ab8c](https://github.com/trycourier/courier-java/commit/210ab8c3f739ba985d644c099a910d491c4302f9)) +* **openapi:** reword Cancel Submission description ([8be16f8](https://github.com/trycourier/courier-java/commit/8be16f8740cc317d81f7a5ca3b3debaf746b073e)) +* **openapi:** reword Get Submission Checks description ([95daf0b](https://github.com/trycourier/courier-java/commit/95daf0b3f98a989a1c2c7cfc3b88c994936decb8)) +* **openapi:** reword Replace Submission Checks description ([878a8a7](https://github.com/trycourier/courier-java/commit/878a8a7cb71be98ed4490cfad61d4e611467dbfb)) + ## 4.18.1 (2026-06-24) Full Changelog: [v4.18.0...v4.18.1](https://github.com/trycourier/courier-java/compare/v4.18.0...v4.18.1) diff --git a/build.gradle.kts b/build.gradle.kts index a43b984..e43b879 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.courier" - version = "4.18.1" // x-release-please-version + version = "4.18.2" // x-release-please-version } subprojects {